From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jim Blandy To: laurent.duperval@cgi.ca Cc: Insight Mailing List Subject: Re: It will be great if Insight will remember BP too Date: Wed, 29 Mar 2000 11:36:00 -0000 Message-id: References: <200003281325.IAA02374@qc.bell.ca> X-SW-Source: 2000-q1/msg00192.html > Well, you can currently save the breakpoints, doesn't that help any? Of > course you have to restore your breakpoints but... I have another idea: one > of the things that annoys me most when debugging Tcl-based apps (i'm doing a > lot of this, have you noticed?) is the use of shared libs. If I set a > breakpoint when I run a program, that breakpoint disappears and cannot be > reset when the app is restarted, because gdb doesn't know where to find the > symbol (since it's not loaded yet). Is it possible to set a breakpoint in a > function and have gdb notice when that function is loaded up? In other > words, set some unexisting breakpoints that *will* exist at some time during > program execution, wwithout having to interrupt the process that is being > debugged. It's one of the features of a Tcl script debugger I'm using and I > find it very handy. But then, Tcl is a whole 'nother beast. GDB is supposed to notice breakpoints set in shared libraries, and re-install them when the shared library is loaded a second time. It does this for me; see below. Have you posted a bug report about this? If so, I apologize for not having answered it. If not, could you please post one, so I can track this down? $ cat hello.c #include main () { puts ("Hello, world!"); } $ gcc -g hello.c -o hello $ $CB/gdb -nw hello GDBtk--A GUI just like ones your mother used to bake. To disable command-line taunts, run gdb with "-w". GNU gdb 4.18.1 Copyright 1998 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or 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. This GDB was configured as "i686-pc-linux-gnu"... (gdb) break puts Breakpoint 1 at 0x80482e8 (gdb) run Starting program: /home/jimb/play/hello Breakpoint 1 at 0x400693d5: file ioputs.c, line 32. Breakpoint 1, 0x400693d5 in _IO_puts (str=0x8048430 "Hello, world!") at ioputs.c:32 32 ioputs.c: No such file or directory. (gdb) info shared >From To Syms Read Shared Object Library 0x40017000 0x401098dc Yes /lib/libc.so.6 0x40000000 0x400126b0 Yes /lib/ld-linux.so.2 (gdb) i br Num Type Disp Enb Address What 1 breakpoint keep y 0x400693d5 in _IO_puts at ioputs.c:32 breakpoint already hit 1 time (gdb) c Continuing. Hello, world! Program exited with code 016. (gdb) run Starting program: /home/jimb/play/hello Breakpoint 1, 0x400693d5 in _IO_puts (str=0x8048430 "Hello, world!") at ioputs.c:32 32 ioputs.c: No such file or directory. (gdb) quit The program is running. Exit anyway? (y or n) y $