tags:

views:

32

answers:

1

Hi,

Do you know any other reasons why a watchpoint could not be inserted other than too many hardware breakpoints/watchpoints?

I have the following debug session:

GNU gdb (GDB) 7.1
...
(gdb) watch itrap_t_beg[1][222]
Hardware watchpoint 1: itrap_t_beg[1][222]
(gdb) cont
Continuing.
...
Hardware watchpoint 1: itrap_t_beg[1][222]

...
(gdb) cont
Continuing.
Warning:
Could not insert hardware watchpoint 1.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.

(gdb) info break
Num     Type           Disp Enb Address            What
1       hw watchpoint  keep y                      itrap_t_beg[1][222]
        breakpoint already hit 1 time

As you can see, there's only one watchpoint yet it can't insert the breakpoint.

Do you know how can I fix this?

+2  A: 

As far as I know commodity x86 CPUs have four debug registers available for supporting hardware breaks/watches. This limits the object size that you can watch. Object alignment also plays here.

Try limiting the watch scope to a smaller object like pair of first and last members of the structure.

Nikolai N Fetissov
Hey! It worked! Thanks. The strange thing is that I could set the first watch. Maybe, at that point, the itrap_t_beg was a char* and then it was casted to trap* (the source code is very old and things like that can happen). Thanks again!
Gastón
Sure, glad that worked.
Nikolai N Fetissov