RFC: Hardware watchpoint register support for mips-linux.

David Daney ddaney@avtrex.com
Mon Apr 21 19:46:00 GMT 2008


This patch adds support for hardware watchpoint registers present in
some mips processors.  I consider it a very rough first version of the
patch as there are several things missing before it would be fully
functional.  However it is sufficient to demonstrate that the kernel
support is working.

Notes about the patch:

* Corresponding Linux kernel support is needed.  I will post the
corresponding patches to linux-mips.org shortly.
* The patch is against gdb 6.8.
* I need to add the thread creation hook so new threads install the
watch registers.
* Logic to cover large regions of memory is missing.
* The mips specific code should probably be moved to more generic place
with only linux specific implementations in mips-linux-nat.c as is done
with i386.
* Hardware breakpoints are not yet supported.  Since the smallest region
covers two instructions, I was not sure how to implement it.
* Probably there are other issues I have not addressed yet.

Comments are welcome.

2008-04-21  David Daney  <ddaney@avtrex.com>

    * config/mips/linux.mh (NAT_FILE): Change to nm-linux.h.
    * config/mips/nm-linux.h: New file.
    * infrun.c (handle_inferior_event): Use software single step when
    target requires it.
    * mips-linux-nat.c:  Include command.h and gdbcmd.h.
    (maint_show_dr): New variable.
    (PTRACE_GET_WATCH_REGS): New macro.
    (PTRACE_SET_WATCH_REGS): Same.
    (enum pt_watch_style): Define.
    (struct mips32_watch_regs): Define.
    (struct pt_watch_regs): Define.
    (MAX_DEBUG_REGISTER): New macro.
    (watch_mirror): New variable.
    (mips_show_dr, mips_linux_can_use_hardware_watchpoint,
    mips_linux_stopped_data_address, mips_linux_stopped_by_watchpoint,
    mips_linux_region_ok_for_watchpoint, watchlo_val,
    write_watchpoint_regs, mips_linux_insert_watchpoint,
    mips_linux_remove_watchpoint): New functions.
    (_initialize_mips_linux_nat): Register show-debug-regs maintenance
    command.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdb.patch
Type: text/x-patch
Size: 10328 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20080421/c2741e3c/attachment.bin>


More information about the Gdb-patches mailing list