🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #120

Problems with gcc/gdb

#120
From: Marty Leisner 311/? x?
Date: Fri, 24 Jul 1992 16:44
65 lines
1731 bytes
I haven't analyzed this case but:
	gcc is producing working code
	gdb appears not to be working correctly

I'm using gdb 4.5 (compiled with gcc 2.1.x) and gcc 2.2.2 on a Sparcstation running SunOS 4.1.2.

Here's a test program:


typedef struct {
	int i;
	int j;
} FOO;

static bar(const FOO me)
{
	printf("i = %d, j = %d\n", me.i, me.j);
}

static FOO getfoo(void)
{
	FOO test;

	test.i = 5;
	test.j = 10;
	return test;
}

main()
{
	FOO re;

	re = getfoo();
	bar(re);
}



It works fine

leisner@trianguli$ ./test
i = 5, j = 10

In gdb,
leisner@trianguli$ gdb test
GDB is free software and you are welcome to 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.
GDB 4.5, Copyright 1992 Free Software Foundation, Inc...
(gdb) break bar
Breakpoint 1 at 0x22a8: file test.c, line 9.
(gdb) run
Starting program: /a/rockwell/dk2g/leisner/tmp/test 

Breakpoint 1, bar (me={i = 289407105, j = 8292}) at test.c:9
9               printf("i = %d, j = %d\n", me.i, me.j);


gdb is seeing me as garbarge, but the compiler is working...


--
marty
leisner.henr801c@xerox.com  
Member of the League for Programming Freedom
Technical Details
Message-ID: <1992Jul24.164435.6510@spectrum.xerox.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!trianguli.wrc.xerox.COM!leisner

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!trianguli.wrc.xerox.COM!leisner
From: leisner@trianguli.wrc.xerox.COM (Marty Leisner 311/? x?)
Subject: Problems with gcc/gdb
Message-ID: <1992Jul24.164435.6510@spectrum.xerox.com>
Sender: gnulists@ai.mit.edu
Reply-To: leisner.henr801c@xerox.com
Organization: Xerox
Distribution: gnu
Date: Fri, 24 Jul 1992 16:44:35 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 66