public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Jan Vrany <jan.vrany@fit.cvut.cz>
To: gdb@sourceware.org
Subject: How to get past ebreak instruction on RISC-V
Date: Tue, 12 Jan 2021 16:07:45 +0000	[thread overview]
Message-ID: <8c7f5386d98b278267611a9a78aea0a0cb5966f3.camel@fit.cvut.cz> (raw)

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! 

Best, Jan


             reply	other threads:[~2021-01-12 16:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12 16:07 Jan Vrany [this message]
2021-01-12 16:15 ` Simon Marchi
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=8c7f5386d98b278267611a9a78aea0a0cb5966f3.camel@fit.cvut.cz \
    --to=jan.vrany@fit.cvut.cz \
    --cc=gdb@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).