You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
MinGW produces PE's with DWARF debug information. The DWARF analyzer is unable to detect those sections and thus the analyzer is made unavailable under the list of analyzers.
Describe the solution you'd like
Enable DWARF analyzer for MinGW PE's.
Describe alternatives you've considered
I was able to get the DWARF analyzer to detect and fully parse the DWARF debug information, however it may need some more work, so I decided to create an issue for it instead.
Additional context
The DWARF analyzer cannot find the debug sections as it relies on finding sections matching those of DWARFSectionNames.MINIMAL_DWARF_SECTIONS. The PE does contain those sections however they are not found as the current PE loader does not correctly handle section names. Currently it only reads the name stored in the Name field in the SectionHeader structure (e.g. /14, /29), when it needs to also handle reading names from the string table. Here is a quote from Microsoft's documentation on the PE file format:
For longer names, this field contains a slash (/) that is followed by an ASCII representation of a decimal number that is an offset into the string table.
The DWARF parser uses the memory block size to determine the ending of the debug info in the .debug_info section. The problem is that the PE loader aligns memory blocks with padding while the actual size of the debug info is that of VirtualSize. Once the DWARF parser reaches the padding, it mistakenly reads it as a compilation unit, and then reads into the next memory block, eventually throwing an exception in DWARFCompilationUnit.readCompilationUnit(). This may conflict with #418.
It seems most of the windows analyzers canAnalyze methods are a bit faulty. They assume they can work just because it is a PE binary. The two I know of off the top of my head are PDB and the Windows RTTI Analyzer. These should only be available if the compiler was determined to be visual studio.
Is your feature request related to a problem? Please describe.
MinGW produces PE's with DWARF debug information. The DWARF analyzer is unable to detect those sections and thus the analyzer is made unavailable under the list of analyzers.
Describe the solution you'd like
Enable DWARF analyzer for MinGW PE's.
Describe alternatives you've considered
I was able to get the DWARF analyzer to detect and fully parse the DWARF debug information, however it may need some more work, so I decided to create an issue for it instead.
Additional context
The DWARF analyzer cannot find the debug sections as it relies on finding sections matching those of
DWARFSectionNames.MINIMAL_DWARF_SECTIONS
. The PE does contain those sections however they are not found as the current PE loader does not correctly handle section names. Currently it only reads the name stored in theName
field in theSectionHeader
structure (e.g./14
,/29
), when it needs to also handle reading names from the string table. Here is a quote from Microsoft's documentation on the PE file format:Source: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#section-table-section-headers
The DWARF parser uses the memory block size to determine the ending of the debug info in the
.debug_info
section. The problem is that the PE loader aligns memory blocks with padding while the actual size of the debug info is that ofVirtualSize
. Once the DWARF parser reaches the padding, it mistakenly reads it as a compilation unit, and then reads into the next memory block, eventually throwing an exception inDWARFCompilationUnit.readCompilationUnit()
. This may conflict with #418.Sample: helloworld.zip
The text was updated successfully, but these errors were encountered: