From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16330 invoked by alias); 21 Jul 2005 20:06:48 -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 15750 invoked by uid 22791); 21 Jul 2005 20:06:36 -0000 Received: from e35.co.us.ibm.com (HELO e35.co.us.ibm.com) (32.97.110.133) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Thu, 21 Jul 2005 20:06:36 +0000 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e35.co.us.ibm.com (8.12.10/8.12.9) with ESMTP id j6LK6WSa412514 for ; Thu, 21 Jul 2005 16:06:32 -0400 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay04.boulder.ibm.com (8.12.10/NCO/VERS6.7) with ESMTP id j6LK6WAH232288 for ; Thu, 21 Jul 2005 14:06:32 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.12.11/8.13.3) with ESMTP id j6LK6Vwj031209 for ; Thu, 21 Jul 2005 14:06:31 -0600 Received: from austin.ibm.com (netmail2.austin.ibm.com [9.41.248.176]) by d03av02.boulder.ibm.com (8.12.11/8.12.11) with ESMTP id j6LK6VQs031189 for ; Thu, 21 Jul 2005 14:06:31 -0600 Received: from lazy.austin.ibm.com (lazy.austin.ibm.com [9.53.94.97]) by austin.ibm.com (8.12.10/8.12.10) with ESMTP id j6LK6Tkg063654 for ; Thu, 21 Jul 2005 15:06:29 -0500 Date: Thu, 21 Jul 2005 20:06:00 -0000 From: Manoj Iyer X-X-Sender: manjo@lazy To: gdb@sources.redhat.com Subject: gdb unable to print fn argument correctly Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2005-07/txt/msg00217.txt.bz2 I have an test program which has a function of the nature 'void fn(double c){}', which is compiled as a PwerPC 64bit application. When I set a breakpoint and stop on this function, GDB is not printing the arguments passed to this function correctly. I did some initial debugging, the dwarf information and dissassembly of the function looks good to me. But I am not able to pin point who is corrupting the stack. I believe gdb is just printing what is avaiable in the stack to output. Any pointers to help me identify the culprit deeply appreciated. ============= test.c ======================== #include void fn1(int a) {} void fn2(long b){} void fn3(double c){} int main() { fn1(1234); fn2(123456789L); fn3(1234.4567); return 0; } ============= end test.c ====================== ============= GDB output ====================== (gdb) br main Breakpoint 1 at 0x10000574: file /tmp/test1.c, line 10. (gdb) br fn3 Breakpoint 2 at 0x10000544: file /tmp/test1.c, line 5. (gdb) r Starting program: /tmp/test.gdb Breakpoint 1, main () at /tmp/test1.c:10 10 fn1(1234); (gdb) c Continuing. Breakpoint 2, 0x0000000010000544 in fn3 (c=6.0995758190771502e-316) at /tmp/test1.c:5 5 void fn3(double c){} (gdb) ================= end gdb output ========================== When I change this testcase, change function fn3 to have something meaningful in the body, gdb prints the arguments correctly. =================== modified test.c ====================== #include void fn1(int a) {} void fn2(long b){} void fn3(double c){printf("hello world %lf\n", c);} int main() { fn1(1234); fn2(123456789L); fn3(1234.4567); return 0; } ================= end of test.c ========================== ================= output from gdb ======================= (gdb) br main Breakpoint 1 at 0x100004c0: file test.c, line 9. (gdb) br fn3 Breakpoint 2 at 0x10000488: file test.c, line 5. (gdb) r Starting program: /tmp/test Breakpoint 1, main () at test.c:9 warning: Source file is more recent than executable. 9 fn1(1234); (gdb) c Continuing. Breakpoint 2, fn3 (c=1234.4567) at test.c:5 5 void fn3(double c){printf("hello world %lf\n", c);} (gdb) ================== end of output from gdb =================== =================== DWARF info for fn3() =================== <1><2bf>: Abbrev Number: 4 (DW_TAG_subprogram) DW_AT_sibling : <2e3> DW_AT_external : 1 DW_AT_name : fn3 DW_AT_decl_file : 1 DW_AT_decl_line : 5 DW_AT_prototyped : 1 DW_AT_low_pc : 0x10000448 268436552 DW_AT_high_pc : 0x10000468 268436584 DW_AT_frame_base : 1 byte block: 6f (DW_OP_reg31) <2><2d6>: Abbrev Number: 5 (DW_TAG_formal_parameter) DW_AT_name : c DW_AT_decl_file : 1 DW_AT_decl_line : 5 DW_AT_type : <2e3> DW_AT_location : 2 byte block: 91 8 (DW_OP_fbreg: 8) <1><2e3>: Abbrev Number: 3 (DW_TAG_base_type) DW_AT_name : double DW_AT_byte_size : 8 DW_AT_encoding : 4 (float) ================================================================= ==== Disassembly of void fn3(double c){} ======================= fn3() [5] 10000448: 94 21 ff e0 stwu r1, -32(r1) 1000044c: 93 e1 00 1c stw r31, 28(r1) 10000450: 7c 3f 0b 78 mr r31, r1 10000454: d8 3f 00 08 stfd fr1, 8(r31) 10000458: 81 61 00 00 lwz r11, 0(r1) 1000045c: 83 eb ff fc lwz r31, -4(r11) 10000460: 7d 61 5b 78 mr r1, r11 10000464: 4e 80 00 20 blr ================================================================== Thanks ----- manjo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + Cogito ergo sum + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++