struct ptr{
int node;
ptr *next;
ptr(){}
ptr(int _node, ptr *_next){ node=_node; next=_next; }
};
struct list_t{
ptr *sht;
int size;
void push(int node){
size++;
sht=new ptr(node,sht);
}
}shthead[100001], comp[200001], tree[200001];
The struct ptr is used as a linked list. But when I debug the code in gdb, I found that the ptr*'s were all converted to void*.
GDB output:
(gdb) pt ptr
type = struct ptr {
int node;
void *next;
public:
ptr(void);
ptr(int, void *);
}
However, I can still see the data of the struct if I covert them back to ptr* in gdb.
What's the reason for this please?
I'm using Arch Linux, GNOME, g++ 4.5.0, gdb 7.1. Without any compilation flags but a -g.This GDB was configured as "i686-pc-linux-gnu"
Works fine for me on OS X.
(gdb) pt ptr
type = class ptr {
public:
int node;
ptr *next;
ptr(void);
ptr(int, ptr *);
}
gdb version:
Shadow:code dkrauss$ gdb -v
GNU gdb 6.3.50-20050815 (Apple version gdb-1346) (Fri Sep 18 20:40:51 UTC 2009)
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 "x86_64-apple-darwin".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With