🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #8850

filename: :variable

#8850
From: Pierre Willard
Date: Sat, 19 Sep 1992 02:23
59 lines
2368 bytes
It seems that (in gdb-4.5) we cannot print variables with the
following syntax :

	filename::variable

The gdb-4.5 documentation says :

>    There is an exception: you can refer to a variable or function whose
> scope is a single source file even if the current execution point is
> not in this file.  But it is possible to have more than one such
> variable or function with the same name (in different source files). 
> If that happens, referring to that name has unpredictable effects.  If
> you wish, you can specify a static variable in a particular function
> or file, using the colon-colon notation:
> 
>      FILE::VARIABLE
>      FUNCTION::VARIABLE
> 
> Here FILE or FUNCTION is the name of the context for the static
> VARIABLE.

FUNCTION::VARIABLE works, but not FILE::VARIABLE. Do you know if this
is aleady fixed in gdb-4.6 ? If not, Do you have a fix ? I am willing
to work on that...

Let me know your comments.
Regards
Pierre Willard (pierre@la.tce.com)

PS: The following shows the problem :

psi:/usr2/pierre:cat pw.c

static int foo = 5;

main()
{

}
psi:/usr2/pierre:gcc -g -o pw pw.c
psi:/usr2/pierre:gdb pw
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) b main
Breakpoint 1 at 0x229c: file pw.c, line 7.
(gdb) run
Starting program: /usr2/pierre/pw 

Breakpoint 1, main () at pw.c:7
7	}
(gdb) p pw.c::foo
No symbol "pw" in current context.
(gdb) p main::foo
$1 = 5
(gdb) quit
The program is running.  Quit anyway? (y or n) y
psi:/usr2/pierre:
Technical Details
Message-ID: <9209190223.AA26395@_la.tce.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!la.tce.COM!pierre

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5053,41bb9358d67d1bd5,start
X-Google-Attributes: gidf5053,public
X-Google-ArrivalTime: 1992-09-19 13:31:40 PST
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!la.tce.COM!pierre
From: pierre@la.tce.COM (Pierre Willard)
Subject: filename: :variable
Message-ID: <9209190223.AA26395@_la.tce.com>
Sender: gnulists@ai.mit.edu
Reply-To: pierre@la.tce.com
Organization: GNUs Not Usenet
Distribution: gnu
Date: Sat, 19 Sep 1992 02:23:00 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 61