[lldb-dev] breakpoint command
Greg Clayton
gclayton at apple.com
Mon Jun 17 14:33:44 PDT 2013
So I did the following command:
(lldb) image dump symtab --sort address
Debug symbol
|Synthetic symbol
||Externally Visible
|||
Index UserID DSX Type File Address/Value Load Address Size Flags Name
------- ------ --- ------------ ------------------ ------------------ ------------------ ---------- ----------------------------------
[ 4971] 5012 Code 0x0000000000053840 0x00000000000000a1 0x00000002 __printf
[ 5637] 5678 X Code 0x0000000000053840 0x00000000000000a1 0x00000012 _IO_printf
[ 6482] 6523 X Code 0x0000000000053840 0x00000000000000a1 0x00000012 printf
Note there are 3 symbols for this address as shown above. Currently we should the first one (__printf), but since this isn't the external name (note the X marking the latter two as external), we should probably show one of the external symbols.
The "symbol.st_info" is in bits 7:0 of the flags, and the "symbol.st_other" is in bits 15:8. So the flags are:
0x00000002 __printf STB_LOCAL | STT_FUNC
0x00000012 _IO_printf STB_GLOBAL | STT_FUNC
0x00000012 printf STB_GLOBAL | STT_FUNC
So there isn't much to be able to do with these symbols. Does anyone know why we have 3 symbols? Are these just aliases? Is there anyway to know that we should use "printf" by inspecting any other sections?
I checked out the line table for printf and found that there is indeed no "prologue_end" marker in the line table state machine, so we are setting a breakpoint on the second line table entry in the sequence which maps to 0x0000000000053864 as we saw in your previous output (which was slid to 0x7f961e2a2864). So everything is working as expected here given the information we have.
% ~/Documents/src/dwarfutils/trunk/build/Release/dwarfdump --debug-line=0x0001ef1b libc-2.15.so
----------------------------------------------------------------------
File: libc-2.15.so (x86_64)
----------------------------------------------------------------------
.debug_line contents:
----------------------------------------------------------------------
debug_line[0x0001ef1b]
----------------------------------------------------------------------
Line table prologue:
total_length: 0x000001af
version: 0x0002
prologue_length: 0x0000018a
min_inst_length: 0x01
default_is_stmt: 0x01
line_base: -5
line_range: 14
opcode_base: 0x0d
standard_opcode_lengths[ DW_LNS_copy ] = 0
standard_opcode_lengths[ DW_LNS_advance_pc ] = 1
standard_opcode_lengths[ DW_LNS_advance_line ] = 1
standard_opcode_lengths[ DW_LNS_set_file ] = 1
standard_opcode_lengths[ DW_LNS_set_column ] = 1
standard_opcode_lengths[ DW_LNS_negate_stmt ] = 0
standard_opcode_lengths[ DW_LNS_set_basic_block ] = 0
standard_opcode_lengths[ DW_LNS_const_add_pc ] = 0
standard_opcode_lengths[ DW_LNS_fixed_advance_pc ] = 1
standard_opcode_lengths[ DW_LNS_set_prologue_end ] = 0
standard_opcode_lengths[ DW_LNS_set_epilogue_begin ] = 0
standard_opcode_lengths[ DW_LNS_set_isa ] = 1
include_directories[ 1] = '/usr/lib/gcc/x86_64-linux-gnu/4.6/include'
include_directories[ 2] = '../sysdeps/generic'
include_directories[ 3] = '../bits'
include_directories[ 4] = '../inet/netinet'
include_directories[ 5] = '../include'
include_directories[ 6] = '../wcsmbs'
include_directories[ 7] = '../iconv'
include_directories[ 8] = '../sysdeps/gnu'
include_directories[ 9] = '../nptl/sysdeps/pthread/bits'
include_directories[ 10] = '../libio'
include_directories[ 11] = '../include/netinet'
Dir Mod Time File Len File Name
---- ---------- ---------- ---------------------------
file_names[ 1] 0 0x00000000 0x00000000 printf.c
file_names[ 2] 1 0x00000000 0x00000000 stddef.h
file_names[ 3] 2 0x00000000 0x00000000 stdint.h
file_names[ 4] 3 0x00000000 0x00000000 types.h
file_names[ 5] 4 0x00000000 0x00000000 in.h
file_names[ 6] 5 0x00000000 0x00000000 stdlib.h
file_names[ 7] 6 0x00000000 0x00000000 wchar.h
file_names[ 8] 7 0x00000000 0x00000000 gconv.h
file_names[ 9] 8 0x00000000 0x00000000 _G_config.h
file_names[ 10] 1 0x00000000 0x00000000 stdarg.h
file_names[ 11] 0 0x00000000 0x00000000 <built-in>
file_names[ 12] 9 0x00000000 0x00000000 stdio-lock.h
file_names[ 13] 10 0x00000000 0x00000000 libio.h
file_names[ 14] 10 0x00000000 0x00000000 libioP.h
file_names[ 15] 11 0x00000000 0x00000000 in.h
file_names[ 16] 10 0x00000000 0x00000000 stdio.h
0x0001f0af: DW_LNE_set_address( 0x0000000000053840 )
0x0001f0ba: DW_LNS_advance_line( 29 )
0x0001f0bc: DW_LNS_copy
0x0000000000053840 1 30 0 is_stmt
0x0001f0bd: DW_LNS_advance_pc( 36 )
0x0001f0bf: address += 0, line += 0
0x0000000000053864 1 30 0 is_stmt
0x0001f0c0: DW_LNS_advance_pc( 55 )
0x0001f0c2: address += 0, line += 4
0x000000000005389b 1 34 0 is_stmt
0x0001f0c3: address += 8, line += -4
0x00000000000538a3 1 30 0 is_stmt
0x0001f0c4: address += 3, line += 5
0x00000000000538a6 1 35 0 is_stmt
0x0001f0c5: address += 5, line += -1
0x00000000000538ab 1 34 0 is_stmt
0x0001f0c6: DW_LNS_const_add_pc( 0x0000000000000011 )
0x0001f0c7: address += e, line += 1
0x00000000000538ca 1 35 0 is_stmt
0x0001f0c8: address += f, line += 4
0x00000000000538d9 1 39 0 is_stmt
0x0001f0c9: DW_LNS_advance_pc( 8 )
0x0001f0cb: DW_LNE_end_sequence
0x00000000000538e1 1 39 0 is_stmt
On Jun 17, 2013, at 1:40 PM, Michael Sartain <mikesart at valvesoftware.com> wrote:
> On Mon, Jun 17, 2013 at 11:27 AM, Greg Clayton <gclayton at apple.com> wrote:
> We do skip the prologue by default. We use the DWARF line tables to see where the prologue end is. If the DWARF doesn't have a prologue end marker in it, we try and figure this out ourselves by using the second line table entry in the line table. I am guessing there is either bad DWARF line table info made by the compiler in this case (with an bad prologue end marker), or no prologue end marker.
>
> You can also see the some of the line table using:
>
> (lldb) image dump line-table printf.c
>
> This doesn't look right. It shouldn't have duplicates like that I assume?
>
> (lldb) image dump line-table printf.c
> Line table for /build/buildd/eglibc-2.15/stdio-common/printf.c in `libc.so.6
> 0x00007f159c281840: /build/buildd/eglibc-2.15/stdio-common/printf.c:30
> 0x00007f159c281864: /build/buildd/eglibc-2.15/stdio-common/printf.c:30
> 0x00007f159c28189b: /build/buildd/eglibc-2.15/stdio-common/printf.c:34
> 0x00007f159c2818a3: /build/buildd/eglibc-2.15/stdio-common/printf.c:30
> 0x00007f159c2818a6: /build/buildd/eglibc-2.15/stdio-common/printf.c:35
> 0x00007f159c2818ab: /build/buildd/eglibc-2.15/stdio-common/printf.c:34
> 0x00007f159c2818ca: /build/buildd/eglibc-2.15/stdio-common/printf.c:35
> 0x00007f159c2818d9: /build/buildd/eglibc-2.15/stdio-common/printf.c:39
> 0x00007f159c2818e1: /build/buildd/eglibc-2.15/stdio-common/printf.c:39
>
> ...
> If you send me the ELF file that contains printf, I can check it out the line table and probably the symbol issue for you.
>
> I put a zip file up here with the SO and the debug SO.
>
> https://docs.google.com/file/d/0B05iIR_mx6ApWXYzMmFzaWNSZ3M/edit?usp=sharing
>
> Thanks Greg.
> -Mike
More information about the lldb-dev
mailing list