From: Jan Vrany <jan@vrany.io>
To: GDB mailing list <gdb@sourceware.org>
Subject: Hand-written assembly and Python API
Date: Fri, 29 Apr 2022 12:32:49 +0000 [thread overview]
Message-ID: <5dce3fb2110facb58974d1ee546c43b6db20b6f4.camel@vrany.io> (raw)
Hi folks,
I'm trying to debug a code that uses a handful of
hand-written assembly routines. For example, one of
them looks like (its RISC-V but that does not matter):
.text
.globl returnFromJIT1
.type returnFromJIT1,function
.align 2
returnFromJIT1:
.cfi_startproc
sd a0,248(s10)
sd s11,32(s10)
li a0, 17
li a1, 1
j cInterpreterFromJIT
.cfi_endproc
.size returnFromJIT1, .-returnFromJIT1
.text
.globl ...
GDB clealy knows "something" about the assembly routines, it shows
the source properly and 'info symbol' works too:
(gdb) info symbol 0x3ff75eca24
returnFromJIT1 in section .text of /opt/riscv/sysroot/tmp/jdk/lib/default/libj9jit29.so
The problem is how to figure out I'm in (say) `returnFromJIT1` routine
using Python API:
(gdb) py print(gdb.block_for_pc(0x3ff75eca24).function)
None
The only way I can think of is to parse value of `gdb.format_address()`:
(gdb) py print(gdb.format_address(0x3ff75eca24))
0x3ff75eca24 <returnFromJIT1>
which is bit awkward (but doable!).
Question is: is there a better way? I can modify the assembly source
too if there's some directive that may help GDB (.cfi_startproc / .cfi_endproc
is clearly not enough). Or do I have to roll up sleeves and implement python
API for minimal symbols?
Thanks!
Jan
next reply other threads:[~2022-04-29 12:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-29 12:32 Jan Vrany [this message]
2022-04-29 12:54 ` Simon Marchi
2022-04-29 13:10 ` Jan Vrany
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=5dce3fb2110facb58974d1ee546c43b6db20b6f4.camel@vrany.io \
--to=jan@vrany.io \
--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).