Hello GDB Bug -

I am using GDB 4.16 (sparc-sun-solaris2.5).

-----------------

If I put the following code in the file odd.cc and compile
it with the command "gcc -v -g -o odd odd.cc", it is compiled OK
and part of the verbiage it spews out while compiling is
"/depot/gnu/plat/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.1/cc1plus",
so apparently it is being compiled as C++.
When I run the "odd" executable, it runs OK.
But when I run "gdb odd" and do "ptype world", I get:

type = class world {
  public:
    strip cols[0];
    char thing[9];

    world(void);
    world(world const &);
    world & operator=(world const &);
}

Notice that the [0] above should be [9].
If I put a breakpoint in main then run the program, if I try
"print a_world", gdb gives me a segmentation fault.

If I compile with g++ instead of gcc, I get identical behavior.

----------------

If I put the same code in the file odd.c and compile it with the same
gcc command, it is compiled OK and part of the verbiage it spews out
while compiling is
"/depot/gnu/plat/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.1/cc1"
so apparently it is being compiled as C.
When I run the "odd" executable, it runs OK.
When I run "gdb odd", everything works OK; specifically:

When I do "ptype struct world", I get:

type = struct world {
    struct strip cols[9];
    char thing[9];
}

And, if I put a breakpoint in main then run the program, if I try
"print a_world", it works OK.

------------------

This may be a bug in gdb (or maybe I am not using gdb correctly or have
an outdated version).

Tom Kramer
[EMAIL PROTECTED]
*****************************************************************

#include <stdio.h>

struct strip
{
 int aim;
};

struct world
{
  struct strip cols[9];
  char thing[9];
};

main()
{
  struct world a_world;
  int n;

  for (n = 0; n < 9; n++)
    {
      a_world.cols[n].aim = n;
      a_world.thing[n] = ('a' + n);
    }
  for(n = 0; n < 9; n++)
    {
      printf("%d %c\n", a_world.cols[n].aim, a_world.thing[n]);
    }
}

****************************************************************


_______________________________________________
Bug-gdb mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gdb

Reply via email to