This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Display libc function names instead of address ?


> Date: Thu, 16 Jun 2005 14:29:36 -0400
> From: Daniel Jacobowitz <drow@false.org>
> Cc: victor.stinner@haypocalc.com, gdb@sources.redhat.com
> 
> Here's an example of the effect of the patch I just posted to
> gdb-patches.  With an unpatched GDB, load gdb on a Linux system and run
> "disas captured_main":
> 
> 0x0807c0ac <captured_main+76>:  mov    %eax,0x4(%esp)
> 0x0807c0b0 <captured_main+80>:  movl   $0x5,(%esp)
> 0x0807c0b7 <captured_main+87>:  call   0x807b3a0 <_init+952>
> 0x0807c0bc <captured_main+92>:  movl   $0x0,(%esp)
> 0x0807c0c3 <captured_main+99>:  mov    $0x8239443,%eax
> 0x0807c0c8 <captured_main+104>: mov    %eax,0x4(%esp)
> 0x0807c0cc <captured_main+108>: call   0x807b3a0 <_init+952>
> 
> With the patch applied:
> 
> 0x0807c0ac <captured_main+76>:  mov    %eax,0x4(%esp)
> 0x0807c0b0 <captured_main+80>:  movl   $0x5,(%esp)
> 0x0807c0b7 <captured_main+87>:  call   0x807b3a0 <setlocale@plt>
> 0x0807c0bc <captured_main+92>:  movl   $0x0,(%esp)
> 0x0807c0c3 <captured_main+99>:  mov    $0x8239443,%eax
> 0x0807c0c8 <captured_main+104>: mov    %eax,0x4(%esp)
> 0x0807c0cc <captured_main+108>: call   0x807b3a0 <setlocale@plt>

I don't understand: what is this "setlocale@plt" thingy?

Anyway, I tried this with GDB 6.1 on a Debian box and saw this:

    0x0807a8ab <captured_main+75>:  mov    %eax,0xffffff10(%ebp)
    0x0807a8b1 <captured_main+81>:  add    $0xfffffff8,%esp
    0x0807a8b4 <captured_main+84>:  push   $0x81ca040
    0x0807a8b9 <captured_main+89>:  push   $0x5
    0x0807a8bb <captured_main+91>:  call   0x8079bec <setlocale>
    0x0807a8c0 <captured_main+96>:  add    $0xfffffff8,%esp
    0x0807a8c3 <captured_main+99>:  push   $0x81ca040
    0x0807a8c8 <captured_main+104>: push   $0x0
    0x0807a8ca <captured_main+106>: call   0x8079bec <setlocale>
    0x0807a8cf <captured_main+111>: add    $0x20,%esp
    0x0807a8d2 <captured_main+114>: add    $0xfffffff8,%esp
    0x0807a8d5 <captured_main+117>: push   $0x81ca041

which seems to show the names of library functions just fine.

I then tried this with GDB 6.3 and a MinGW build of Emacs on a
Windows XP box and saw things like this:

    0x0100216d <main+341>:  movl   $0x1,0xffffffd4(%ebp)
    0x01002174 <main+348>:  movl   $0x128a50f,0x4(%esp)
    0x0100217c <main+356>:  movl   $0x0,(%esp)
    0x01002183 <main+363>:  call   0x114f7e0 <setlocale>
    ...
    0x010021e1 <main+457>:  movl   $0x0,(%esp)
    0x010021e8 <main+464>:  call   0x114f7c0 <_isatty>
    ...
    0x010021f5 <main+477>:  mov    0xffffffe4(%ebp),%eax
    0x010021f8 <main+480>:  movl   $0x128a646,0x4(%esp)
    0x01002200 <main+488>:  mov    %eax,0x8(%esp)
    0x01002204 <main+492>:  mov    0x12fab38,%eax
    0x01002209 <main+497>:  add    $0x40,%eax
    0x0100220c <main+500>:  mov    %eax,(%esp)
    0x0100220f <main+503>:  call   0x114f830 <fprintf>

which again shows library functions with their full name.

So I'm unsure what is the problem.  Am I missing something?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]