#1003639 gdb sometimes doesn't set hardware breakpoint for no discernible reason

Package:
gdb
Source:
gdb
Description:
GNU Debugger
Submitter:
Frank Heckenbach
Date:
2022-01-13 06:12:04 UTC
Severity:
normal
#1003639#5
Date:
2022-01-13 06:09:14 UTC
From:
To:
From a coomplicated gdb session
(https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1003638):

(gdb) p (float*)$2
$29 = (float *) 0x556e612bd530
(gdb) watch *(float*)$29
Hardware watchpoint 10: *(float*)$29
(gdb) d 10
[...]
(gdb) watch *(float*)$30
Watchpoint 21: *(float*)$30
(gdb) d 21
(gdb) p $30
$31 = (float *) 0x556e614692d0
(gdb) p $30==(float*)0x556e614692d0
$32 = 1
(gdb) watch *(float*)0x556e614692d0
Hardware watchpoint 22: *(float*)0x556e614692d0
(gdb) d 22

So watching a float at some address (*$2) creates a hardware
watchpoint, but at another one (*$30) only a software watchpoint
(which in this case was unusably slow).

But watching the same address typed explicitly (and verified with
"==" to rule out copy/paste error) gave a hardware watchpoint again
(which did help to find the other bug :).

Nothing in the docs or on the net I could find gives any explanation
when and why gdb uses hardware watchpoints (only an option to force
software watchpoints which is the opposite I want).

I don't see any reason here, so I suppose it's a bug. If not, it
would be useful to at least tell the user why it doesn't.