[lldb-dev] [Bug 18648] Section's m_file_addr left unset after Mach-O parsing

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 28 16:02:06 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=18648

Greg Clayton <clayborg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clayborg at gmail.com
         Resolution|---                         |INVALID

--- Comment #1 from Greg Clayton <clayborg at gmail.com> ---
This is actually due to the mach-o file being not properly formed. Looking at
the segments and sections:

% dwarfdump -R simple 
----------------------------------------------------------------------
 File: simple (x86_64)
----------------------------------------------------------------------
Header
magic:      0xfeedfacf
cputype:    0x01000007
cpusubtype: 0x00000003
filetype:   0x00000002
ncmds:      0x00000009
sizeofcmds: 0x00000898
flags:      0x00000001


Segments
Segment Name     vmaddr           vmsize           fileoff          filesize   
     maxprot  initprot nsects   flags
---------------- ---------------- ---------------- ----------------
---------------- -------- -------- -------- --------
__PAGEZERO       0000000000000000 0000000000001000 0000000000000000
0000000000000000 00000000 00000000 00000000 00000000
__TEXT           0000000000001000 0000000000053000 0000000000000000
0000000000053000 00000007 00000005 00000006 00000000
__DATA           0000000000054000 00000000000207b8 0000000000053000
00000000000042a0 00000003 00000003 00000005 00000000
__LINKEDIT       0000000000075000 000000000000aef0 000000000007f000
000000000000aef0 00000007 00000003 00000000 00000000
__DWARF          0000000000000000 0000000000000000 0000000000058000
000000000002613d 00000000 00000000 00000008 00000000

Sections
Section Name     Segment Name     addr             size             offset  
align    reloff   nreloc   flags    reserv1  reserv2  reserv3  size     size %
---------------- ---------------- ---------------- ---------------- --------
-------- -------- -------- -------- -------- -------- -------- ======== ======
__text           __TEXT           0000000000002000 000000000001b039 00001000
00000004 00000000 00000000 00000400 00000000 00000000 00000000  108.06K 17.82%
__rodata         __TEXT           000000000001d040 00000000000164e0 0001c040
00000005 00000000 00000000 00000000 00000000 00000000 00000000   89.22K 14.71%
__typelink       __TEXT           0000000000033520 00000000000000f8 00032520
00000003 00000000 00000000 00000000 00000000 00000000 00000000  248      0.04%
__gosymtab       __TEXT           0000000000033620 000000000000b183 00032620
00000005 00000000 00000000 00000000 00000000 00000000 00000000   44.38K  7.32%
__gopclntab      __TEXT           000000000003e7c0 00000000000148f9 0003d7c0
00000005 00000000 00000000 00000000 00000000 00000000 00000000   82.24K 13.56%
__symbol_stub1   __TEXT           00000000000530b9 0000000000000000 00000000
00000000 00000000 00000000 80000408 00000000 00000006 00000000    0      0.00%
__nl_symbol_ptr  __DATA           0000000000054000 0000000000000000 00053000
00000002 00000000 00000000 00000006 00000000 00000000 00000000    0      0.00%
__noptrdata      __DATA           0000000000054000 0000000000000030 00053000
00000003 00000000 00000000 00000000 00000000 00000000 00000000   48      0.01%
__data           __DATA           0000000000054040 0000000000004248 00053040
00000005 00000000 00000000 00000000 00000000 00000000 00000000   16.57K  2.73%
__bss            __DATA           00000000000582a0 0000000000006ff8 00000000
00000005 00000000 00000000 00000001 00000000 00000000 00000000   27.99K  4.62%
__noptrbss       __DATA           000000000005f2a0 0000000000015518 00000000
00000005 00000000 00000000 00000001 00000000 00000000 00000000   85.27K 14.06%
__debug_abbrev   __DWARF          0000000000000000 00000000000000d3 00058000
00000000 00000000 00000000 00000000 00000000 00000000 00000000  211      0.03%
__debug_line     __DWARF          0000000000000000 0000000000007228 000580d3
00000000 00000000 00000000 00000000 00000000 00000000 00000000   28.54K  4.71%
__debug_frame    __DWARF          0000000000000000 0000000000004eb8 0005f2fb
00000000 00000000 00000000 00000000 00000000 00000000 00000000   19.68K  3.25%
__debug_info     __DWARF          0000000000000000 0000000000015224 000641b3
00000000 00000000 00000000 00000000 00000000 00000000 00000000   84.54K 13.94%
__debug_pubnames __DWARF          0000000000000000 0000000000003454 000793d7
00000000 00000000 00000000 00000000 00000000 00000000 00000000   13.08K  2.16%
__debug_pubtypes __DWARF          0000000000000000 0000000000001120 0007c82b
00000000 00000000 00000000 00000000 00000000 00000000 00000000    4.28K  0.71%
__debug_aranges  __DWARF          0000000000000000 00000000000007b0 0007d94b
00000000 00000000 00000000 00000000 00000000 00000000 00000000    1.92K  0.32%
__debug_gdb_scri __DWARF          0000000000000000 0000000000000042 0007e0fb
00000000 00000000 00000000 00000000 00000000 00000000 00000000   66      0.01%

We can see that the __DWARF segment has an address of zero and has no size. In
the mach-o world everything in the file must have a valid vmaddr and vmsize, so
the __DWARF segment should have an address that comes after the __LINKEDIT
section (0x75000 + 0xaef0), and the vmsize must be set correctly so it
encompasses all of the "__debug_xxx" sections. Also each address and size of
the "__debug" sections should be set to correctly fall into __DWARF segment
range of [vmaddr, vmsize).

So if you generate a valid mach-o file, LLDB will debug it just fine.

Marking as invalid since this isn't a LLDB bug.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140129/9639fa80/attachment.html>


More information about the lldb-dev mailing list