public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* cannot subscript something of type <data variable, no debug info>
@ 2004-08-21  1:23 Daniel Miller (IMI)
  2004-08-21  2:11 ` Daniel Jacobowitz
  0 siblings, 1 reply; 20+ messages in thread
From: Daniel Miller (IMI) @ 2004-08-21  1:23 UTC (permalink / raw)
  To: gdb

I'm trying to debug an application with gdb... I have a struct that is
declared thus:

typedef struct S_Module_s
{
  unsigned powered_up;
       ...  other data elements  ...
} __attribute__ ((__packed__)) S_Module;

extern S_Module Mod[1];

I tried compiling both with -g and -ggdb, with no change in the symptoms.

I don't seem to be able to display any of the contents of Mod[0], at all....
I get effects such as:

(gdb) p Mod[0]
cannot subscript something of type `<data variable, no debug info>'
(gdb) p (S_Module) Mod[0]
No symbol "S_Module" in current context.
(gdb) p (struct S_Module_s) Mod[0]
No struct type named S_Module_s.

What do I have to do to get gdb to recognize my variables??  Virtually every
GUI-based debugger out there is a wrapper around gdb, to if it's not happy,
nobody's happy!!!  Please help!!

    Dan Miller

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: cannot subscript something of type <data variable, no debug info>
  2004-08-21  1:23 cannot subscript something of type <data variable, no debug info> Daniel Miller (IMI)
@ 2004-08-21  2:11 ` Daniel Jacobowitz
  2004-08-23 20:49   ` Daniel Miller (IMI)
  0 siblings, 1 reply; 20+ messages in thread
From: Daniel Jacobowitz @ 2004-08-21  2:11 UTC (permalink / raw)
  To: Daniel Miller (IMI); +Cc: gdb

On Fri, Aug 20, 2004 at 06:23:03PM -0700, Daniel Miller (IMI) wrote:
> I'm trying to debug an application with gdb... I have a struct that is
> declared thus:
> 
> typedef struct S_Module_s
> {
>   unsigned powered_up;
>        ...  other data elements  ...
> } __attribute__ ((__packed__)) S_Module;
> 
> extern S_Module Mod[1];
> 
> I tried compiling both with -g and -ggdb, with no change in the symptoms.

What platform?  What version of GDB?

> I don't seem to be able to display any of the contents of Mod[0], at all....
> I get effects such as:
> 
> (gdb) p Mod[0]
> cannot subscript something of type `<data variable, no debug info>'
> (gdb) p (S_Module) Mod[0]
> No symbol "S_Module" in current context.
> (gdb) p (struct S_Module_s) Mod[0]
> No struct type named S_Module_s.
> 
> What do I have to do to get gdb to recognize my variables??  Virtually every
> GUI-based debugger out there is a wrapper around gdb, to if it's not happy,
> nobody's happy!!!  Please help!!

We'll need a standalone test case, or at least a dump of the debugging
information in the application, to answer this question.

-- 
Daniel Jacobowitz

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: cannot subscript something of type <data variable, no debug info>
  2004-08-21  2:11 ` Daniel Jacobowitz
@ 2004-08-23 20:49   ` Daniel Miller (IMI)
  2004-08-23 21:15     ` Michael Chastain
  2004-08-23 21:28     ` Michael Chastain
  0 siblings, 2 replies; 20+ messages in thread
From: Daniel Miller (IMI) @ 2004-08-23 20:49 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

My system is:
- linux 2.6.7 (running on i386, specifically P4 2.4GHz)
- g++ (GCC) 3.3.3 (SuSE Linux)
- GNU gdb 6.1

I compile the following code via

g++ -Wall -g tester.cpp -o tester

//  source file
#include <stdio.h>

#include "tester.h"

S_Module Mod[1] ;

int main(void)
{
   Mod[0].powered_up = 1 ;

   printf("powered_up=%u\n", Mod[0].powered_up) ;
   return 0;
}

//  header file tester.h
typedef struct S_Module_s
{
  unsigned Stat;     // module status
  unsigned sys_status ; //  system errno
  unsigned powered_up;
  unsigned compat ;
} S_Module;
// } __attribute__ ((__packed__)) S_Module;

extern S_Module Mod[1];
//*****************************************************

After compiling as previously described and loading tester into gdb, I see:

(gdb) p Mod[0]
cannot subscript something of type `<data variable, no debug info>'
(gdb) p (S_Module) Mod[0]
No symbol "S_Module" in current context.

//*****************************************************

Note that if I pull the header-file data into the source file, then print
can successfully access the struct.  When it's in a separate header, though,
it doesn't work.  Of course, my real project has 10 headers and 30-some
source files, so eliminating headers isn't practical.  Is there something
else I can do to make this work??  Or should I call this a bug report??

    Dan Miller


//*****************************************************
----- Original Message ----- 
From: "Daniel Jacobowitz" <drow@false.org>
To: "Daniel Miller (IMI)" <dan@imi-test.com>
Cc: <gdb@sources.redhat.com>
Sent: Friday, August 20, 2004 19:11
Subject: Re: cannot subscript something of type <data variable, no debug
info>


