[RFC] Add hardware breapoints in procfs.c

Joel Brobecker brobecker@adacore.com
Fri May 15 15:51:00 GMT 2009


> >  	* procfs.c (procfs_insert_hw_breakpoint, procfs_remove_hw_breakpoint):
> >  	New functions.
> >  	(procfs_use_watchpoints): Register new hardware breakpoint related
> >  	target functions.
> 
> I don't know procfs enough to review the patch accurately. I think
> that the part for removing the watchpoint is correct

Actually, target_insert/remove_hw_breakpoint are supposed to return
non-zero if the operation failed. However, if you look at the implementation
of procfs_set_watchpoint:

    procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rwflag,
                           int after)
    {
    #ifndef UNIXWARE
    #ifndef AIX5
    [...]
    #endif /* AIX5 */
    #endif /* UNIXWARE */
      return 0;
    }

In other words, if h/w watchpoints are not supported, this function
returns zero.  Use that directly to insert h/w breakpoints on a system
where this feature is not implemented would lead the debugger to think
that the breakpoint was inserted when in fact it wasn't.

-- 
Joel



More information about the Gdb-patches mailing list