public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>
To: Shahab Vahedi <shahab.vahedi@gmail.com>,
	"gdb@sourceware.org" <gdb@sourceware.org>
Cc: Simon Marchi <simark@simark.ca>,
	Luis Machado <luis.machado@linaro.org>,
	Shahab Vahedi <shahab@synopsys.com>
Subject: RE: Why enforcing sw_breakpoint_from_kind() implementation in GDBserver targets
Date: Fri, 12 Jun 2020 11:04:08 +0000	[thread overview]
Message-ID: <SN6PR11MB2893A094069EB468794DA0B7C4810@SN6PR11MB2893.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20200611114418.GE1270@gmail.com>

On Thursday, June 11, 2020 1:44 PM, Shahab Vahedi wrote:
> Hi Tankut,
> 
> It'd be great if we could have your feedback on this too.
> 
> Cheers,
> Shahab

Hi,

Before the gdbserver target definitions were converted into C++ classes,
the `sw_breakpoint_from_kind` target op in linux-low was defined as follows
(the code snippet is from gdb 9.1):

  /* Implementation of the target_ops method "sw_breakpoint_from_kind".  */

  static const gdb_byte *
  linux_sw_breakpoint_from_kind (int kind, int *size)
  {
    gdb_assert (the_low_target.sw_breakpoint_from_kind != NULL);

    return (*the_low_target.sw_breakpoint_from_kind) (kind, size);
  }

So, the base linux target delegates the op to the low target and enforces
an implementation.

The `sw_breakpoint_from_kind` target op is invoked in linux_wait_1 as follows:

  if (step_over_bkpt != null_ptid
      && event_child->stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT
      && (event_child->stepping
          || !single_step_breakpoint_inserted_here (event_child->stop_pc)))
    {
      ... 
      breakpoint_kind =
        the_target->breakpoint_kind_from_current_state (&stop_pc);
      the_target->sw_breakpoint_from_kind (breakpoint_kind, &increment_pc);
      ...
    }

There are two additional uses in mem-break.c, in bp_size and bp_opcode, which are used
in several functions in mem-break.c.  These uses as well as the one from linux_wait_1
above do not guard against whether the target op is implemented.  Therefore it had made
sense to enforce that the target op is implemented by the linux low target by making it
pure virtual.  All the linux low targets except ia64 implemented the
`sw_breakpoint_from_kind` target op.

Regards
-Baris


Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

  reply	other threads:[~2020-06-12 11:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-10 17:47 Shahab Vahedi
2020-06-11  3:05 ` Simon Marchi
2020-06-11  9:40   ` Shahab Vahedi
2020-06-11 10:35     ` Luis Machado
2020-06-11 11:00       ` Shahab Vahedi
2020-06-11 11:44         ` Shahab Vahedi
2020-06-12 11:04           ` Aktemur, Tankut Baris [this message]
2020-06-15 10:39             ` Shahab Vahedi
2020-06-16 13:15               ` Aktemur, Tankut Baris
2020-06-17 21:31                 ` Shahab Vahedi
2020-06-17 22:20                   ` Luis Machado
2020-06-11 14:51         ` Simon Marchi
2020-06-15  8:54           ` Metzger, Markus T
2020-06-17  0:40             ` Maciej W. Rozycki
2020-06-18  8:11               ` Metzger, Markus T
2020-06-18  9:13                 ` Maciej W. Rozycki
2020-06-18 10:29                   ` Metzger, Markus T
2020-06-18 11:03                     ` Maciej W. Rozycki
2020-06-18 11:11                       ` Metzger, Markus T
2020-06-11 21:21 ` Martin Simmons

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=SN6PR11MB2893A094069EB468794DA0B7C4810@SN6PR11MB2893.namprd11.prod.outlook.com \
    --to=tankut.baris.aktemur@intel.com \
    --cc=gdb@sourceware.org \
    --cc=luis.machado@linaro.org \
    --cc=shahab.vahedi@gmail.com \
    --cc=shahab@synopsys.com \
    --cc=simark@simark.ca \
    /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).