gdb-4.5, g++-2.1, String "unknown struct"?

gdb-4.5, g++-2.1, String "unknown struct"?

Post by Tom McConne » Sat, 25 Apr 1992 01:10:40

  I have gdb-4.5 up on the RS/6000, and I am having problems using the "print"
command to look at String variables.

  Environment: IBM RS/6000 550, AIX 3.1.6, g++-2.1, libg++-2.0, gdb-4.5.

  Problem: When I use the "print" command in gdb on a variable of class String,
          gdb says "$1 = <unknown struct>".

  Question: Can I use the gdb "print" command to look at variables of class

  [ Please e-mail any responses, in addition to any posts. My news server has ]
  [ been very undependable as of late.                                        ]

  Example program:

thunder> cat
#include <stream.h>
#include <String.h>
#include <stddef.h>

String s1 = "Hello";
String s2 = " world!\n";

    for (int i = 0; i < 5; i++)
        cout << i << " " << s1 << s2;


  Compile the program:

thunder> g++ -v -g -o t9
Reading specs from /stor/gnu/aix/lib/gcc-lib/rs6000/2.1/specs
gcc version 2.1
 /stor/gnu/aix/lib/gcc-lib/rs6000/2.1/cpp -lang-c++ -v -undef -D__GNUC__=2
-D__GNUG__=2 -D__cplusplus -D_IBMR2 -D_AIX -D___IBMR2__ -D___AIX__ -D___IBMR2
-D___AIX -D__CHAR_UNSIGNED__ -g /tmp/ccMYsCb8.i
GNU CPP version 2.1
 /stor/gnu/aix/lib/gcc-lib/rs6000/2.1/cc1plus /tmp/ccMYsCb8.i -quiet -dumpbase -g -version -o /tmp/ccMYsCb8.s
GNU C++ version 2.1 compiled by GNU C version 2.1.
 as -u -o test9.o /tmp/ccMYsCb8.s
 /stor/gnu/aix/lib/gcc-lib/rs6000/2.1/ld -T512 -H512 -btextro -bhalt:4
-bnodelcsect -o t9 /lib/crt0.o -L/stor/gnu/aix/lib/gcc-lib/rs6000/2.1/
-L/stor/gnu/aix/lib/ test9.o -lg++ -lm
/stor/gnu/aix/lib/gcc-lib/rs6000/2.1/libgcc.a -lc

  Program output:

thunder> t9
0 Hello world!
1 Hello world!
2 Hello world!
3 Hello world!
4 Hello world!

  gdb session:

thunder> gdb t9
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) l 1,30
1       #include <stream.h>
2       #include <String.h>
3       #include <stddef.h>
5       String s1 = "Hello";
6       String s2 = " world!\n";
8       main()
9       {
10          for (int i = 0; i < 5; i++)
11              cout << i << " " << s1 << s2;
12      }
(gdb) b 11
Breakpoint 1 at 0x308: file, line 11.
(gdb) run
Starting program: /a/eng/eng6/tmcconne/source/t9

Breakpoint 1, main () at
11              cout << i << " " << s1 << s2;
Current Language:  auto; currently c++
Type checking:     auto; currently off
Range checking:    auto; currently off
(gdb) p i
$1 = 0
(gdb) p s1
$2 = <unknown struct>
(gdb) info locals
i = 0
(gdb) info v s1
All variables matching regular expression "s1":

int _GLOBAL_.D.s1;
int _GLOBAL_.I.s1;
StrTmp s1;

  So, does this mean that gdb does not understand "StrTmp"? By the way, String.h
defines StrTmp like this:

typedef String StrTmp; // for backward compatibility

  This same behavior is seen with gdb-4.4, gcc-2.1, libg++-2.0 on VAX ultrix
3.1, and Sun SPARC SunOS 4.1.1. The only difference is that on the Sun, gdb says
this about "s1":

(gdb) info v s1
All variables matching regular expression "s1":

struct String s1;

  Thanks for any help.


    Tom McConnell

 Intel, Corp. C3-21     |     Phone: (602)-554-8229
 5000 W. Chandler Blvd. | The opinions expressed are my own. No one in
 Chandler, AZ  85226    | their right mind would claim them.


1. getting "struct pci_dev" from "struct netdevice"


i am writting a sort of generic pci driver.

my problem is that i have netdevice structure of a pci network card. i want
to obtain card's pci_dev structure in a kernel module. i could not find any
common field between these structures.only common member is irq which is of
no use as it can be used by more than one device.

2. Kodak DC280 digital camera setup

3. Problems with gdb-4.5 and g++-2.1 on RS6000

4. Suggestion on Router/Firewall solution

5. mcs -a "string" vs. CC -mr,"string"

6. OS5 and Digi PortServer II Probs

7. GETSERVBYNAME()????????????????????"""""""""""""

8. PS/2 mouse not working in XFree86

9. """"""""My SoundBlast 16 pnp isn't up yet""""""""""""

10. HELP: "recvmsg" and "struct msghdr" questions

11. How can I transfer struct "addrinfo" to "hostent"??

12. Why "key" has become "__key" in struct ipc_perm?

13. "syslogd: unknown priority "24" " error - won't boot!