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]

function address from object file?


Hi,
    I am trying to print function address by reading an object file.
But the function address are all shown to be zero. How serious is this
bug? Here is the repro:-

$ cat a.c
#include <stdio.h>

void t(void)
{
        int i=0;
        printf("%d\n",i);
}

void u(void)
{
        int i=0;
        printf("%d\n",i);
}

int main()
{
        t();
        return 0;
}


$ gcc -c -g -o a.o a.c
$ gdb a.o
(gdb) info file
Symbols from "/tmp/a.o".
Local exec file:
        `/tmp/a.o', file type pe-i386.
        Entry point: 0x0
        0x00000000 - 0x00000070 is .text
(gdb) print &t
$1 = (void (*)()) 0		<------------- 0x0
(gdb) print &u
$2 = (void (*)()) 0		<------------- 0x0
(gdb) print &main
$3 = (int (*)()) 0		<------------- 0x0

$ objdump -d a.o

a.o:     file format pe-i386

Disassembly of section .text:

00000000 <_t>:
   0:   55                      push   %ebp
   1:   89 e5                   mov    %esp,%ebp
   3:   83 ec 08                sub    $0x8,%esp
   6:   c7 45 fc 00 00 00 00    movl   $0x0,0xfffffffc(%ebp)
   d:   83 ec 08                sub    $0x8,%esp
  10:   ff 75 fc                pushl  0xfffffffc(%ebp)
  13:   68 00 00 00 00          push   $0x0
  18:   e8 00 00 00 00          call   1d <_t+0x1d>
  1d:   83 c4 10                add    $0x10,%esp
  20:   c9                      leave
  21:   c3                      ret

00000022 <_u>:
  22:   55                      push   %ebp
  23:   89 e5                   mov    %esp,%ebp
  25:   83 ec 08                sub    $0x8,%esp
  28:   c7 45 fc 00 00 00 00    movl   $0x0,0xfffffffc(%ebp)
  2f:   83 ec 08                sub    $0x8,%esp
  32:   ff 75 fc                pushl  0xfffffffc(%ebp)
  35:   68 00 00 00 00          push   $0x0
  3a:   e8 00 00 00 00          call   3f <_u+0x1d>
  3f:   83 c4 10                add    $0x10,%esp
  42:   c9                      leave
  43:   c3                      ret

00000044 <_main>:
  44:   55                      push   %ebp
  45:   89 e5                   mov    %esp,%ebp
  47:   83 ec 08                sub    $0x8,%esp
  4a:   83 e4 f0                and    $0xfffffff0,%esp
  4d:   b8 00 00 00 00          mov    $0x0,%eax
  52:   89 45 fc                mov    %eax,0xfffffffc(%ebp)
  55:   8b 45 fc                mov    0xfffffffc(%ebp),%eax
  58:   e8 00 00 00 00          call   5d <_main+0x19>
  5d:   e8 00 00 00 00          call   62 <_main+0x1e>
  62:   e8 00 00 00 00          call   67 <_main+0x23>
  67:   b8 00 00 00 00          mov    $0x0,%eax
  6c:   c9                      leave
  6d:   c3                      ret
  6e:   90                      nop
  6f:   90                      nop

-- 
regards,
Roopesh Kohad


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