From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: pedro@codesourcery.com (Pedro Alves)
Cc: emachado@linux.vnet.ibm.com (Edjunior Barbosa Machado),
gdb-patches@sourceware.org
Subject: Re: Watchpoint resource accounting broken (Re: [5/6] breakpoints_ops for all kinds of breakpoints: new watchpoints instance type
Date: Tue, 13 Sep 2011 16:49:00 -0000 [thread overview]
Message-ID: <201109131522.p8DFMg93032568@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <201109131355.11485.pedro@codesourcery.com> from "Pedro Alves" at Sep 13, 2011 01:55:11 PM
Pedro Alves wrote:
> Does the patch below work? Never consider the current watchpoint when
> going over the breakpoint list counting resources, and then
> add the resources of the current watchpoint on top. This way we
> don't have to care of the current watchpoint being on the list yet or
> not. As bonus, we no longer have to frog the watchpoint's type before
> knowing if it'll fit.
Yes, this patch looks good to me, and does fix the problem I've
been seeing. Thanks!
> On Monday 12 September 2011 16:16:53, Edjunior Barbosa Machado wrote:
> > I noticed this problem too and was considering use "i + reg_cnt" instead
> > of only "i" when calling hw_watchpoint_used_count() (actually, I saw gdb
> > used to use this previously).
> > However, with this change, due to the same problem with the watchpoint
> > added to breakpoint list that Ulrich mentioned, watchpoints added before
> > run the inferior will not work.
>
> Can you expand on this? I don't think I'm understanding that problem.
In addition to what Edjunior replied, this reminds me that there is now
some unnecessary code duplication in the can_use_hardware_watchpoint
routine:
reg_cnt = can_use_hardware_watchpoint (val_chain);
[snip]
/* Add in the resources needed for B. */
i += hw_watchpoint_use_count (&b->base);
The return value of this hw_watchpoint_use_count call ought to be
always equal to reg_cnt; and in fact the whole logic in
can_use_hardware_watchpoint ought to be redundant with what
update_watchpoint does anyway.
However, this is not completely true:
1. can_use_hardware_watchpoint respects the can_use_hw_watchpoints flag
2. can_use_hardware_watchpoint takes note of sub-expressions that
cannot be implemented via HW watchpoints (e.g. lval_register)
[ -- this seems to be incomplete anyway these days ]
It seems to me that it would be preferable to integrate these missing
checks into the code in update_watchpoint, and then remove the
can_use_hardware_watchpoint routine ...
[ But that's clearly a follow-on cleanup, and shouldn't prevent your
bug-fix patch from going in now. ]
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
next prev parent reply other threads:[~2011-09-13 15:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-22 15:58 Pedro Alves
2011-07-27 10:11 ` Edjunior Barbosa Machado
2011-09-12 15:06 ` Watchpoint resource accounting broken (Re: [5/6] breakpoints_ops for all kinds of breakpoints: new watchpoints instance type) Ulrich Weigand
2011-09-12 15:17 ` Pedro Alves
2011-09-12 15:23 ` Edjunior Barbosa Machado
2011-09-13 14:16 ` Pedro Alves
2011-09-13 14:42 ` Edjunior Barbosa Machado
2011-09-13 14:54 ` Pedro Alves
2011-09-13 16:49 ` Ulrich Weigand [this message]
2011-09-13 17:20 ` Watchpoint resource accounting broken (Re: [5/6] breakpoints_ops for all kinds of breakpoints: new watchpoints instance type Pedro Alves
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=201109131522.p8DFMg93032568@d06av02.portsmouth.uk.ibm.com \
--to=uweigand@de.ibm.com \
--cc=emachado@linux.vnet.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.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