From: Pedro Alves <pedro@palves.net>
To: Lancelot SIX <lsix@lancelotsix.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v3 2/2] gdb: Support stepping out from signal handler on riscv*-linux
Date: Thu, 8 Jul 2021 13:34:50 +0100 [thread overview]
Message-ID: <494f4cab-73c9-794f-1ae0-41e1cf7018c0@palves.net> (raw)
In-Reply-To: <20210708121135.kfup4tj4ewjh55mr@ubuntu.lan>
On 2021-07-08 1:11 p.m., Lancelot SIX wrote:
> On Thu, Jul 08, 2021 at 11:49:02AM +0000, Lancelot SIX via Gdb-patches wrote:
>>>> @@ -3826,6 +3831,11 @@ riscv_next_pc (struct regcache *regcache, CORE_ADDR pc)
>>>> if (src1 >= src2)
>>>> next_pc = pc + insn.imm_signed ();
>>>> }
>>>> + else if (insn.opcode () == riscv_insn::ECALL)
>>>> + {
>>>> + if (tdep->syscall_next_pc != nullptr)
>>>> + next_pc = tdep->syscall_next_pc (get_current_frame ());
>>>
>>>
>>> else
>>> next_pc += 4;
>>>
>>> ?
>>
>> OK, I’ll change that.
>
> Actually, no. I was a bit fast reading your comment and thought we
> where in the riscv_syscall_nexc_pc function.
>
> The function is currently implemented as:
>
> static CORE_ADDR
> riscv_next_pc (struct regcache *regcache, CORE_ADDR pc)
> {
> struct riscv_insn insn;
> CORE_ADDR next_pc
> insn.decode (gdbarch, pc);
> next_pc = pc + insn.length (); // <--- The default case is already handled here
>
> /* a bunch of ifs that can assign a new value to next_pc. */
> if (insn.opcode() == …)
> next_pc = …
> else if (insn.opcode() == …)
> next_pc = …
> […]
>
> return next_pc;
> }
>
> To make it clearer, the 'next_pc = pc + insn.length ();' statement could
> be the one to go in a final “catchall” else where you proposed to add
> the '+= 4' (note that when using the compressed instruction set,
> instructions can have a size of 2 bytes).
Ah, OK, sorry, I should have looked at the code instead of assuming.
Thanks for double checking.
next prev parent reply other threads:[~2021-07-08 12:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-07 0:30 [PATCH v3 0/2] Fix gdb.base/sigstep.exp for riscv64-linux Lancelot SIX
2021-07-07 0:30 ` [PATCH v3 1/2] gdb/testsuite: Declare that riscv*-*-linux* cannot hardware_single_step Lancelot SIX
2021-07-08 10:00 ` Pedro Alves
2021-07-07 0:30 ` [PATCH v3 2/2] gdb: Support stepping out from signal handler on riscv*-linux Lancelot SIX
2021-07-08 10:00 ` Pedro Alves
2021-07-08 11:49 ` Lancelot SIX
2021-07-08 12:11 ` Lancelot SIX
2021-07-08 12:34 ` Pedro Alves [this message]
2021-07-07 21:01 ` [PATCH v3 0/2] Fix gdb.base/sigstep.exp for riscv64-linux Jim Wilson
2021-07-07 22:55 ` Lancelot SIX
2021-07-08 1:32 ` Jim Wilson
2021-07-08 9:44 ` Pedro Alves
2021-07-08 11:59 ` Lancelot SIX
2021-07-08 15:24 ` Jim Wilson
2021-07-16 22:13 ` Lancelot SIX
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=494f4cab-73c9-794f-1ae0-41e1cf7018c0@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
--cc=lsix@lancelotsix.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).