🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #362

(none)

#362
From: Peggy Fieland
Date: Wed, 12 Aug 1992 18:33
147 lines
6296 bytes
I have been having difficulties with the symbol-file command.
Under certain circumstances, when using the symbol-file command,
gdb is unable to reset a breakpoint, or resets it in the wrong place.

I have experienced variations of this problem with gdb-4.6 on a
Sun Sparc and on Stratus's i860 gdb.  Unfortunately, this is
one of those frustrating bugs where the attempt to debug it
affects the behaviour (leading me to believe that the underlying
problem is uninitialized data, or pointer into freed/re-used
storage...).

Note that I DIDN'T have this problem with any of the earlier versions
of gdb that I tried this on.

Here is the test program I used:
/* test miscellaneous commands */

#include <stdio.h> 
main() { 
int i1, i2, i3; 

 i1 = 0;
 i2 = 1;
 i3 = 2;

 printf("ints: %d, %d, %d\n", i1, i2, i3);
}

Here is what happened on a Sun Sparc:
cyclonic-~% gdb46 misc
GDB is free software and you are welcome to 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.
GDB 4.6, Copyright 1992 Free Software Foundation, Inc...
(gdb) break 7
Breakpoint 1 at 0x229c: file misc.c, line 7.
(gdb) run
Starting program: /tmp_mnt/net/citron/home/citron/pfieland/misc

Breakpoint 1, main () at misc.c:7
7        i1 = 0;
(gdb) exec-file misc
A program is being debugged already.  Kill it? (y or n) y
(gdb) symbol-file
Discard symbol table from `/tmp_mnt/net/citron/home/citron/pfieland/misc'? (y or n) y
No symbol file now.
(gdb) symbol-file misc
Reading symbols from misc...Error in re-setting breakpoint 1:
No line 7 in file "(null)".
done.
(gdb)

As the following debugging session indicates, the information pointed to by
the breakpoint structure b.symtab has been set to zero (in the Sparc case)
or to new data (in the Stratus i860 case) (sorry, I  couldn't capture the
Stratus case -- later attempts to debug gdb either caused the problem to
disappear or the network to kick me off the machine :-(.)

(Sun Sparc)

cyclonic-~% gdb gdb46
GDB is free software and you are welcome to 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.
GDB 4.5, Copyright 1992 Free Software Foundation, Inc...
(gdb) directory /net/citron/home/tools/gdb-4.6/gdb
/net/citron/home/tools/gdb-4.6/gdb: No such file or directory.
(gdb) set prompt TOP>
TOP> break breakpoint_re_set_one
Breakpoint 1 at 0xb5d8: file ../../../gdb-4.6/gdb/breakpoint.c, line 2182.
TOP> r misc
Starting program: /home/tools/bin/gdb46 misc
GDB is free software and you are welcome to 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.
GDB 4.6, Copyright 1992 Free Software Foundation, Inc...
(gdb) b 7
Breakpoint 1 at 0x229c: file misc.c, line 7.
(gdb) r
Starting program: /tmp_mnt/net/citron/home/citron/pfieland/misc

Breakpoint 1, breakpoint_re_set_one (bint=0x153908 "") at ../../../gdb-4.6/gdb/breakpoint.c:2182
../../../gdb-4.6/gdb/breakpoint.c:2182: No such file or directory.
TOP> c
Continuing.

Breakpoint 1, breakpoint_re_set_one (bint=0x153888 "") at ../../../gdb-4.6/gdb/breakpoint.c:2182
../../../gdb-4.6/gdb/breakpoint.c:2182: No such file or directory.
TOP> directory /net/citron/home/tools/gnu/gdb-4.6/gdb
Source directories searched: /net/citron/home/tools/gnu/gdb-4.6/gdb:$cdir:$cwd
TOP> c
Continuing.

Breakpoint 1, main () at misc.c:7
7        i1 = 0;
(gdb) exec-file misc
A program is being debugged already.  Kill it? (y or n) y
(gdb) symbol-file
Discard symbol table from `/tmp_mnt/net/citron/home/citron/pfieland/misc'? (y or n) y
No symbol file now.
(gdb) symbol-file misc
Reading symbols from misc...
Breakpoint 1, breakpoint_re_set_one (bint=0x153888 "") at ../../../gdb-4.6/gdb/breakpoint.c:2182
2182      struct breakpoint *b = (struct breakpoint *)bint;  /* get past catch_errs */
TOP> n
2188      switch (b->type)
TOP> p *b
$1 = {next = 0x153808, type = bp_breakpoint, enable = enabled, disposition = donttouch, number = 1,
  address = 8860, line_number = 7, symtab = 0x15c4b8, silent = 0 '\000', ignore_count = 0,
  shadow_contents = {"\37777777700'\37777777677\37777777774\000\000\000\000\000\000"}, inserted = 0 '\000',
  duplicate = 0 '\000', commands = 0x0, frame = 0, cond = 0x0, addr_string = 0x144fc8 "7",
  cond_string = 0x0, exp = 0x0, exp_valid_block = 0x0, val = 0x0}
TOP> p *b.symtab
$2 = {next = 0x0, blockvector = 0x0, linetable = 0x0, filename = 0x0, dirname = 0x0,
  free_code = free_nothing, free_ptr = 0x0, nlines = 0, line_charpos = 0x0, language = language_unknown,
  version = 0x0, fullname = 0x0, objfile = 0x0}
TOP> c
Continuing.
Error in re-setting breakpoint 1:
No line 7 in file "(null)".

Here is what happens on Stratus i860:
 
maestro-testsrc% ~/gdb46 misc
GDB is free software and you are welcome to 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.
GDB 4.6, Copyright 1992 Free Software Foundation, Inc...
Setting up the environment for debugging gdb.
(gdb) b 7
Breakpoint 1 at 0x1464: file ../source/misc.c, line 7.
(gdb) r
Starting program: /home3/Languages/regression/gdb/other/testsrc/misc

Breakpoint 1, main () at ../source/misc.c:7
7        i1 = 0;
(gdb) exec-file misc
A program is being debugged already.  Kill it? (y or n) y
(gdb) symbol-file
Discard symbol table from `/home3/Languages/regression/gdb/other/testsrc/misc'? (y or n) y
No symbol file now.
(gdb) symbol-file misc
Reading symbols from misc...Breakpoint 1 at 0x135a10: file _edata, line 7.
done.
(gdb)

Peggy
Technical Details
Message-ID: <9208121833.AA15565@citron.sw.stratus.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!citron.sw.stratus.com!pfieland

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!citron.sw.stratus.com!pfieland
From: pfieland@citron.sw.stratus.com (Peggy Fieland)
Subject: (none)
Message-ID: <9208121833.AA15565@citron.sw.stratus.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 12 Aug 1992 18:33:39 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 148