Hi, I am currently debugging my code base in a Linux machine via GDB. I am currently facing the problem of getting the value of a data item from a ptr object of a class. To print the location of the ptr object, we can use the p command (print) or display.
For example: I have a class like this
class abc { string a; };
So in my code, if I use a pointer to the abc class, then
abc* objPtr = new abc();
so after breaking above the line, I get objPtr, and now I want to check the value of datamember a (abc :: a). how could i do that?
(gdb) p objPtr $2 = {px = 0x3ba6430690, pn = {pi_ = 0x3ba6430698}}
Also, is there another way to check for a data item that is a list / vector?
source share