[lldb-dev] breakpoint command

Mike Sartain mikesart at valvesoftware.com
Fri Jun 14 16:23:51 PDT 2013


lldb looks like it's adding some offset for the breakpoint command? The disassemble command looks like it works fine, but the breakpoint command is using an address fairly far into printf in this case. Before I head off to investigate, does anyone have any idea what might be going on here or suggestions on where to start?

Thanks.
 -Mike

(lldb) disassemble -n printf
libc.so.6`__printf at printf.c:30:
   0x7f961e2a2840:  subq   $216, %rsp

libc.so.6`__printf + 7 at printf.c:30:
   0x7f961e2a2847:  testb  %al, %al
   0x7f961e2a2849:  movq   %rsi, 40(%rsp)
   0x7f961e2a284e:  movq   %rdx, 48(%rsp)
   0x7f961e2a2853:  movq   %rcx, 56(%rsp)
   0x7f961e2a2858:  movq   %r8, 64(%rsp)
   0x7f961e2a285d:  movq   %r9, 72(%rsp)
   0x7f961e2a2862:  je     0x7f961e2a289b            ; __printf + 91 at printf.c:34
   0x7f961e2a2864:  movaps %xmm0, 80(%rsp) <=============== breakpoint gets set here
   0x7f961e2a2869:  movaps %xmm1, 96(%rsp)
   0x7f961e2a286e:  movaps %xmm2, 112(%rsp)
   0x7f961e2a2873:  movaps %xmm3, 128(%rsp)
   0x7f961e2a287b:  movaps %xmm4, 144(%rsp)
   0x7f961e2a2883:  movaps %xmm5, 160(%rsp)
   0x7f961e2a288b:  movaps %xmm6, 176(%rsp)
   0x7f961e2a2893:  movaps %xmm7, 192(%rsp)
   0x7f961e2a289b:  leaq   224(%rsp), %rax
   0x7f961e2a28a3:  movq   %rdi, %rsi
   0x7f961e2a28a6:  leaq   8(%rsp), %rdx
   0x7f961e2a28ab:  movl   $8, 8(%rsp)
   0x7f961e2a28b3:  movl   $48, 12(%rsp)
   0x7f961e2a28bb:  movq   %rax, 16(%rsp)
   0x7f961e2a28c0:  leaq   32(%rsp), %rax
   0x7f961e2a28c5:  movq   %rax, 24(%rsp)
   0x7f961e2a28ca:  movq   3556935(%rip), %rax
   0x7f961e2a28d1:  movq   (%rax), %rdi
   0x7f961e2a28d4:  callq  0x7f961e2979c0            ; _IO_vfprintf_internal at vfprintf.c:211
   0x7f961e2a28d9:  addq   $216, %rsp
   0x7f961e2a28e0:  ret

(lldb) b printf
Breakpoint 2: where = libc.so.6`__printf + 36 at printf.c:30, address = 0x00007f961e2a2864
(lldb) breakpoint set -n printf
Breakpoint 3: where = libc.so.6`__printf + 36 at printf.c:30, address = 0x00007f961e2a2864

(lldb) target modules lookup -s printf -v
1 symbols match 'printf' in /home/mikesart/data/src/blah2/build/blah:
        Address: 0x0000000000000000 (0x0000000000000000)
        Summary: 0x0000000000000000
