This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug breakpoints/10645] New: Watchpoints on unreadable memory need no singlestepping


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]