This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: DWARF question
- From: Jim Blandy <jimb at codesourcery dot com>
- To: Carlos Eduardo Seo <cseo at linux dot vnet dot ibm dot com>
- Cc: gdb at sourceware dot org, drow at false dot org
- Date: Tue, 02 Oct 2007 13:08:53 -0700
- Subject: Re: DWARF question
- References: <46FAC9D7.9080001@linux.vnet.ibm.com> <20070926212539.GA17502@caradoc.them.org> <46FAD46B.9000006@br.ibm.com> <46FD5A9B.2070004@linux.vnet.ibm.com> <m3r6ki5xwm.fsf@codesourcery.com> <46FD7AE9.8030208@linux.vnet.ibm.com> <m34pheqt6u.fsf@codesourcery.com> <4701333C.9040705@linux.vnet.ibm.com>
This one's fun, and demonstrates the 'exact_match' lossage I was
concerned about before. Take a look at where two successive 'break 9'
commands set the breakpoints. (Having three CUs didn't turn out to be
important; you could get the same effect without 'bar'.)
$ cat 1s3c.mk
CFLAGS = -g
CC = gcc
all: 1s3c
1s3c: 1s3cFOO.o 1s3cMAIN.o 1s3cBAR.o
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@
1s3c%.o: 1s3c.c
$(CC) $(CFLAGS) $(CPPFLAGS) -D$* -c $< -o $@
clean:
rm -f 1s3c 1s3c*.o
$ cat 1s3c.c
#include <stdio.h>
extern void foo (void);
#ifdef FOO
void
foo (void)
{
puts ("foo");
}
#endif
#ifdef MAIN
int
main (int argc, char **argv)
{
puts ("main");
foo ();
puts ("main again");
bar ();
puts ("main yet again");
return 0;
}
#endif
#ifdef BAR
void
bar (void)
{
puts ("foo");
}
#endif
$ ~/gdb/pub/nat/gdb/gdb 1s3c
GNU gdb 6.7.50-20070924-cvs
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) break 9
Breakpoint 1 at 0x8048398: file 1s3c.c, line 9.
(gdb) break 9
Breakpoint 2 at 0x804838a: file 1s3c.c, line 9.
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y 0x08048398 in main at 1s3c.c:9
2 breakpoint keep y 0x0804838a in foo at 1s3c.c:9
(gdb)