> On Fri, Aug 20, 2004 at 06:23:03PM -0700, Daniel Miller (IMI) wrote:
> > I'm trying to debug an application with gdb... I have a struct that is
> > declared thus:
> >
> > typedef struct S_Module_s
> > {
> >   unsigned powered_up;
> >        ...  other data elements  ...
> > } __attribute__ ((__packed__)) S_Module;
> >
> > extern S_Module Mod[1];
> >
> > I tried compiling both with -g and -ggdb, with no change in the
symptoms.
>
> What platform?  What version of GDB?
>
> > I don't seem to be able to display any of the contents of Mod[0], at
all....
> > I get effects such as:
> >
> > (gdb) p Mod[0]
> > cannot subscript something of type `<data variable, no debug info>'
> > (gdb) p (S_Module) Mod[0]
> > No symbol "S_Module" in current context.
> > (gdb) p (struct S_Module_s) Mod[0]
> > No struct type named S_Module_s.
> >
> > What do I have to do to get gdb to recognize my variables??  Virtually
every
> > GUI-based debugger out there is a wrapper around gdb, to if it's not
happy,
> > nobody's happy!!!  Please help!!
>
> We'll need a standalone test case, or at least a dump of the debugging
> information in the application, to answer this question.
>
> -- 
> Daniel Jacobowitz
>
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: cannot subscript something of type <data variable, no debug info>
  2004-08-23 20:49   ` Daniel Miller (IMI)
@ 2004-08-23 21:15     ` Michael Chastain
  2004-08-23 21:28     ` Michael Chastain
  1 sibling, 0 replies; 20+ messages in thread
From: Michael Chastain @ 2004-08-23 21:15 UTC (permalink / raw)
  To: drow, dan; +Cc: gdb

Hi Daniel,

You're issuing the right commands, and it looks like a bug,
but I can't reproduce it and I haven't seen this happen before.

I tried this with "tester.cpp" and "tester.h" on my system:

  native i686-pc-linux-gnu, red hat linux 8
  gcc 3.3.4 from ftp.gnu.org
  gdb 6.1 from ftp.gnu.org

Same command line:

  [mec.gnu@berman dm]$ g++-334 -Wall -g tester.cpp -o tester
  [mec.gnu@berman dm]$ gdb-61 tester

And gdb works fine:

  (gdb) print Mod[0]
  $1 = {Stat = 0, sys_status = 0, powered_up = 0, compat = 0}
  (gdb) print (S_Module) Mod[0]
  $2 = {Stat = 0, sys_status = 0, powered_up = 0, compat = 0}

It's something weird, and something that I haven't seen before.

Can you try this: download gcc 3.3.4 from ftp.gnu.org, build it
(the --prefix option is very helpful), install it, and try that.
Build tester.cpp with:

  g++ -v -Wall -g tester.cpp -o tester

If that still fails, mail me the "tester" executable file,
along with the output of that "g++ -v", and I'll have a look.

Michael Chastain
GDB QA Guy

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: cannot subscript something of type <data variable, no debug info>
  2004-08-23 20:49   ` Daniel Miller (IMI)
  2004-08-23 21:15     ` Michael Chastain
@ 2004-08-23 21:28     ` Michael Chastain
  2004-08-23 22:30       ` Daniel Miller (IMI)
  1 sibling, 1 reply; 20+ messages in thread
From: Michael Chastain @ 2004-08-23 21:28 UTC (permalink / raw)
  To: drow, dan; +Cc: gdb

Also, I tried a SuSE 9 system with the vendor-supplied gcc and gdb:

  Linux spe186 2.6.5-7.97-bigsmp #1 SMP Fri Jul 2 14:21:59 UTC 2004 i686 i686 i386 GNU/Linux
  gcc version 3.3.3 (SuSE Linux)
  GNU gdb 6.1
  This GDB was configured as "i586-suse-linux"

Your test program worked fine for me:

  [chastain@spe186 dm]$ gdb tester
  GNU gdb 6.1
  Copyright 2004 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 "i586-suse-linux"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

  (gdb) print Mod[0]
  $1 = {Stat = 0, sys_status = 0, powered_up = 0, compat = 0}
  (gdb) print (S_Module) Mod[0]
  $2 = {Stat = 0, sys_status = 0, powered_up = 0, compat = 0}

Also try this: right after you start gdb, do "break main"
and "run", to get to the main program.  Then print Mod[0] et cetera.
Does that help any?

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: cannot subscript something of type <data variable, no debug info>
  2004-08-23 21:28     ` Michael Chastain
@ 2004-08-23 22:30       ` Daniel Miller (IMI)
  2004-08-24  2:20         ` Michael Chastain
  2004-08-24 12:12         ` Michael Chastain
  0 siblings, 2 replies; 20+ messages in thread
