This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: DWARF question


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) 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]