🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #8772

gdb4.7 gets internal error looking for physical static variable

#8772
From: Robert R. Henry
Date: Fri, 04 Dec 1992 01:24
42 lines
1844 bytes
for gdb4.7, using .o files produced by host==target==sparc g++2.3.[12],
gdb4.7 generates an
  Internal error: could not find physical static variable named _5Thing$g

here's how:

If a file s1.c containing the definition of a class static member variable
Thing::g is compiled WITHOUT -g, and another file s2.c sees the declaration
of Thing::g (from a shared .h file) and s2.c is compiled WITH -g,
and a breakpoint is is placed in s2.c, and at the breakpoint one asks
for
  print Thing::g
then one gets the error message.
If s1.c is compiled with -g, then everything works as expected.

The files follow.

The problems stems from valops.c:1366; phys_name
has the (presumably) right value "_5Thing$g", but
lookup_symbol doesn't know about that in VAR_NAMESPACE,
and so the error is raised.  I don't know enough
about the architecture of gdb4.7 to suggest a fix.

---------Makefile---------
run: s
	gdb s
s: s1.o s2.o
	g++ -o s s1.o s2.o
s1.o: s1.c s.h Makefile
	g++ -c $< -o $@
s2.o: s2.c s.h
	g++ -c -g $< -o $@
---------s.h---------
class Thing{ public: static int g; };
---------s1.c---------
#include "s.h"
int Thing::g;
extern void foo(void);
main() { Thing::g = 0; foo(); }
---------s2.c---------
#include "s.h"
void foo(void) { }
Technical Details
Message-ID: <9212040124.AA15471@tera.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!tera.com!rrh

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5053,19d3c2fd9cf0e9a3,start
X-Google-Attributes: gidf5053,public
X-Google-ArrivalTime: 1992-12-03 21:31:35 PST
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!tera.com!rrh
From: rrh@tera.com (Robert R. Henry)
Subject: gdb4.7 gets internal error looking for physical static variable
Message-ID: <9212040124.AA15471@tera.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 4 Dec 1992 01:24:50 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 43