From: Daniel Miller (IMI) @ 2004-08-23 22:30 UTC (permalink / raw)
  To: Michael Chastain, drow; +Cc: gdb

[-- Attachment #1: Type: text/plain, Size: 3052 bytes --]

hmmm... Okay, if you tried SuSE 9 (which is what I'm using, though I've
upgraded the kernel to 2.6.7), and you don't see the same problem, there's
probably no point in me trying to upgrade to 3.3.4, huh?

I tried your 'break main' suggestion, and here's what I get:

$ gdb tester
GNU gdb 6.1
Copyright 2004 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 "i586-suse-linux"...Using host libthread_db
library "/lib/tls/libthread_db.so.1".

(gdb) break main
Breakpoint 1 at 0x8048478: file tester.cpp, line 9.
(gdb) run
Starting program: /home/m7000/m7600/files/tester

Breakpoint 1, main () at tester.cpp:9
9          Mod[0].powered_up = 1 ;
(gdb) p Mod[0]
cannot subscript something of type `<data variable, no debug info>'
(gdb) p (S_Module) Mod[0]
No symbol "S_Module" in current context.
(gdb)

What's interesting is that I can trace past the assignment statement at line
9, and then past the printf statement, and it properly prints out the value
of the variable, but I *still* can't display it!!

Is it possible that upgrading the kernel affected anything??  That seems
unlikely, since building the kernel shouldn't change any of the compiler
libraries, I don't think??

I'm going to go ahead and send you my binary for tester; it's small enough
that there's no reason not to, I don't think.  I'll put it in bz2 format...

    Dan



----- Original Message ----- 
From: "Michael Chastain" <mec.gnu@mindspring.com>
To: <drow@false.org>; <dan@imi-test.com>
Cc: <gdb@sources.redhat.com>
Sent: Monday, August 23, 2004 14:28
Subject: Re: cannot subscript something of type <data variable, no debug
info>


> Also, I tried a SuSE 9 system with the vendor-supplied gcc and gdb:
>
>   Linux spe186 2.6.5-7.97-bigsmp #1 SMP Fri Jul 2 14:21:59 UTC 2004 i686
i686 i386 GNU/Linux
>   gcc version 3.3.3 (SuSE Linux)
>   GNU gdb 6.1
>   This GDB was configured as "i586-suse-linux"
>
> Your test program worked fine for me:
>
>   [chastain@spe186 dm]$ gdb tester
>   GNU gdb 6.1
>   Copyright 2004 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 "i586-suse-linux"...Using host libthread_db
library "/lib/tls/libthread_db.so.1".
>
>   (gdb) print Mod[0]
>   $1 = {Stat = 0, sys_status = 0, powered_up = 0, compat = 0}
>   (gdb) print (S_Module) Mod[0]
>   $2 = {Stat = 0, sys_status = 0, powered_up = 0, compat = 0}
>
> Also try this: right after you start gdb, do "break main"
> and "run", to get to the main program.  Then print Mod[0] et cetera.
> Does that help any?
>
>

[-- Attachment #2: tester.bz2 --]
[-- Type: application/octet-stream, Size: 4068 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: cannot subscript something of type <data variable, no debug info>
  2004-08-23 22:30       ` Daniel Miller (IMI)
@ 2004-08-24  2:20         ` Michael Chastain
  2004-08-24 12:12         ` Michael Chastain
  1 sibling, 0 replies; 20+ messages in thread
From: Michael Chastain @ 2004-08-24  2:20 UTC (permalink / raw)
  To: drow, dan; +Cc: gdb

"Daniel Miller (IMI)" <dan@imi-test.com> wrote:
> Is it possible that upgrading the kernel affected anything??  That seems
> unlikely, since building the kernel shouldn't change any of the compiler
> libraries, I don't think??

Right.  All this symbol-handling stuff is above the kernel level.

There is a small chance that something really freaky in your glibc
could cause this.  That's pretty far down the list of suspects,
though.

> I'm going to go ahead and send you my binary for tester; it's small enough
> that there's no reason not to, I don't think.  I'll put it in bz2 format...

Cool.  I'll look at it soon, like tomorrow.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: cannot subscript something of type <data variable, no debug info>
  2004-08-23 22:30       ` Daniel Miller (IMI)
  2004-08-24  2:20         ` Michael Chastain
@ 2004-08-24 12:12         ` Michael Chastain
  2004-08-24 16:25           ` Daniel Miller (IMI)
                             ` (2 more replies)
  1 sibling, 3 replies; 20+ messages in thread
From: Michael Chastain @ 2004-08-24 12:12 UTC (permalink / raw)
  To: dan; +Cc: gdb

[Taking drow off the "To:" list because this probably isn't a gdb bug].

Okay, your "z1" executable manifests the same symptoms on my system,
native i686-pc-linux-gnu with red-hat-8.0.

  (gdb) break main
  Breakpoint 1 at 0x8048478: file tester.cpp, line 9.
  (gdb) run
  Starting program: /berman/home/mec.gnu/tmp/dm/z1

  Breakpoint 1, main () at tester.cpp:9
  9          Mod[0].powered_up = 1 ;
  (gdb) ptype Mod
  type = <data variable, no debug info>
  (gdb) print Mod[0]
  cannot subscript something of type `<data variable, no debug info>'
  (gdb) print (S_Module) Mod[0]
  No symbol "S_Module" in current context.

In the file z1, there are no symbols for Mod in tester.cpp!
There are some residual type definitions for 'char', 'short', 'int',
et cetera.

Looking at the assembly code for "main", it did not come from:

  g++ -Wall -g tester.cpp -o tester

"main" has optimized code in it, not default code.

The variable 'Mod' is still present with the optimized code.  (It would
be very hard for the compiler to optimize away a global variable).  So
normally, the linker should have kept the type information for it too,
if that type information was ever produced.

I tried some compiler switches on a suse-9 machine but could not quite
get the exact code that your compiler generated.

Can you rebuild the 'tester' executable and check the exact options that
you are using, for both compiling and linking?  The best thing would be:

  script
  g++ -v -Wall -g tester.cpp -o tester
  exit

... and mail in the script, along with the new 'tester' executable.
Also, you don't have to tar+compress the executable if it's only 10k again.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: cannot subscript something of type <data variable, no debug info>
  2004-08-24 12:12         ` Michael Chastain
@ 2004-08-24 16:25           ` Daniel Miller (IMI)
  2004-08-24 16:34             ` Daniel Jacobowitz
  2004-08-24 16:54             ` Michael Chastain
  2004-08-24 16:32           ` Daniel Miller (IMI)
  2004-08-24 16:54           ` Daniel Miller (IMI)
  2 siblings, 2 replies; 20+ messages in thread
From: Daniel Miller (IMI) @ 2004-08-24 16:25 UTC (permalink / raw)
  To: Michael Chastain; +Cc: gdb

[-- Attachment #1: Type: text/plain, Size: 1257 bytes --]

Well, this gets odder and odder... I'm enclosing the newly-built binary,
compiled exactly as you specified.  I'm also enclosing the screen dump from
the build, you can see my build command at the top...

But, when I run 'objdump tester -g', it says:

$ objdump tester -g

tester:     file format elf32-i386

objdump: tester: no recognized debugging information

!!!!!!!!!!!!!!
I tried -ggdb, and it says the same thing... clearly, something's wrong with
my system, or at least with my compiler installation...

hmmm... 'nm' *does* show some symbol info, including an entry for 'Mod', tho
it doesn't recognize it as an array, and it doesn't say anything about a
struct.  I'm not sure what that tells me, if anything...

It looks like I have the "expert" mode compiler installed, which doesn't
allow debugging, on the theory that *real* linux programmers don't need
crutches like that!!!  8-{P

Do you have any other insights on this??

In the meantime, I'm going to go ahead and take your suggestion to install
3.3.4 and see what comes out of that...

(BTW, is there any reason why you suggested 3.3.4 rather than 3.4.1, which
is current??  Is it not yet stable?)

I thank you VERY much for all the effort your providing on this problem!!

    Dan Miller




[-- Attachment #2: tester --]
[-- Type: application/octet-stream, Size: 9591 bytes --]

[-- Attachment #3: tester.build.txt --]
[-- Type: application/octet-stream, Size: 2083 bytes --]

$ g++ -v -Wall -g tester.cpp -o tester
Reading specs from /usr/lib/gcc-lib/i586-suse-linux/3.3.3/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --enable-languages=c,c++,f77,objc,java,ada --disable-checking --libdir=/usr/lib --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit i586-suse-linux
Thread model: posix
gcc version 3.3.3 (SuSE Linux)
 /usr/lib/gcc-lib/i586-suse-linux/3.3.3/cc1plus -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3 -D_GNU_SOURCE tester.cpp -D__GNUG__=3 -quiet -dumpbase tester.cpp -auxbase tester -g -Wall -version -o /tmp/ccMRprIv.s
GNU C++ version 3.3.3 (SuSE Linux) (i586-suse-linux)
        compiled by GNU C version 3.3.3 (SuSE Linux).
GGC heuristics: --param ggc-min-expand=63 --param ggc-min-heapsize=63475
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++
 /usr/include/g++/i586-suse-linux
 /usr/include/g++/backward
 /usr/local/include
 /usr/lib/gcc-lib/i586-suse-linux/3.3.3/include
 /usr/i586-suse-linux/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i586-suse-linux/3.3.3/../../../../i586-suse-linux/bin/as -V -Qy -o /tmp/ccWMXgJT.o /tmp/ccMRprIv.s
GNU assembler version 2.15.90.0.1.1 (i586-suse-linux) using BFD version 2.15.90.0.1.1 20040303 (SuSE Linux)
 /usr/lib/gcc-lib/i586-suse-linux/3.3.3/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o tester /usr/lib/gcc-lib/i586-suse-linux/3.3.3/../../../crt1.o /usr/lib/gcc-lib/i586-suse-linux/3.3.3/../../../crti.o /usr/lib/gcc-lib/i586-suse-linux/3.3.3/crtbegin.o -L/usr/lib/gcc-lib/i586-suse-linux/3.3.3 -L/usr/lib/gcc-lib/i586-suse-linux/3.3.3/../../../../i586-suse-linux/lib -L/usr/lib/gcc-lib/i586-suse-linux/3.3.3/../../.. /tmp/ccWMXgJT.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc-lib/i586-suse-linux/3.3.3/crtend.o /usr/lib/gcc-lib/i586-suse-linux/3.3.3/../../../crtn.o


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: cannot subscript something of type <data variable, no debug info>
  2004-08-24 12:12         ` Michael Chastain
  2004-08-24 16:25           ` Daniel Miller (IMI)
@ 2004-08-24 16:32           ` Daniel Miller (IMI)
  2004-08-24 16:54           ` Daniel Miller (IMI)
  2 siblings, 0 replies; 20+ messages in thread
From: Daniel Miller (IMI) @ 2004-08-24 16:32 UTC (permalink / raw)
  To: Michael Chastain; +Cc: gdb

Another note on this issue:

I again tried merging tester.h into the source file and compling.  In this
case, objdump *still* says no symbol information found, but gdb works as
expected:

(gdb) p Mod[0]
$1 = {Stat = 0, sys_status = 0, powered_up = 0, compat = 0}
(gdb) p (S_Module) Mod[0]
$2 = {Stat = 0, sys_status = 0, powered_up = 0, compat = 0}
(gdb) p Mod[0].powered_up
$3 = 0
(gdb) b main
Breakpoint 1 at 0x804847c: file tester2.cpp, line 16.
(gdb) r
Starting program: /home/usbsrc/files/tester

Breakpoint 1, main () at tester2.cpp:16
16         Mod[0].powered_up = 1 ;
(gdb) n
18         printf("powered_up=%u\n", Mod[0].powered_up) ;
(gdb) p Mod[0].powered_up
$4 = 1

... as expected.  Is gdb perhaps not able to find the header file(s) for
some reason??  And am I simply using objdump wrong?

    Dan

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: cannot subscript something of type <data variable, no debug info>
  2004-08-24 16:25           ` Daniel Miller (IMI)
@ 2004-08-24 16:34             ` Daniel Jacobowitz
  2004-08-24 16:40               ` Daniel Miller (IMI)
  2004-08-24 16:54             ` Michael Chastain
  1 sibling, 1 reply; 20+ messages in thread
From: Daniel Jacobowitz @ 2004-08-24 16:34 UTC (permalink / raw)
  To: Daniel Miller (IMI); +Cc: Michael Chastain, gdb

On Tue, Aug 24, 2004 at 09:25:11AM -0700, Daniel Miller (IMI) wrote:
> Well, this gets odder and odder... I'm enclosing the newly-built binary,
> compiled exactly as you specified.  I'm also enclosing the screen dump from
> the build, you can see my build command at the top...
> 
> But, when I run 'objdump tester -g', it says:
> 
> $ objdump tester -g
> 
> tester:     file format elf32-i386
> 
> objdump: tester: no recognized debugging information
> 
> !!!!!!!!!!!!!!
> I tried -ggdb, and it says the same thing... clearly, something's wrong with
> my system, or at least with my compiler installation...

No, that's standard.  Nowadays use readelf -wi.

-- 
Daniel Jacobowitz

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: cannot subscript something of type <data variable, no debug info>
  2004-08-24 16:34             ` Daniel Jacobowitz
@ 2004-08-24 16:40               ` Daniel Miller (IMI)
  0 siblings, 0 replies; 20+ messages in thread
From: Daniel Miller (IMI) @ 2004-08-24 16:40 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Michael Chastain, gdb

----- Original Message ----- 
From: "Daniel Jacobowitz" <drow@false.org>
To: "Daniel Miller (IMI)" <dan@imi-test.com>
Cc: "Michael Chastain" <mec.gnu@mindspring.com>; <gdb@sources.redhat.com>
Sent: Tuesday, August 24, 2004 09:34
Subject: Re: cannot subscript something of type <data variable, no debug
info>


> > But, when I run 'objdump tester -g', it says:
> >
> > I tried -ggdb, and it says the same thing... clearly, something's wrong
with
> > my system, or at least with my compiler installation...
>
> No, that's standard.  Nowadays use readelf -wi.
>
Ahhh!!!  Thank you, Daniel... I've never heard of readelf before...

And indeed, the symbol table of the binary with separate header does *not*
show S_Module, while the combined file does... hmmm...

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: cannot subscript something of type <data variable, no debug info>
  2004-08-24 16:25           ` Daniel Miller (IMI)
  2004-08-24 16:34             ` Daniel Jacobowitz
@ 2004-08-24 16:54             ` Michael Chastain
  1 sibling, 0 replies; 20+ messages in thread
From: Michael Chastain @ 2004-08-24 16:54 UTC (permalink / raw)
  To: dan; +Cc: gdb

objdump isn't what you want; try "readelf -w tester".

'nm' will show the symbol 'Mod'.  The symbol is fine,
it has a valid address and everything.  The problem is that the
*type information* for the symbol is missing.

> It looks like I have the "expert" mode compiler installed, which doesn't
> allow debugging, on the theory that *real* linux programmers don't need
> crutches like that!!!  8-{P

I don't know SuSE, but it sounds like you have some freak compiler
installed, all right.  SuSE must have a good compiler too, because
the SuSE system that I'm using compiles your source code to an
executable file with good debug info.

> (BTW, is there any reason why you suggested 3.3.4 rather than 3.4.1, which
> is current??  Is it not yet stable?)

3.4.1 has some debug info regressions compared to 3.3.4.
Also since your vendor compiler is a derivative of 3.3.3,
3.3.4 might slip in a bit easier, especially if you link
against system shared C++ libraries like the KDE libraries.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: cannot subscript something of type <data variable, no debug info>
  2004-08-24 12:12         ` Michael Chastain
  2004-08-24 16:25           ` Daniel Miller (IMI)
  2004-08-24 16:32           ` Daniel Miller (IMI)
@ 2004-08-24 16:54           ` Daniel Miller (IMI)
  2004-08-24 16:55             ` Daniel Jacobowitz
  2 siblings, 1 reply; 20+ messages in thread
From: Daniel Miller (IMI) @ 2004-08-24 16:54 UTC (permalink / raw)
  To: gdb

Geeezzz... When I moved from kernel 2.4 (Redhat 9.1) to kernel 2.6 (SuSE
9.1), I was really impressed that the size of our application dropped from
almost 900K to almost 500K... I thought the compiler was much improved!!
Now I realize that it just doesn't have most of the global symbol
information included in it!!!  Hmph... that's a disappointment...  Now, if I
can just figure out *why* ...

    1 befuddled Dan

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: cannot subscript something of type <data variable, no debug info>
  2004-08-24 16:54           ` Daniel Miller (IMI)
@ 2004-08-24 16:55             ` Daniel Jacobowitz
  2004-08-24 17:20               ` Michael Chastain
  0 siblings, 1 reply; 20+ messages in thread
From: Daniel Jacobowitz @ 2004-08-24 16:55 UTC (permalink / raw)
  To: Daniel Miller (IMI); +Cc: gdb

On Tue, Aug 24, 2004 at 09:54:33AM -0700, Daniel Miller (IMI) wrote:
> Geeezzz... When I moved from kernel 2.4 (Redhat 9.1) to kernel 2.6 (SuSE
> 9.1), I was really impressed that the size of our application dropped from
> almost 900K to almost 500K... I thought the compiler was much improved!!
> Now I realize that it just doesn't have most of the global symbol
> information included in it!!!  Hmph... that's a disappointment...  Now, if I
> can just figure out *why* ...
> 
>     1 befuddled Dan

The two of you should probably compare RPM package versions of the
compiler.  Presumably SuSE released an update that either fixed or
broke this.  Hopefully fixed.

-- 
Daniel Jacobowitz

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: cannot subscript something of type <data variable, no debug info>
  2004-08-24 16:55             ` Daniel Jacobowitz
@ 2004-08-24 17:20               ` Michael Chastain
  2004-08-24 17:48                 ` Daniel Miller (IMI)
       [not found]                 ` <00e001c48a01$014b02b0$0401a8c0@dan>
  0 siblings, 2 replies; 20+ messages in thread
From: Michael Chastain @ 2004-08-24 17:20 UTC (permalink / raw)
  To: drow, dan; +Cc: gdb

Daniel Jacobowitz <drow@false.org> wrote:
> The two of you should probably compare RPM package versions of the
> compiler.

Oh!  I didn't know that SuSE is RPM-based now!

What have you got, Dan?

  % cat /etc/SuSE-release

  SUSE LINUX Enterprise Server 9 (i586)
  VERSION = 9

  % rpm -q gcc gcc-c++ binutils

  gcc-3.3.3-43.24
  gcc-c++-3.3.3-43.24
  binutils-2.15.90.0.1.1-32.5

  % rpm -qi gcc gcc-c++ binutils       # with editing

  Name: gcc-c++
  Version: 3.3.3
  Build Date: Wed 30 Jun 2004 01:21:54 PM EDT
  Source RPM: gcc-3.3.3-43.24.src.rpm

  Name: gcc
  Version: 3.3.3
  Build Date: Wed 30 Jun 2004 01:21:54 PM EDT
  Source RPM: gcc-3.3.3-43.24.src.rpm

  Name: binutils
  Version: 2.15.90.0.1.1
  Build Date: Wed 30 Jun 2004 12:24:56 PM EDT
  Source RPM: binutils-2.15.90.0.1.1-32.5.src.rpm

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: cannot subscript something of type <data variable, no debug info>
  2004-08-24 17:20               ` Michael Chastain
@ 2004-08-24 17:48                 ` Daniel Miller (IMI)
  2004-08-24 17:52                   ` Daniel Jacobowitz
       [not found]                 ` <00e001c48a01$014b02b0$0401a8c0@dan>
  1 sibling, 1 reply; 20+ messages in thread
From: Daniel Miller (IMI) @ 2004-08-24 17:48 UTC (permalink / raw)
  To: Michael Chastain, drow; +Cc: gdb

gcc 3.3.4 works properly, both in the tester utility and in our application,
as well as in kdevelop!!

Thank you both for your insightful assistance... I think we can consider
this issue closed...

    Dan Miller

----- Original Message ----- 
From: "Michael Chastain" <mec.gnu@mindspring.com>
To: <drow@false.org>; <dan@imi-test.com>
Cc: <gdb@sources.redhat.com>
Sent: Tuesday, August 24, 2004 10:20
Subject: Re: cannot subscript something of type <data variable, no debug
info>


> Daniel Jacobowitz <drow@false.org> wrote:
> > The two of you should probably compare RPM package versions of the
> > compiler.
>
> Oh!  I didn't know that SuSE is RPM-based now!
>
> What have you got, Dan?
>
>   % cat /etc/SuSE-release
>
>   SUSE LINUX Enterprise Server 9 (i586)
>   VERSION = 9
>
>   % rpm -q gcc gcc-c++ binutils
>
>   gcc-3.3.3-43.24
>   gcc-c++-3.3.3-43.24
>   binutils-2.15.90.0.1.1-32.5
>
>   % rpm -qi gcc gcc-c++ binutils       # with editing
>
>   Name: gcc-c++
>   Version: 3.3.3
>   Build Date: Wed 30 Jun 2004 01:21:54 PM EDT
>   Source RPM: gcc-3.3.3-43.24.src.rpm
>
>   Name: gcc
>   Version: 3.3.3
>   Build Date: Wed 30 Jun 2004 01:21:54 PM EDT
>   Source RPM: gcc-3.3.3-43.24.src.rpm
>
>   Name: binutils
>   Version: 2.15.90.0.1.1
>   Build Date: Wed 30 Jun 2004 12:24:56 PM EDT
>   Source RPM: binutils-2.15.90.0.1.1-32.5.src.rpm
>
>
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: cannot subscript something of type <data variable, no debug info>
  2004-08-24 17:48                 ` Daniel Miller (IMI)
@ 2004-08-24 17:52                   ` Daniel Jacobowitz
  0 siblings, 0 replies; 20+ messages in thread
From: Daniel Jacobowitz @ 2004-08-24 17:52 UTC (permalink / raw)
  To: Daniel Miller (IMI); +Cc: Michael Chastain, gdb

On Tue, Aug 24, 2004 at 10:48:58AM -0700, Daniel Miller (IMI) wrote:
> gcc 3.3.4 works properly, both in the tester utility and in our application,
> as well as in kdevelop!!
> 
> Thank you both for your insightful assistance... I think we can consider
> this issue closed...

SuSE backported the omit-duplicate-debug-info support to their 3.3
compiler, if I remember right.  3.3.4 won't have it.  Their latest
3.3.3 update presumably will fix it, or you can just use 3.3.4 :-)

-- 
Daniel Jacobowitz

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: cannot subscript something of type <data variable, no debug info>
       [not found]                 ` <00e001c48a01$014b02b0$0401a8c0@dan>
@ 2004-08-24 17:54                   ` Michael Chastain
  0 siblings, 0 replies; 20+ messages in thread
From: Michael Chastain @ 2004-08-24 17:54 UTC (permalink / raw)
  To: drow, dan; +Cc: gdb

Well, it's a relief that the more recent version is the version that
doesn't exhibit the buggy behavior.  It might be a SuSE gcc packaging
bug, or it might be an installation bug on your side.  We'll never know.

> At this point, tho, I might as well just stick with the 3.3.4 update,
> do you agree??  I'm already compiling it anyway...

Try it; see if it works for you.

Make sure to configure with "--prefix=..." so that you can install
it side by side without disturbing your vendor installation.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: cannot subscript something of type <data variable, no debug info>
@ 2004-08-23 20:56 Daniel Miller (IMI)
  0 siblings, 0 replies; 20+ messages in thread
From: Daniel Miller (IMI) @ 2004-08-23 20:56 UTC (permalink / raw)
  To: Daniel Miller (IMI), Daniel Jacobowitz; +Cc: gdb

Interesting note:
The source file is tester.cpp, and I'm compiling with g++.
I tried renaming the file to tester.c and compiling with gcc, and the print
statements all work fine!!!  So apparently this is a c++ issue in gdb.  Does
that help resolve the problem??

----- Original Message ----- 
From: "Daniel Miller (IMI)" <dan@imi-test.com>
To: "Daniel Jacobowitz" <drow@false.org>
Cc: <gdb@sources.redhat.com>
Sent: Monday, August 23, 2004 13:49
Subject: Re: cannot subscript something of type <data variable, no debug
info>


> My system is:
> - linux 2.6.7 (running on i386, specifically P4 2.4GHz)
> - g++ (GCC) 3.3.3 (SuSE Linux)
> - GNU gdb 6.1
>
> I compile the following code via
>
> g++ -Wall -g tester.cpp -o tester
>
> //  source file
> #include <stdio.h>
>
> #include "tester.h"
>
> S_Module Mod[1] ;
>
> int main(void)
> {
>    Mod[0].powered_up = 1 ;
>
>    printf("powered_up=%u\n", Mod[0].powered_up) ;
>    return 0;
> }
>
> //  header file tester.h
> typedef struct S_Module_s
> {
>   unsigned Stat;     // module status
>   unsigned sys_status ; //  system errno
>   unsigned powered_up;
>   unsigned compat ;
> } S_Module;
> // } __attribute__ ((__packed__)) S_Module;
>
> extern S_Module Mod[1];
> //*****************************************************
>
> After compiling as previously described and loading tester into gdb, I
see:
>
> (gdb) p Mod[0]
> cannot subscript something of type `<data variable, no debug info>'
> (gdb) p (S_Module) Mod[0]
> No symbol "S_Module" in current context.
>
> //*****************************************************
>
> Note that if I pull the header-file data into the source file, then print
> can successfully access the struct.  When it's in a separate header,
though,
> it doesn't work.  Of course, my real project has 10 headers and 30-some
> source files, so eliminating headers isn't practical.  Is there something
> else I can do to make this work??  Or should I call this a bug report??
>
>     Dan Miller
>
>
> //*****************************************************
> ----- Original Message ----- 
> From: "Daniel Jacobowitz" <drow@false.org>
> To: "Daniel Miller (IMI)" <dan@imi-test.com>
> Cc: <gdb@sources.redhat.com>
> Sent: Friday, August 20, 2004 19:11
> Subject: Re: cannot subscript something of type <data variable, no debug
> info>
>
>
> > On Fri, Aug 20, 2004 at 06:23:03PM -0700, Daniel Miller (IMI) wrote:
> > > I'm trying to debug an application with gdb... I have a struct that is
> > > declared thus:
> > >
> > > typedef struct S_Module_s
> > > {
> > >   unsigned powered_up;
> > >        ...  other data elements  ...
> > > } __attribute__ ((__packed__)) S_Module;
> > >
> > > extern S_Module Mod[1];
> > >
> > > I tried compiling both with -g and -ggdb, with no change in the
> symptoms.
> >
> > What platform?  What version of GDB?
> >
> > > I don't seem to be able to display any of the contents of Mod[0], at
> all....
> > > I get effects such as:
> > >
> > > (gdb) p Mod[0]
> > > cannot subscript something of type `<data variable, no debug info>'
> > > (gdb) p (S_Module) Mod[0]
> > > No symbol "S_Module" in current context.
> > > (gdb) p (struct S_Module_s) Mod[0]
> > > No struct type named S_Module_s.
> > >
> > > What do I have to do to get gdb to recognize my variables??  Virtually
> every
> > > GUI-based debugger out there is a wrapper around gdb, to if it's not
> happy,
> > > nobody's happy!!!  Please help!!
> >
> > We'll need a standalone test case, or at least a dump of the debugging
> > information in the application, to answer this question.
> >
> > -- 
> > Daniel Jacobowitz
> >
> >
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2004-08-24 17:54 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-21  1:23 cannot subscript something of type <data variable, no debug info> Daniel Miller (IMI)
2004-08-21  2:11 ` Daniel Jacobowitz
2004-08-23 20:49   ` Daniel Miller (IMI)
2004-08-23 21:15     ` Michael Chastain
2004-08-23 21:28     ` Michael Chastain
2004-08-23 22:30       ` Daniel Miller (IMI)
2004-08-24  2:20         ` Michael Chastain
2004-08-24 12:12         ` Michael Chastain
2004-08-24 16:25           ` Daniel Miller (IMI)
2004-08-24 16:34             ` Daniel Jacobowitz
2004-08-24 16:40               ` Daniel Miller (IMI)
2004-08-24 16:54             ` Michael Chastain
2004-08-24 16:32           ` Daniel Miller (IMI)
2004-08-24 16:54           ` Daniel Miller (IMI)
2004-08-24 16:55             ` Daniel Jacobowitz
2004-08-24 17:20               ` Michael Chastain
2004-08-24 17:48                 ` Daniel Miller (IMI)
2004-08-24 17:52                   ` Daniel Jacobowitz
     [not found]                 ` <00e001c48a01$014b02b0$0401a8c0@dan>
2004-08-24 17:54                   ` Michael Chastain
2004-08-23 20:56 Daniel Miller (IMI)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).