0x0000000000000000
2 symbols match 'printf' in /lib/x86_64-linux-gnu/libc.so.6:
        Address: libc.so.6[0x0000000000053840] (libc.so.6..text + 215200)
        Summary: libc.so.6`__printf at printf.c:30
         Module: file = "/lib/x86_64-linux-gnu/libc.so.6", arch = "x86_64"
    CompileUnit: id = {0x0009273a}, file = "/build/buildd/eglibc-2.15/stdio-common/printf.c", language = "ISO C:1989"
       Function: id = {0x0009367e}, name = "__printf", range = [0x00007f961e2a2840-0x00007f961e2a28e1)
       FuncType: id = {0x0009367e}, decl = printf.c:29, clang_type = "int (const char *)"
         Blocks: id = {0x0009367e}, range = [0x7f961e2a2840-0x7f961e2a28e1)
      LineEntry: [0x00007f961e2a2840-0x00007f961e2a2864): /build/buildd/eglibc-2.15/stdio-common/printf.c:30
       Variable: id = {0x000936a3}, name = "format", type= "const char *", location = rdi, decl = printf.c:29
       Variable: id = {0x000936b3}, name = "arg", type= "va_list", location = DW_OP_fbreg(-216), decl = printf.c:31
       Variable: id = {0x000936c2}, name = "done", type= "int", location = rax, decl = printf.c:32
        Address: libc.so.6[0x0000000000053840] (libc-2.15.so..text + 215200)
        Summary: libc.so.6`__printf at printf.c:30
         Module: file = "/lib/x86_64-linux-gnu/libc.so.6", arch = "x86_64"
    CompileUnit: id = {0x0009273a}, file = "/build/buildd/eglibc-2.15/stdio-common/printf.c", language = "ISO C:1989"
       Function: id = {0x0009367e}, name = "__printf", range = [0x00007f961e2a2840-0x00007f961e2a28e1)
       FuncType: id = {0x0009367e}, decl = printf.c:29, clang_type = "int (const char *)"
         Blocks: id = {0x0009367e}, range = [0x7f961e2a2840-0x7f961e2a28e1)
      LineEntry: [0x00007f961e2a2840-0x00007f961e2a2864): /build/buildd/eglibc-2.15/stdio-common/printf.c:30
         Symbol: id = {0x00001ebc}, range = [0x0000000000053840-0x00000000000538e1), name="_IO_printf"
       Variable: id = {0x000936a3}, name = "format", type= "const char *", location = rdi, decl = printf.c:29
       Variable: id = {0x000936b3}, name = "arg", type= "va_list", location = DW_OP_fbreg(-216), decl = printf.c:31
       Variable: id = {0x000936c2}, name = "done", type= "int", location = rax, decl = printf.c:32

gdb works as expected:

(gdb) disassemble printf
Dump of assembler code for function __printf:
   0x00007ffff7054840 <+0>:     sub    rsp,0xd8
   0x00007ffff7054847:  test   al,al
   0x00007ffff7054849:  mov    QWORD PTR [rsp+0x28],rsi
   0x00007ffff705484e:  mov    QWORD PTR [rsp+0x30],rdx
   0x00007ffff7054853:  mov    QWORD PTR [rsp+0x38],rcx
   0x00007ffff7054858:  mov    QWORD PTR [rsp+0x40],r8
   0x00007ffff705485d:  mov    QWORD PTR [rsp+0x48],r9
   0x00007ffff7054862:  je     0x7ffff705489b
   0x00007ffff7054864:  movaps XMMWORD PTR [rsp+0x50],xmm0
   0x00007ffff7054869:  movaps XMMWORD PTR [rsp+0x60],xmm1
   0x00007ffff705486e:  movaps XMMWORD PTR [rsp+0x70],xmm2
   0x00007ffff7054873:  movaps XMMWORD PTR [rsp+0x80],xmm3
   0x00007ffff705487b:  movaps XMMWORD PTR [rsp+0x90],xmm4
   0x00007ffff7054883:  movaps XMMWORD PTR [rsp+0xa0],xmm5
   0x00007ffff705488b:  movaps XMMWORD PTR [rsp+0xb0],xmm6
   0x00007ffff7054893:  movaps XMMWORD PTR [rsp+0xc0],xmm7
   0x00007ffff705489b:  lea    rax,[rsp+0xe0]
   0x00007ffff70548a3:  mov    rsi,rdi
   0x00007ffff70548a6:  lea    rdx,[rsp+0x8]
   0x00007ffff70548ab:  mov    DWORD PTR [rsp+0x8],0x8
   0x00007ffff70548b3:  mov    DWORD PTR [rsp+0xc],0x30
   0x00007ffff70548bb:  mov    QWORD PTR [rsp+0x10],rax
   0x00007ffff70548c0:  lea    rax,[rsp+0x20]
   0x00007ffff70548c5:  mov    QWORD PTR [rsp+0x18],rax
   0x00007ffff70548ca:  mov    rax,QWORD PTR [rip+0x364647]        # 0x7ffff73b8f18
   0x00007ffff70548d1:  mov    rdi,QWORD PTR [rax]
   0x00007ffff70548d4:  call   0x7ffff70499c0 <_IO_vfprintf_internal at vfprintf.c:211>
   0x00007ffff70548d9:  add    rsp,0xd8
   0x00007ffff70548e0:  ret
End of assembler dump.
(gdb) b printf
Breakpoint 2 at 0x7ffff7054840: file printf.c, line 30.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20130614/5a94a8ab/attachment.html>


More information about the lldb-dev mailing list