RFC: Hardware watchpoint register support for mips-linux.

David Daney ddaney@avtrex.com
Tue Apr 29 03:47:00 GMT 2008


David Daney wrote:
> 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.
>   
I changed the layout of the structures used by ptrace to set the watch
registers in the new version of the kernel patch (posted soon to
linux-mips.org), so here is the corresponding gdb patch.

It is identical to the previous version except for the structure
layout.  My plan is to improve the gdb patch once the Linux kernel patch
gains acceptance.

The change log is the same as the previous version.

David Daney
-------------- 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/20080429/00dd67db/attachment.bin>


More information about the Gdb-patches mailing list