public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Antoine Tremblay <antoine.tremblay@ericsson.com>
To: Eli Zaretskii <eliz@gnu.org>, Yao Qi <qiyaoltc@gmail.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH 2/5] Make breakpoint and breakpoint_len local variables in GDBServer.
Date: Mon, 28 Sep 2015 21:01:00 -0000	[thread overview]
Message-ID: <5609AAA5.5020707@ericsson.com> (raw)
In-Reply-To: <83a8s6eu55.fsf@gnu.org>



On 09/28/2015 06:05 AM, Eli Zaretskii wrote:
>> From: Yao Qi <qiyaoltc@gmail.com>
>> Cc: <gdb-patches@sourceware.org>
>> Date: Mon, 28 Sep 2015 10:54:48 +0100
>>
>> After thinking about it a bit more, I think this reveals some design
>> issues in GDBserver brekapoint, nowadays, GDBserver inserts its own
>> breakpoints and breakpoints requested by GDB.  After this patch series,
>> GDBserver should be able to:
>>
>>    1) choose the right breakpoint instruction for its own breakpoints,
>>    according to the breakpoint address, status register flag, etc,
>>    through API set_breakpoint_at,
>>    2) choose the right breakpoint instruction for breakpoints requested
>>    by GDB, according to the information in Z packets, through API
>>    set_gdb_breakpoint
>>
>> there should be two paths for them, and each path needs different target
>> hook to choose breakpoint instructions.  breakpoint_from_pc is needed for
>> #1, and breakpoint_from_length is needed for #2.  In your current patch
>> set (in patch 4/5), two things are mixed together, which doesn't look
>> good to me.  The current functions calls in GDBserver to create
>> breakpoint is like
>>
>>    set_breakpoint_at
>>    set_gdb_breakpoint_1
>>       |
>>       `--> set_breakpoint
>>               |
>>               `-->set_raw_breakpoint_at
>>                      |
>>                      `--> the_target->insert_point
>>
>> we are handling the breakpoint length at the lowest level, in
>> insert_memory_breakpoint, and we use breakpoint_from_pc and
>> breakpoint_from_length together there, which looks unclean.  Ideally, we
>> can move these code handling breakpoint length (breakpoint_from_pc and
>> breakpoint_from_length) to upper levels, like this,
>>
>>    set_breakpoint_at (call breakpoint_from_pc)
>>    set_gdb_breakpoint_1 (call breakpoint_from_length)
>>       |
>>       `--> set_breakpoint
>>               |
>>               `-->set_raw_breakpoint_at
>>                      |
>>                      `--> the_target->insert_point
>>
>> all needed information is saved in struct breakpoint or struct
>> raw_breakpoint, and function set_breakpoint and it callees can use
>> breakpoint or raw_breakpoint directly.  It'll be cleaner in this way,
>> let me know what do you think?
>
> Sometimes only the target layer knows how to choose the length
> correctly.  Are we sure this isn't one of those cases, and can never
> be?
>

breakpoint_from_pc and breakpoint_from_length are target ops so indeed 
only the target knows but it's ok we can query the target properly.

  reply	other threads:[~2015-09-28 21:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-18 12:02 [PATCH 0/5] Software breakpoints support for ARM linux Antoine Tremblay
2015-09-18 12:02 ` [PATCH 2/5] Make breakpoint and breakpoint_len local variables in GDBServer Antoine Tremblay
2015-09-28  9:55   ` Yao Qi
2015-09-28 10:05     ` Eli Zaretskii
2015-09-28 21:01       ` Antoine Tremblay [this message]
2015-09-28 20:59     ` Antoine Tremblay
2015-09-18 12:03 ` [PATCH 4/5] Handle breakpoint kinds for software breakpoints " Antoine Tremblay
2015-09-28 10:33   ` Yao Qi
2015-09-29 11:55     ` Antoine Tremblay
2015-09-18 12:03 ` [PATCH 3/5] Add support for ARM breakpoint types " Antoine Tremblay
2015-09-28 10:29   ` Yao Qi
2015-09-28 21:26     ` Antoine Tremblay
2015-09-29  8:32       ` Yao Qi
2015-09-29 11:38         ` Antoine Tremblay
2015-09-29 11:43           ` Yao Qi
2015-09-18 12:03 ` [PATCH 5/5] Support software breakpoints for ARM linux " Antoine Tremblay
2015-09-18 12:03 ` [PATCH 1/5] Support multiple breakpoint types per target " Antoine Tremblay
2015-09-23 10:51   ` Yao Qi
2015-09-23 12:37     ` Antoine Tremblay
2015-09-23 14:46       ` Yao Qi
2015-09-23 14:56         ` 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=5609AAA5.5020707@ericsson.com \
    --to=antoine.tremblay@ericsson.com \
    --cc=eliz@gnu.org \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).