Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: Antoine Tremblay <antoine.tremblay@ericsson.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 09:55:00 -0000	[thread overview]
Message-ID: <867fna98d3.fsf@gmail.com> (raw)
In-Reply-To: <1442577749-6650-3-git-send-email-antoine.tremblay@ericsson.com>	(Antoine Tremblay's message of "Fri, 18 Sep 2015 08:02:26 -0400")

Antoine Tremblay <antoine.tremblay@ericsson.com> writes:

> @@ -774,8 +800,9 @@ set_breakpoint_at (CORE_ADDR where, int (*handler) (CORE_ADDR))
>  {
>    int err_ignored;
>  
> +  /* default breakpoint_len will be initialized downstream.  */
>    return set_breakpoint (other_breakpoint, raw_bkpt_type_sw,
> -			 where, breakpoint_len, handler,
> +			 where, 0, handler,
>  			 &err_ignored);
>  }

Why do you set breakpoint length to zero?  I know you'll set the length
downstream properly, but we should compute the breakpoint length here.

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?

-- 
Yao (齐尧)


  reply	other threads:[~2015-09-28  9:55 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 [this message]
2015-09-28 10:05     ` Eli Zaretskii
2015-09-28 21:01       ` Antoine Tremblay
2015-09-28 20:59     ` Antoine Tremblay
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
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 4/5] Handle breakpoint kinds for software breakpoints " Antoine Tremblay
2015-09-28 10:33   ` Yao Qi
2015-09-29 11:55     ` 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=867fna98d3.fsf@gmail.com \
    --to=qiyaoltc@gmail.com \
    --cc=antoine.tremblay@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    /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