This is the mail archive of the gdb@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]

Re: Why no hwatch command in gdb ?


Hi Robert,

On Thu, 10 Mar 2011 13:18:06 +0100, robert song wrote:
> Well, I am confused with the gdb hardware watchpoint support in x86
> arch.

x86* is special as its debug registers capabilities are complicated - it can
watch 1/2/4/8 bytes and there are 4 of them.  GDB supports aliasing, so if you
watch string[0] and string[1] GDB will merge it and will watch 2 bytes at
&string[0].

Upper layers GDB do not support any target-specific watchpoint tricks, so i386
pretends it can always merge them somehow - and if it latter cannot it will
fail.  See i386_can_use_hw_breakpoint.


> I tested it in a ARM board. Now the kernel can support up to 1
> hardware watchpoint and 6 hardware breakpoints.

As ARM does suppors only a single register size the aliasing does not need to
be supported on ARM, therefore the hardware watchpoints count limitations
works on ARM (in general, I do not know ARM).


> Firstly, before the program run, we can not set the hardware breakpoint.
...
> But in x86, I took a look at my CentOS 5.5 7.0.1-23.el5.
> We can set the hardware breakpoint before program runs, it's not the
> standard gdb function. There is a patch named
> gdb-bz541866-rwatch-before-run.patch, in the patch,
> target_can_use_hardware_watchpoint is forced to be 1.

http://pkgs.fedoraproject.org/gitweb/?p=gdb.git;a=blob;f=gdb-bz541866-rwatch-before-run.patch;hb=f15/master

FSF GDB started to disallow hardware watchpoints such as `awatch'/`rwatch'
since one point.  As it was considered a regression by the users I had to
"temporarily" revert the upstream change and put there the older hack.
The watchpoints framework needs to be improved to support this a sane way.


> So the problem is because of the previous patch of this distribution
> ?????

I do not know on which arch which specific problem you want to solve now.


Thanks,
Jan


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