public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/31485] New: [gdb/breakpoints] watchpoint not triggered during inferior call
@ 2024-03-14 11:56 vries at gcc dot gnu.org
  2024-03-21  8:47 ` [Bug breakpoints/31485] " vries at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-14 11:56 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31485

            Bug ID: 31485
           Summary: [gdb/breakpoints] watchpoint not triggered during
                    inferior call
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

On aarch64-linux, I did the following:
...
$ gdb -q -batch \
    -iex "set trace-commands on" \
    outputs/gdb.base/watchpoint-unaligned/watchpoint-unaligned \
    -ex "watch data.u.size8twice[0]" \
    -ex start \
    -ex "set unwind-on-terminating-exception off" \
    -ex "set unwindonsignal off" \
    -ex "print data".u.size8twice \
    -ex "call write_size8twice()" \
    -ex "print data".u.size8twice
+watch data.u.size8twice[0]
Hardware watchpoint 1: data.u.size8twice[0]
+start
Temporary breakpoint 2 at 0x410208: file
/home/vries/gdb/src/gdb/testsuite/gdb.base/watchpoint-unaligned.c, line 65.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Temporary breakpoint 2, main () at
/home/vries/gdb/src/gdb/testsuite/gdb.base/watchpoint-unaligned.c:65
65        write_size8twice ();
+set unwind-on-terminating-exception off
+set unwindonsignal off
+print data.u.size8twice
$1 = {0, 0, 0}
+call write_size8twice()
+print data.u.size8twice
$2 = {1, 2, 0}
...

My understanding from the doc (
https://sourceware.org/gdb/current/onlinedocs/gdb.html/Calling.html#stack-unwind-settings
):
...
If a called function is interrupted for any reason, including hitting a
breakpoint, or triggering a watchpoint, and the stack is not unwound due to set
unwind-on-terminating-exception on or set unwindonsignal on (see stack unwind
settings), then the dummy-frame, created by GDB to facilitate the call to the
program function, will be visible in the backtrace
...
is that the watchpoint should trigger.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug breakpoints/31485] [gdb/breakpoints] watchpoint not triggered during inferior call
  2024-03-14 11:56 [Bug breakpoints/31485] New: [gdb/breakpoints] watchpoint not triggered during inferior call vries at gcc dot gnu.org
@ 2024-03-21  8:47 ` vries at gcc dot gnu.org
  2024-03-21  9:04 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-21  8:47 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31485

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
I see the same on x86_64.

In run_inferior_call, we have:
...
  disable_watchpoints_before_interactive_call_start ();
...
which has been around since 2009.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug breakpoints/31485] [gdb/breakpoints] watchpoint not triggered during inferior call
  2024-03-14 11:56 [Bug breakpoints/31485] New: [gdb/breakpoints] watchpoint not triggered during inferior call vries at gcc dot gnu.org
  2024-03-21  8:47 ` [Bug breakpoints/31485] " vries at gcc dot gnu.org
@ 2024-03-21  9:04 ` vries at gcc dot gnu.org
  2024-03-21  9:05 ` vries at gcc dot gnu.org
  2024-03-21  9:49 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-21  9:04 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31485

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
With this patch:
...
-  disable_watchpoints_before_interactive_call_start ();
+  //disable_watchpoints_before_interactive_call_start ();
...
we have (on x86_64):
...
$ gdb -q  -iex "set trace-commands on" \
    outputs/gdb.base/watchpoint-unaligned/watchpoint-unaligned \
    -ex "watch data.u.size8twice[0]" \
    -ex start \
    -ex "set unwind-on-terminating-exception off" \
    -ex "set unwindonsignal off" \
    -ex "print data".u.size8twice \
    -ex "call write_size8twice()" \
    -ex "print data".u.size8twice 
Reading symbols from
outputs/gdb.base/watchpoint-unaligned/watchpoint-unaligned...
+watch data.u.size8twice[0]
Hardware watchpoint 1: data.u.size8twice[0]
+start
Temporary breakpoint 2 at 0x400567: file
/data/vries/gdb/src/gdb/testsuite/gdb.base/watchpoint-unaligned.c, line 65.
Starting program:
/data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb.base/watchpoint-unaligned/watchpoint-unaligned 

Temporary breakpoint 2, main () at
/data/vries/gdb/src/gdb/testsuite/gdb.base/watchpoint-unaligned.c:65
65        write_size8twice ();
+set unwind-on-terminating-exception off
+set unwindonsignal off
+print data.u.size8twice
$1 = {0, 0, 0}
+call write_size8twice()

Hardware watchpoint 1: data.u.size8twice[0]

Old value = 0
New value = 1
write_size8twice () at
/data/vries/gdb/src/gdb/testsuite/gdb.base/watchpoint-unaligned.c:54
54        data.u.size8twice[offset + 1] = second;
The program being debugged stopped while in a function called from GDB.
Evaluation of the expression containing the function
(write_size8twice) will be abandoned.
When the function is done executing, GDB will silently stop.
+print data.u.size8twice
$2 = {1, 0, 0}
(gdb) 
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug breakpoints/31485] [gdb/breakpoints] watchpoint not triggered during inferior call
  2024-03-14 11:56 [Bug breakpoints/31485] New: [gdb/breakpoints] watchpoint not triggered during inferior call vries at gcc dot gnu.org
  2024-03-21  8:47 ` [Bug breakpoints/31485] " vries at gcc dot gnu.org
  2024-03-21  9:04 ` vries at gcc dot gnu.org
@ 2024-03-21  9:05 ` vries at gcc dot gnu.org
  2024-03-21  9:49 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-21  9:05 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31485

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Made note of inconsistency doc vs actual behaviour here (
https://sourceware.org/pipermail/gdb-patches/2024-March/207427.html ).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug breakpoints/31485] [gdb/breakpoints] watchpoint not triggered during inferior call
  2024-03-14 11:56 [Bug breakpoints/31485] New: [gdb/breakpoints] watchpoint not triggered during inferior call vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-03-21  9:05 ` vries at gcc dot gnu.org
@ 2024-03-21  9:49 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-21  9:49 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31485

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #2)
> With this patch:
> ...
> -  disable_watchpoints_before_interactive_call_start ();
> +  //disable_watchpoints_before_interactive_call_start ();
> ...

FWIW, tested this on x86_64-linux, no regressions.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-21  9:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-14 11:56 [Bug breakpoints/31485] New: [gdb/breakpoints] watchpoint not triggered during inferior call vries at gcc dot gnu.org
2024-03-21  8:47 ` [Bug breakpoints/31485] " vries at gcc dot gnu.org
2024-03-21  9:04 ` vries at gcc dot gnu.org
2024-03-21  9:05 ` vries at gcc dot gnu.org
2024-03-21  9:49 ` vries at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).