Bug 28374

Summary: Re: gdb output is wrong (same as #13427 ?)
Product: Base System Reporter: Giorgos Keramidas <keramida>
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: FreeBSD-gnats-submit
Priority: Normal    
Version: 1.0-RELEASE   
Hardware: Any   
OS: Any   

Description Giorgos Keramidas 2001-06-23 20:50:04 UTC
 On Sun, Jan 07, 2001 at 12:35:10PM -0800, jms@geriatrix.circlesquared.com wrote:
 
 > >How-To-Repeat:
 > cc -g then gdb the following
 
     void do_chunk (char *p, unsigned long sequence, unsigned long length,
  		   unsigned sadd, unsigned short sport, unsigned dadd,
  		   unsigned short dport)
     {
     }
     
     int main (void)
     {
  	    do_chunk("ha ha", 1, 2, 3, 4, 5, 6);
     }  
 
 I tested this on a -CURRENT system (compiled from sources of Tue Jun 19)
 which is running gdb 4.18, and it seems to have the same problem.
 
 An interesting thing is that if I compile with `gcc -O -ggdb' the problem
 seems to go away:
 
     % gcc -O -ggdb lala.c
 
     % gdb a.out
 
     GNU gdb 4.18
     Copyright 1998 Free Software Foundation, Inc.
     GDB is free software, covered by the GNU General Public License, and you are
     welcome to change it and/or distribute copies of it under certain conditions.
     Type "show copying" to see the conditions.
     There is absolutely no warranty for GDB.  Type "show warranty" for details.
     This GDB was configured as "i386-unknown-freebsd"...
     (gdb) b main
     Breakpoint 1 at 0x804849a: file lala.c, line 10.
     (gdb) r
     Starting program: /home/charon/freebsd/a.out 
     
     Breakpoint 1, main () at lala.c:10
     10              do_chunk("ha ha", 1, 2, 3, 4, 5, 6);
     (gdb) s
     do_chunk (p=0x80484ef "ha ha", sequence=1, length=2, sadd=3, sport=4, dadd=5,
     dport=6) at lala.c:6
     6       }
     (gdb) quit
     The program is running.  Exit anyway? (y or n) y
 
 It must be something with the code that GCC generates when -O is not used,
 that messes up the idea gdb has about the stack :/
 
 -giorgos
Comment 1 greid freebsd_committer freebsd_triage 2001-07-02 19:30:50 UTC
Responsible Changed
From-To: gnats-admin->freebsd-bugs

Misfiled; should be part of the audit trail of 24132
Comment 2 Sheldon Hearn freebsd_committer freebsd_triage 2002-01-30 13:08:25 UTC
State Changed
From-To: open->closed

Referenced from misc/24132, which has been assigned to the maintainer.