On Sep 16, 2013, at 11:36 PM, Ryan Harkin <ryan.har...@linaro.org> wrote:

> Hi,
> 
> Tracking down a crash I am seeing shows that I am effectively calling 
> FreePool() with a NULL pointer.  The system then ASSERTS and hangs.
> 
> I've noticed various seemingly "random" asserts like this before and suspect 
> it may be related.  Of course, the assert output never helps track down the 
> culprit, but that's a different issue altogether.
> 

This seems to imply you do not have a source level debugger.... Which brings up 
a couple of thoughts. 

1) For X64 (x86_64) it is possible with clang to get a stack backtrace without 
symbols. This is not possible with VC++.  If you can get a stack backtrace with 
C code for gcc, then you guys could add a DebugLib instance that also prints 
out a stack trace so you can see what happened. It is possible to use the 
https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Include/Guid/DebugImageInfoTable.h
 to figure out the module name and the offset in that module. Since most 
modules are linked at zero you can usually run gdb on the object in the build 
output directory, and use the offset to figure out where it is in the C code. 

2) I was kind of surprised the QEMU story was to only use the 
SourceLevelDebugPkg. It seems like QEMU comes with a GDB-stub, and conceptually 
this would work the same way as jtag debugger? So a ctrl-c would be like 
breaking in with a jtag debugger? That seems very useful. There is all ready a 
scheme in EFI for an arbitrary debugger to find information about loaded 
images. So getting source level debug, in DXE, should not be that hard. 

>From UEFI 2.4...

17.4.2 EFI System Table Location
The EFI system table can be located by an off-target hardware debugger by 
searching for the EFI_SYSTEM_TABLE_POINTER structure. The 
EFI_SYSTEM_TABLE_POINTER structure is located on a 4M boundary as close to the 
top of physical memory as feasible. It may be found searching for the 
EFI_SYSTEM_TABLE_SIGNATURE on each 4M boundary starting at the top of memory 
and scanning down. When the signature is found, the entire structure must 
verified using the Crc32 field.

typedef struct _EFI_SYSTEM_TABLE_POINTER { 
        UINT64                                     Signature; 
        EFI_PHYSICAL_ADDRESS EfiSystemTableBase; 
        UINT32                                    Crc32;
} EFI_SYSTEM_TABLE_POINTER;

Signature                       A constant UINT64 that has the value 
EFI_SYSTEM_TABLE_SIGNATURE (see the EFI 1.0 specification).

EfiSystemTableBase      The physical address of the EFI system table. 

Crc32                           A 32-bit CRC value that is used to verify the 
EFI_SYSTEM_TABLE_POINTER structure is valid.


Thanks,

Andrew Fish

------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to