#18438 closed bug (fixed)

[Debugger] Fails to load whole debug info of an executable if its CIE's length is zero

Reported by: KENZ_gelsoft Owned by: anevilyak
Priority: normal Milestone: R1/beta5
Component: Applications/Debugger Version: R1/beta4
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

Environment:

  • Haiku: R1/beta4(Revision hrev56578+86) x86_64
  • on Real hardware with 8core Core i7-3770 w/ 16GB RAM

The problem (w/ STR):

  • The Debugger GUI can't locate source when I debug some libraries of the in-development Firefox. I can't specify source file location manually.
  • Rebuilt with DWARF3(by -gdwarf-3) helped a bit (main executable can be debugged with symbol), but didn't help some (most part of) libraries.
  • I launched the Debugger from command line like Debugger firefox (with some additional args to firefox).

Problem details I investigated:

  • The Debugger (kit) failed to load when the library has 0-length CIE(Common Information Entry).
  • 0-length CIE is not forbidden in spec, and llvm-dwarfdump handles correctly this.
  • I didn't identify what and why the build tool produces such a binary (contains 0-length CIE). But there are more than one shared objects(.so) in the firefox build output.

Attachments (1)

source_file_unavailable.png (187.3 KB ) - added by KENZ_gelsoft 19 months ago.
Screenshot with "Source file unavailable" message without button locating source file

Download all attachments as: .zip

Change History (5)

by KENZ_gelsoft, 19 months ago

Attachment: source_file_unavailable.png added

Screenshot with "Source file unavailable" message without button locating source file

comment:1 by KENZ_gelsoft, 19 months ago

Some links from the related forum topic.

My initial comment about this problem:

My sharing investigated result:

leavengood found 0-length CIE is valid:

comment:2 by KENZ_gelsoft, 19 months ago

My current change to the Debugger kit (revision is R1/beta4).

diff --git a/src/kits/debugger/dwarf/DwarfFile.cpp b/src/kits/debugger/dwarf/DwarfFile.cpp
index e382d6200e..d6bd0a0b38 100644
--- a/src/kits/debugger/dwarf/DwarfFile.cpp
+++ b/src/kits/debugger/dwarf/DwarfFile.cpp
@@ -1155,6 +1155,11 @@ DwarfFile::_ParseFrameSection(ElfSection* section, uint8 addressSize,
                if (length > (uint64)dataReader.BytesRemaining())
                        return B_BAD_DATA;
                off_t lengthOffset = dataReader.Offset();
+               
+               if (length == 0 && !ehFrame) {
+                       // Just skipping .debug_frame with 0-length CIE
+                       return B_OK;
+               }
 
                // CIE ID/CIE pointer
                uint64 cieID = dwarf64

I think this patch should work with latest Haiku, but will test, and will try submitting to the review.

comment:3 by KENZ_gelsoft, 19 months ago

I submitted above patch (with change to comply coding style rule):

https://review.haiku-os.org/c/haiku/+/6538

comment:4 by waddlesplash, 19 months ago

Milestone: UnscheduledR1/beta5
Resolution: fixed
Status: newclosed

Merged in hrev57084.

Note: See TracTickets for help on using tickets.