Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: robert song <robertsong.japan@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: Why no hwatch command in gdb ?
Date: Thu, 10 Mar 2011 13:45:00 -0000	[thread overview]
Message-ID: <20110310134453.GA11068@host1.jankratochvil.net> (raw)
In-Reply-To: <AANLkTi=SB2twFS4bLURaffoaO25-N7OFwB+nz7w7mjyZ@mail.gmail.com>

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


  reply	other threads:[~2011-03-10 13:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-10  7:25 robert song
2011-03-10  8:12 ` Jan Kratochvil
2011-03-10 10:09   ` robert song
2011-03-10 10:34     ` Jan Kratochvil
2011-03-10 11:26       ` Eli Zaretskii
2011-03-10 11:34         ` Joel Brobecker
2011-03-10 12:27           ` Pedro Alves
2011-03-10 11:55         ` Jan Kratochvil
2011-03-10 14:47           ` Frank Ch. Eigler
2011-03-10 12:18       ` robert song
2011-03-10 13:45         ` Jan Kratochvil [this message]
2011-03-10 14:47           ` Philippe Waroquiers
2011-03-10 21:04             ` Tom Tromey
2011-03-11  7:58               ` Philippe Waroquiers
2011-03-11 17:48           ` Daniel Jacobowitz
2011-03-10  8:23 paawan oza

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110310134453.GA11068@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=robertsong.japan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox