public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/10645] New: Watchpoints on unreadable memory need no singlestepping
@ 2009-09-16 17:59 jan dot kratochvil at redhat dot com
  2009-09-16 18:00 ` [Bug breakpoints/10645] " jan dot kratochvil at redhat dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: jan dot kratochvil at redhat dot com @ 2009-09-16 17:59 UTC (permalink / raw)
  To: gdb-prs

Currently GDB drops on unreadable watchpoint to PTRACE_SINGLESTEP.

It can use PTRACE_SYSCALL as any new memory area can appear at VMA only by a
syscall.
kernel feature:
Better would be to setup address-specific mmap() trap (by prctl()?) or if kernel
would trigger DR debug registers on their hit by mmap().

Similar problem is about disappearing memory when inferior already runs with
PTRACE_CONT.  Currently GDB would have to always PTRACE_SYSCALL if any hardware
watchpoint is active.
kernel feature:
That would be better trapped by kernel on munmap() possibly checking the x86 DR
debug registers at the kernel level.

Feature is useful with default "set disable-randomization on" to watch memory
objects since the beginning of debuggee re-run (sort of record-replay by hand).

One should check also the case of `int **p = NULL;' with `watch **p'.

------------------------------------------------------------------------------
static int i, *p;
int main (void) {
  i = 1;
  i = 2;
  p = (void *) main;
  return 0;
}
------------------------------------------------------------------------------
(gdb) start
3	  i = 1;
(gdb) set debug infrun 1
(gdb) watch *p
Watchpoint 2: *p
(gdb) c
Continuing.
infrun: clear_proceed_status_thread (process 30884)
infrun: proceed (addr=0xffffffffffffffff, signal=144, step=0)
infrun: resume (step=1, signal=0), trap_expected=0
                     ^ step should be 0
PTRACE_SYSCALL should be used here, not PTRACE_SINGLESTEP.
[...]
Watchpoint 2: *p
Old value = <unreadable>
New value = -443987883
main () at /tmp/hwwatch.c:6
6	  return 0;
------------------------------------------------------------------------------

-- 
           Summary: Watchpoints on unreadable memory need no singlestepping
           Product: gdb
           Version: 6.8
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: breakpoints
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: jan dot kratochvil at redhat dot com
                CC: gdb-prs at sourceware dot org,jakub at redhat dot com
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=10645

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 11+ messages in thread
[parent not found: <bug-10645-4717@http.sourceware.org/bugzilla/>]

end of thread, other threads:[~2024-01-07 13:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-16 17:59 [Bug breakpoints/10645] New: Watchpoints on unreadable memory need no singlestepping jan dot kratochvil at redhat dot com
2009-09-16 18:00 ` [Bug breakpoints/10645] " jan dot kratochvil at redhat dot com
2009-09-23 14:45 ` jan dot kratochvil at redhat dot com
2009-09-23 14:46 ` jan dot kratochvil at redhat dot com
2009-11-30 16:36 ` dragos dot tatulea at gmail dot com
2009-11-30 16:37 ` dragos dot tatulea at gmail dot com
2009-11-30 17:29 ` jan dot kratochvil at redhat dot com
2010-07-26 21:03 ` dragos dot tatulea at gmail dot com
2010-08-26 14:11 ` ppluzhnikov at google dot com
     [not found] <bug-10645-4717@http.sourceware.org/bugzilla/>
2011-07-31 19:09 ` ppluzhnikov at google dot com
2024-01-07 13:33 ` ssbssa at sourceware dot 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).