l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
August 5: Social gathering
Next Installfest:
TBD
Latest News:
Jul. 4: July, August and September: Security, Photography and Programming for Kids
Page last updated:
2001 Dec 30 17:08

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] change in behavior of gdb?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] change in behavior of gdb?



i think gdb has been changed majorly.  consider:

	#include <stdio.h>
	static void display(int y);

	int main(void) {
		int x=5;
		display(x);
		return 0;
	}

	void display(int z) {
		printf("z is %d.\n", z);
	}

look at this:

	gdb> b 5
	Breakpoint 1 at 0x80483f6: file try1.c, line 5.
	gdb> r
	Starting program: /www/p/linux/gdb/try1 

	Breakpoint 1, main () at try1.c:5
	5          int x=5;
	gdb> bt
	#0  main () at try1.c:5
	#1  0x4003e46b in __libc_start_main () from /lib/libc.so.6

well, first of all, i don't recognize frame 1.  i figure maybe it's some kind
of wrapper function?  anyway, that's not what i wanted to show.   this is:

i'm going to set a breakpoint at the printf:

	gdb> b 11
	Breakpoint 2 at 0x804841a: file try1.c, line 11.
	gdb> c
	Continuing.

	Breakpoint 2, display (z=5) at try1.c:11
	11         printf("z is %d.\n", z);

normally, when you step into a printf, you start getting listings of glibc
stuff.  calls that printf makes to the v*printf functions and __* type
functions.   but look at this:

	gdb> step
	z is 5.
		12      }
	gdb> step
	main () at try1.c:7
	7          return 0;

we passed over printf just as if we next'ed over printf instead of stepping
into it.

it's been awhile since i've used gdb, but if we don't have to worry about
stepping into wierd glibc functions, that is one really cool improvement!

pete

-- 
"The following addresses had permanent fatal errors..."      p@dirac.org
                               -- Mailer Daemon              www.dirac.org/p


LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!