0

i'm having troubles watching a certain pointer that i know is modified in a wrong way..

i have a class processor that is a subclass of the apstract pu. bus is a pointer to an other unrelated object and is defined in pu, i use it in processor and at some point its values changes (i'm wondering why).

so, i'm trying to watch that particular bus variable with gdb (and i'm not good at using it), but i can't find how to keep in sight that specific varible.

my class scheme is as follows:

class pu{
public:
    pu(systemBus *sysBus) {bus = sysBus;};
private:
    systemBus *bus;
}

class processor : public pu{
public:
    processor(systemBus *sysbus) : pu(sysbus) {};
}

thanks

mellotanica
  • 174
  • 5
  • 12

1 Answers1

0

See also GDB: Watchpoint a fixed address

GDB Doc http://sourceware.org/gdb/download/onlinedocs/gdb/Set-Watchpoints.html#Set-Watchpoints

You're going to want to set a watchpoint on the memory address.

Community
  • 1
  • 1
Steven Maitlall
  • 777
  • 3
  • 5
  • thanks for the readings, but i don't seem to be able to manage this at all, i did set watchpoints of all three kinds on the pointed memory address and on the pointer's location, but the program runs till the segfault without sropping.. i'm sure that the pointer changes at some point (before the bad ending) because there are a couple of print in the main program that shows me the actual value, but i'm not able to understand exactly where the change happens – mellotanica May 29 '13 at 08:14