Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Antoine Tremblay <antoine.tremblay@ericsson.com>
To: Tim Newsome <tim@sifive.com>
Cc: gdb <gdb@sourceware.org>
Subject: Re: read target register to decide breakpoint size
Date: Mon, 21 Nov 2016 16:37:00 -0000	[thread overview]
Message-ID: <wwok1sy4zt6d.fsf@ericsson.com> (raw)
In-Reply-To: <CAGDihemd3g3_ropX=Y-wWSeyWBbH-sCA6FDX2FaTwKP8e-3Nng@mail.gmail.com>


Tim Newsome writes:

> I'm still working on RISC-V support for gdb. Any given RISC-V core may
> support a compressed instruction set (2 bytes per instruction as
> opposed to 4). There are corresponding 2-byte and 4-byte breakpoint
> instructions. On cores that support the compressed instruction set it
> is safe to just always use the 2-byte version, and there is a register
> I can read to tell me whether the compressed instruction set is
> supported. What I would like to do is read (and cache) that register
> when breakpoint size is determined. That seems more robust than making
> a decision based on ELF info, which may not reflect what is actually
> being executed.
>
> Is that a good idea? Are there examples of operations that read target
> registers to complete?

Yes actually you can check how ARM does it, it has the same kind of
problem with 3 breakpoints you can set for thumb, thumb2 and arm
instruction sets.

See arm-tdep.c:arm_sw_breakpoint_from_kind and
arm_breakpoint_kind_from_current_state

This is called in breakpoint.c:breakpoint_kind and it can use a register
to make the decision from the current state of that register.

So possibly just implementing the sw_breakpoint_from_kind and
breakpoint_kind_from_current state would be ok your you.

Regards,
Antoine Tremblay


  parent reply	other threads:[~2016-11-21 16:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-18 23:44 Tim Newsome
2016-11-19  1:16 ` Ofir Cohen
2016-11-21 16:37 ` Antoine Tremblay [this message]
2016-11-21 18:00   ` Tim Newsome
2016-12-13 20:58     ` Tim Newsome
2016-12-13 21:30       ` Tim Newsome
2016-12-14  9:18         ` Yao Qi
2016-12-14 12:32           ` Antoine Tremblay
2016-12-14 17:02             ` Tim Newsome
2016-12-14 17:22               ` Yao Qi
2016-12-14 18:15                 ` 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=wwok1sy4zt6d.fsf@ericsson.com \
    --to=antoine.tremblay@ericsson.com \
    --cc=gdb@sourceware.org \
    --cc=tim@sifive.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