From: Pedro Alves <palves@redhat.com>
To: Antoine Tremblay <antoine.tremblay@ericsson.com>,
gdb-patches@sourceware.org, Yao Qi <qiyaoltc@gmail.com>
Subject: Re: [PATCH v2 4/7] Support breakpoint kinds for software breakpoints in GDBServer.
Date: Fri, 16 Oct 2015 19:04:00 -0000 [thread overview]
Message-ID: <56214A33.5060109@redhat.com> (raw)
In-Reply-To: <56213D20.8090803@ericsson.com>
On 10/16/2015 07:08 PM, Antoine Tremblay wrote:
> I see what you mean more clearly now.
>
> I like the idea to treat only in kinds but I'm not sure about the
> advantage in terms of clarity.
The main advantage is that it eliminates the redundant info
in the breakpoint structures fields. I really see no reason for every
breakpoint to have to carry around a pointer to the opcode to use,
since that's a property that can be inferred from other fields.
Less redundancy means fewer chances of things getting out of sync.
>
> I would say it's debatable like you said in the end result is not any
> less clear but the current implementation doesn't seem less clear to me
> either.
>
> I do not like the detour we need to make when we do not have a real
> reason to have a kind, adding a "fake" unique kind and having to add
> breakpoint_from_kind implementations on all architectures, not just the
> ones that support software breakpoints. (Regardless of the patch size).
>
The default implementation of breakpoint_from_pc can simply be:
int
default_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
{
/* Most architectures have only one kind of software breakpoint. */
return 0;
}
and then most architectures would just implement the
breakpoint_from_kind method simply as:
static gdb_byte *
arch_breakpoint_from_kind (int kind /* ignored, there's only one */)
{
return arch_breakpoint;
}
which is quite like what you already wrote.
That is, most architectures only have one 'kind' of breakpoint,
so they can ignore the parameter. Just like in your breakpoint_from_pc
hook, most archs would ignore the length.
Note that there's always a need to implement _one_ hook on all
architecture. In your version, it's the breakpoint_from_pc hook.
In my suggestion, it's breakpoint_from_kind. But it's the same
number of "hooks x architectures implementations".
> Also even if we can call functions to get the size and opcode when
> needed, it still seems like since those values do not change for the
> life of the breakpoint and that they can be set only once from a
> meaningful context it's perfectly acceptable and more clear to set them
> once and avoid this level of abstraction to access these values.
I don't buy that. The opcode to use for a particular mode can be
determined from that info alone ("which mode"), and as such doesn't
need to be stored on every breakpoint. If you look at it from the
other angle, you can see it as factorization.
> At this point I could do either but to avoid redoing the patch set
> multiple times, I would like to ask for Yao's opinion and I will work on
> the consensual option.
Fair enough.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2015-10-16 19:04 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-05 16:44 [PATCH v2 0/7] Software breakpoints support for ARM linux " Antoine Tremblay
2015-10-05 16:44 ` [PATCH v2 6/7] Refactor the breakpoint definitions in linux-arm-low.c Antoine Tremblay
2015-10-15 16:07 ` Pedro Alves
2015-10-16 12:14 ` Yao Qi
2015-10-05 16:44 ` [PATCH v2 4/7] Support breakpoint kinds for software breakpoints in GDBServer Antoine Tremblay
2015-10-15 15:51 ` Pedro Alves
2015-10-15 18:02 ` Antoine Tremblay
2015-10-16 16:06 ` Pedro Alves
2015-10-16 18:08 ` Antoine Tremblay
2015-10-16 19:04 ` Pedro Alves [this message]
2015-10-16 19:23 ` Antoine Tremblay
2015-10-16 19:44 ` Antoine Tremblay
2015-10-16 19:48 ` Antoine Tremblay
2015-10-19 9:35 ` Pedro Alves
2015-10-19 11:48 ` Antoine Tremblay
2015-10-05 16:44 ` [PATCH v2 3/7] Implement breakpoint_from_kind for supported architectures " Antoine Tremblay
2015-10-15 9:19 ` Yao Qi
2015-10-15 10:57 ` Antoine Tremblay
2015-10-15 17:13 ` Antoine Tremblay
2015-10-05 16:44 ` [PATCH v2 2/7] Add breakpoint_from_kind target_ops for software breakpoints " Antoine Tremblay
2015-10-15 9:04 ` Yao Qi
2015-10-15 10:50 ` Antoine Tremblay
2015-10-15 9:10 ` Yao Qi
2015-10-15 10:37 ` Antoine Tremblay
2015-10-15 15:34 ` Pedro Alves
2015-10-15 17:07 ` Antoine Tremblay
2015-10-05 16:44 ` [PATCH v2 5/7] Implement breakpoint_from_pc for ARM " Antoine Tremblay
2015-10-15 16:07 ` Pedro Alves
2015-10-15 18:06 ` Antoine Tremblay
2015-10-05 16:44 ` [PATCH v2 7/7] Support software breakpoints for ARM linux " Antoine Tremblay
2015-10-05 17:00 ` Eli Zaretskii
2015-10-15 16:07 ` Pedro Alves
2015-10-15 18:24 ` Antoine Tremblay
2015-10-15 18:33 ` Pedro Alves
2015-10-15 18:59 ` Antoine Tremblay
2015-10-16 9:33 ` Yao Qi
2015-10-16 12:11 ` Pedro Alves
2015-10-16 12:24 ` Yao Qi
2015-10-16 12:21 ` Yao Qi
2015-10-05 16:44 ` [PATCH v2 1/7] Add breakpoint_from_pc target_ops for software breakpoints " Antoine Tremblay
2015-10-15 8:27 ` Yao Qi
2015-10-15 15:33 ` Pedro Alves
2015-10-15 15:58 ` Antoine Tremblay
2015-10-15 17:05 ` Antoine Tremblay
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=56214A33.5060109@redhat.com \
--to=palves@redhat.com \
--cc=antoine.tremblay@ericsson.com \
--cc=gdb-patches@sourceware.org \
--cc=qiyaoltc@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