From: Roopesh Kohad <roopesh.kohad@gmail.com>
To: gdb@sources.redhat.com
Subject: function address from object file?
Date: Tue, 01 Mar 2005 09:14:00 -0000 [thread overview]
Message-ID: <1a223dc60503010114bbb95fd@mail.gmail.com> (raw)
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
next reply other threads:[~2005-03-01 9:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-01 9:14 Roopesh Kohad [this message]
2005-03-01 10:21 ` Ramana Radhakrishnan
2005-03-01 14:26 ` Daniel Jacobowitz
2005-03-01 11:20 Atul Talesara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1a223dc60503010114bbb95fd@mail.gmail.com \
--to=roopesh.kohad@gmail.com \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox