From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=17.171.2.33; helo=mail-in23.apple.com; envelope-from=afish@apple.com; receiver=edk2-devel@lists.01.org Received: from mail-in23.apple.com (mail-out23.apple.com [17.171.2.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 756A021A10969 for ; Tue, 28 Nov 2017 23:02:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; d=apple.com; s=mailout2048s; c=relaxed/simple; q=dns/txt; i=@apple.com; t=1511939203; h=From:Sender:Reply-To:Subject:Date:Message-id:To:Cc:MIME-version:Content-type: Content-transfer-encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=1i2EOKJQxUvE0SEfxvvPICfIkBfjtVE8lAwiZUN5BY8=; b=cpcPw6PAgJenP9WGPEkrTz52sJdI+6+m6nuFCxg56xZRbbFH3cbcYh++9pu2to73 WuABr8ikMDriYTGdHMLCbf3t5uTfr+6NpyyPUS9crVWbUE9jxJabbm7NfOoNQiFU Jt50fLGjUfJyG6dmPlXgwujKsK1VkJrxg8I1wzm5LhDJzovAglvIN4oT81MUJzEM rEwg7KRmmeU4YWLWAEQWOm1fWqfa4FRvrcZPliHsx07295qaGO8xzgc1zx2FZu5c picnRO2a1MAPnn/QCs6IQfKkdPY6Qse/TLAAb6JFEoRjt2HEaGU0EAhBJI/yi2ey KfVRSqfuu2bXEiO2Yrmzjw==; Received: from relay6.apple.com (relay6.apple.com [17.128.113.90]) (using TLS with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail-in23.apple.com (Apple Secure Mail Relay) with SMTP id 44.15.29340.38C5E1A5; Tue, 28 Nov 2017 23:06:43 -0800 (PST) X-AuditID: 11ab0217-df6059c00000729c-b4-5a1e5c836f10 Received: from nwk-mmpp-sz11.apple.com (nwk-mmpp-sz11.apple.com [17.128.115.155]) by relay6.apple.com (Apple SCV relay) with SMTP id A3.58.05652.38C5E1A5; Tue, 28 Nov 2017 23:06:43 -0800 (PST) MIME-version: 1.0 Received: from da0601a-dhcp180.apple.com ([17.226.15.180]) by nwk-mmpp-sz11.apple.com (Oracle Communications Messaging Server 8.0.2.1.20171102 64bit (built Nov 2 2017)) with ESMTPSA id <0P0600JS73R6ZGA0@nwk-mmpp-sz11.apple.com> for edk2-devel@lists.01.org; Tue, 28 Nov 2017 23:06:43 -0800 (PST) Sender: afish@apple.com From: Andrew Fish Message-id: <10AB1FEE-9360-4010-8639-3D531C4F68A4@apple.com> Date: Tue, 28 Nov 2017 23:06:42 -0800 To: "edk2-devel@lists.01.org" X-Mailer: Apple Mail (2.3445.5.20) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjluLIzCtJLcpLzFFi42IRbCiM0m2OkYsy2LlSymLPoaPMDowe3bP/ sQQwRnHZpKTmZJalFunbJXBlbLx1gb3gJF/F3K9HWRoYL3F3MXJySAiYSDz5tI25i5GLQ0hg DZPE3YObWWESVy4+YIFIHGKUeHV8I1iCV0BQ4sfke0AJDg5mAXmJg+dlQcLMAloS3x+1QtWv Z5L48nwXM0hCWEBc4t2ZTWA2m4CyxIr5H9gh4oYSVx/+ZIKYaSOx4sVTsDiLgKrEkV/nwOIi AuYSrfOvMEEcpCQx/fttNpAFEgInWSW2XW9lncAoMAvJTbMQbpqF5KYFjMyrGIVzEzNzdDPz jIz1EgsKclL1kvNzNzGCAnA1k/gOxs+vDQ8xCnAwKvHwXlghGyXEmlhWXJl7iFGag0VJnLdV Vi5KSCA9sSQ1OzW1ILUovqg0J7X4ECMTB6dUAyOT+4kL3ss0w+XybqtrdMh+mPj2Q1nAhWUd b9Neb+e98ELbr+/IBj7JKVe7dF53emZ6NsrYPX76gX152Qu5vKszOTWjZf0ecOXJ/rzm+uDo RmtfvzXzhLwva8RNPTIh+7+oSUnZ4nduhYyxqrt+XFE1eP3m3SKXaN48cea5vy5Mn1uW+Uld UEiJpTgj0VCLuag4EQA58ejJIQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgluLIzCtJLcpLzFFi42IRbCierdscIxdlcPY7u8WeQ0eZHRg9umf/ YwlgjOKySUnNySxLLdK3S+DK2HjrAnvBSb6KuV+PsjQwXuLuYuTkkBAwkbhy8QFLFyMXh5DA IUaJV8c3soIkeAUEJX5MvgeU4OBgFpCXOHheFiTMLKAl8f1RK1T9eiaJL893MYMkhAXEJd6d 2QRmswkoS6yY/4EdIm4ocfXhTyaImTYSK148BYuzCKhKHPl1DiwuImAu0Tr/ChPEQUoS07/f ZpvAyDsLyRmzEM6YheSMBYzMqxgFilJzEivN9BILCnJS9ZLzczcxgsOlMGoHY8Nyq0OMAhyM Sjy8F1bIRgmxJpYVV+YC/cnBrCTCu8FLLkqINyWxsiq1KD++qDQntfgQozQHi5I476eV4lFC AumJJanZqakFqUUwWSYOTqkGRr7I+e+Thecd4Z393qEzwiXpkLbd5df3AqoXr1Ku19OWvHnk Nhe3+7G0j81STG/K77FLTH49507JBb0l8r6bFOzfhByytHxl/9/tV/cRvjuH/tQ3FYrq9/3/ uiopQ0y59FeV+fLtU3b+fLi6an+y3hmeR/V9V1w/vC2TNVVp5Xinmbvg68IQUSWW4oxEQy3m ouJEAInQj7cTAgAA Subject: Anyone interested in core dumps for EFI? X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Nov 2017 07:02:20 -0000 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII I was mucking around making a mach-O core dump file and it turned out to be a little easier than I thought once I figured out the magic. The reality is it is constructed a lot like an executable. I'm assuming on the gcc and ELF side it would be similar. I've got no clue how it works on Windows. I basically wrote an lldb Python debugger function that takes a register dump and a list of memory ranges and it makes a core dump that you can read into lldb. The tricky bit is figuring out what to dump. I figured out how to find the stack that was in use (hint: top of stack is derived from rounding backward from the oldest frames frame pointer). If you have the stack frame you can find the load address and size of all the PE/COFF images referenced in the frame. Thus the stack + PE/COFF images in the frame becomes the simple core dump, and you get locals, globals, code. So far so good, but the problem comes in when you try and figure out the malloc'ed memory..... I'm guessing in PEI getting access to the PHIT HOB (EFI_HOB_HANDOFF_INFO_TABLE) and knowing the range of the XIP code in FVs would be the really useful info you need. In DXE you kind of need the memory map. The interesting thing about DXE is you don't really really care about the memory types as it is really just a do you need it kind of decision. I also guess if your memory reads are fast enough you can trade off dumping unused memory to remove fragmentation from the list. It kind of feels like we would need to update the DebugAgentLib so there is a path to communicate the memory regions that need to be dumped. I guess it might be possible to have the CpuExceptionHandlerLib do a core dump, but it is going to run into the same issue that you really need to know the memory ranges to dump. Seemed like an interesting topic to think about.... Thanks, Andrew Fish