david@TERA.COM (David Callahan) (12/21/89)
When the result an inline function is an argument to an out-of-line function, the line number information passed to gdb indicates that out-of-line call occurs at the definition point of the inline function. Example, both g++ and gdb configured for sun3-nfp-os4: ---------------- bug.c ------------ struct foo { int i ; int val() { return i ; } } ; extern "C" void bar(int) ; main() { foo f ; bar(f.val()) ; } void bar(int i) { } ------------- sample compilation --------- dactyl% g++ -v -o bug -g bug.c gcc version 1.36.1 (based on GCC 1.36) /usr/local/lib/g++-1.36.1/gcc-cpp -+ -v -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -Dmc68020 bug.c /usr/tmp/cca12599.cpp GNU CPP version 1.36 /usr/local/lib/g++-1.36.1/gcc-cc1plus /usr/tmp/cca12599.cpp -quiet -dumpbase bug.c -g -version -o /usr/tmp/cca12599.s GNU C++ version 1.36.1 (based on GCC 1.36) (68k, MIT syntax) compiled by GNU C version 1.36. default target switches: -m68020 -mc68020 -mbitfield /usr/local/lib/g++-1.36.1/gcc-as -mc68020 -o bug.o /usr/tmp/cca12599.s /usr/local/lib/g++-1.36.1/gcc-ld -o bug -e start -dc -dp -Bstatic /lib/crt0.o /lib/Fcrt1.o bug.o -lg++ /usr/local/lib/g++-1.36.1/gcc-gnulib -lg -lc -------- sample debugging session ------------ dactyl% gdb bug GDB 3.4, Copyright (C) 1989 Free Software Foundation, Inc. There is ABSOLUTELY NO WARRANTY for GDB; type "info warranty" for details. GDB is free software and you are welcome to distribute copies of it under certain conditions; type "info copying" to see the conditions. Reading symbol data from /home/tera/david/Doc/Web2/bug...done. Type "help" for a list of commands. (gdb) break bar Reading in symbols for bug.c...done. Breakpoint 1 at 0x22ca: file bug.c, line 15. (gdb) run Starting program: /home/tera/david/Doc/Web2/bug Bpt 1, bar (i=0) (bug.c line 15) 15 } (gdb) where #0 bar (i=0) (bug.c line 15) #1 0x22ba in main () (bug.c line 3) (gdb) quit The program is running. Quit anyway? (y or n) y dactyl% --------------------------- Note that in response to "where", gdb reports the call to "bar" to be at line 4 rather than 10. David Callahan david@tera.com Tera Computer Co. 400 North 34th Street, Suite 300 Seattle WA, 98103