struct dive_table dive_table

Amit Chaudhuri amit.k.chaudhuri at gmail.com
Wed Apr 17 11:57:23 PDT 2013


Linus,

Interesting that you don't get the same.......from the mainwindow.cpp file
(in the constructor) in the Qt branch:

gdb) p dive_table
Attempt to use a type name as an expression
(gdb) p *&dive_table
A syntax error in expression, near `'.
(gdb)

amit at linux-erag:~/subsurface> gdb --version
GNU gdb (GDB) SUSE (7.5.1-2.5.1)

uname -a
Linux linux-erag 3.4.33-2.24-desktop #1 SMP PREEMPT Tue Feb 26 03:34:33 UTC
2013 (5f00a32) x86_64 x86_64 x86_64 GNU/Linux

Lubomir - I tried your idea too:

(gdb) watch dive_table
Cannot watch constant value `dive_table'.

A


On Wed, Apr 17, 2013 at 6:14 PM, Linus Torvalds <
torvalds at linux-foundation.org> wrote:

> On Wed, Apr 17, 2013 at 9:30 AM, Amit Chaudhuri
> <amit.k.chaudhuri at gmail.com> wrote:
> > At parse-xml.c : 31 there is this: struct dive_table dive_table
> >
> > I've written a very nasty piece of code which I need to debug.  So I'm
> > trying to use gdb to examine dive_table.  But using 'p dive_table'
> generates
> > an error: "Attempt to use a type name as an expression".
>
> Wow. That's a really fundamental bug.
>
> Not in subsurface, though. It's very much a gdb bug, and it's a
> seriously screwed up one. It implies that gdb doesn't know the first
> thing about the C namespace rules. The struct/union/enum namespace is
> totally separate from the identifier one.
>
> We use that C namespace differentiation all over the place ("struct
> dive *dive" is a very common thing), and I've never seen gdb confused
> about that. But maybe the gdb bug only happens for identifiers in
> global scope, and that gdb only knows about name *scope*, but not
> about name *spaces*.
>
> I absolutely refuse to fix things like "struct dive *dive", so if you
> can find out more details about exactly what triggers the gdb bug, and
> can show that it's somehow *only* related to the dive_table thing
> (because of some global scope issue or whatever), then I guess we
> could work around that one particular case.
>
> However, I can't reproduce this bug to begin with. For me, "p
> dive_table" just does the right thing (current gdb from
> f18:7.5.1-37.fc18). What gdb version are you on?
>
> Does something like "p *&dive_table" work around it for you?
>
>                     Linus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130417/c61c6738/attachment.html>


More information about the subsurface mailing list