2
class Message{
    double *val
};

Message** val_msgs;
val_msgs = new Message*[120];
for(int i=0; i<120; i++)
    val_msgs[i]=new Message();

I am using gdb to watch a variable inside the Message data structure

watch val_msgs[0]->val

However, I get this error

(gdb) watch val_msgs[0]->val
Hardware watchpoint 2: this->val_msgs[0]->val
(gdb) c
Continuing.
pingCharmrun (ignored=0x7ffff73751c1) at machine.c:1151
1151    {
Current language:  auto; currently c
(gdb) c
Continuing.
Warning:
Could not insert hardware watchpoint 2.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.

As you can see I have set only 2 watchpoints. Help, please?

ismail
  • 46,010
  • 9
  • 86
  • 95
Akhil
  • 2,269
  • 6
  • 32
  • 39
  • I can't reproduce on GDB 8.1, Ubuntu 18.04 by adding a `main` to the test program given. Related threads: https://stackoverflow.com/questions/3206332/gdb-stops-with-too-many-watchpoints-when-there-is-only-one | https://stackoverflow.com/questions/3470704/setting-gdb-hardware-watchpoint-how-to-set-software-watchpoint – Ciro Santilli OurBigBook.com Jan 03 '20 at 16:32

1 Answers1

1

The replies to this previous question may help: gdb problem setting hardware watchpoint/how to set software watchpoint

Community
  • 1
  • 1
Chris Card
  • 3,216
  • 20
  • 15