From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15995 invoked by alias); 1 Mar 2005 09:14:44 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 15755 invoked from network); 1 Mar 2005 09:14:33 -0000 Received: from unknown (HELO wproxy.gmail.com) (64.233.184.201) by sourceware.org with SMTP; 1 Mar 2005 09:14:33 -0000 Received: by wproxy.gmail.com with SMTP id 69so1016240wri for ; Tue, 01 Mar 2005 01:14:33 -0800 (PST) Received: by 10.54.43.11 with SMTP id q11mr107101wrq; Tue, 01 Mar 2005 01:14:32 -0800 (PST) Received: by 10.54.28.23 with HTTP; Tue, 1 Mar 2005 01:14:30 -0800 (PST) Message-ID: <1a223dc60503010114bbb95fd@mail.gmail.com> Date: Tue, 01 Mar 2005 09:14:00 -0000 From: Roopesh Kohad Reply-To: Roopesh Kohad To: gdb@sources.redhat.com Subject: function address from object file? Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2005-03/txt/msg00000.txt.bz2 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 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