From: Simon Marchi <simon.marchi@polymtl.ca>
To: Jan Vrany <jan.vrany@fit.cvut.cz>, gdb@sourceware.org
Subject: Re: How to get past ebreak instruction on RISC-V
Date: Tue, 12 Jan 2021 11:15:37 -0500 [thread overview]
Message-ID: <78fcfd1f-4beb-85c2-acf0-c0231fd8c3e7@polymtl.ca> (raw)
In-Reply-To: <8c7f5386d98b278267611a9a78aea0a0cb5966f3.camel@fit.cvut.cz>
On 2021-01-12 11:07 a.m., Jan Vrany wrote:
> Hi,
>
> I'm working on RISC-V compiler. To ease debugging of compiled code
> I'm inserting `ebreak` instruction to interesting place (entry/exit
> points or as a placeholder for unimplemented features).
>
> For example, the code might look like:
>
> (gdb) disas 0x0000003FD6A36024, 0x0000003FD6A36048
> Dump of assembler code from 0x3fd6a36024 to 0x3fd6a36048:
> => 0x0000003fd6a36024: ebreak
> 0x0000003fd6a36028: sd ra,-8(s11)
> 0x0000003fd6a3602c: addi s11,s11,-16
> 0x0000003fd6a36030: ld t3,80(s10)
> 0x0000003fd6a36034: addiw a0,zero,42
> 0x0000003fd6a36038: addi s11,s11,16
> 0x0000003fd6a3603c: ret
> 0x0000003fd6a36040: blt s11,t3,0x3fd6a36000
> 0x0000003fd6a36044: ebreak
> End of assembler dump.
> (gdb)
>
> When compiled function is (attempted to) run, it stops on `ebreak`
> as expected:
>
> Thread 2 "main" received signal SIGTRAP, Trace/breakpoint trap.
> [Switching to Thread 0x3ff7e681e0 (LWP 428777)]
> 0x0000003fd6a36024 in ?? ()
>
> How can I get past the `ebreak` so I can `stepi` thought the following
> instructions and debug? Thanks!
I suppose you could do "set $pc = 0x3fd6a36028". But really this is
something that GDB should be doing automatically, adjusting the PC
after hitting that style of breakpoint.
Simon
next prev parent reply other threads:[~2021-01-12 16:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-12 16:07 Jan Vrany
2021-01-12 16:15 ` Simon Marchi [this message]
2021-01-12 16:56 ` Andrew Burgess
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=78fcfd1f-4beb-85c2-acf0-c0231fd8c3e7@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb@sourceware.org \
--cc=jan.vrany@fit.cvut.cz \
/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).