Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Breakpoints on JITted code
@ 2024-06-05 13:06 Edd Barrett
  2024-06-26 17:32 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Edd Barrett @ 2024-06-05 13:06 UTC (permalink / raw)
  To: gdb

Hi,

I've recently implemented a simple gdb plugin [0] for a JIT I'm working on.

Lineinfo is working well, but I was expecting to be able to set breakpoints on
the names of JITted code functions (where the name is the one passed to the
`name` argument of block_open()), but this doesn't appear to be the case. gdb
allows me to set a pending breakpoint, but doesn't stop when a JITted function
of that name is reached.

Should I be able to set breakpoints by name for JITted code functions?

I'm using gdb-13.1 on Debian/amd64. I tried with gdb-14.2, but something about
my plugin causes gdb to crash with:
```
internal-error: sect_index_text not initialized".
```

Applying this patch [1] doesn't make that go away:

Cheers

[0] https://github.com/ykjit/yk/blob/master/ykrt/yk_gdb_plugin/yk_gdb_plugin.c
[1] https://sourceware.org/bugzilla/show_bug.cgi?id=25678#c5

-- 
Best Regards
Edd Barrett

https://www.theunixzoo.co.uk

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Breakpoints on JITted code
  2024-06-05 13:06 Breakpoints on JITted code Edd Barrett
@ 2024-06-26 17:32 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2024-06-26 17:32 UTC (permalink / raw)
  To: Edd Barrett; +Cc: gdb

>>>>> "Edd" == Edd Barrett <edd@theunixzoo.co.uk> writes:

Sorry this didn't get a response.

Edd> Lineinfo is working well, but I was expecting to be able to set breakpoints on
Edd> the names of JITted code functions (where the name is the one passed to the
Edd> `name` argument of block_open()), but this doesn't appear to be the case. gdb
Edd> allows me to set a pending breakpoint, but doesn't stop when a JITted function
Edd> of that name is reached.

Edd> Should I be able to set breakpoints by name for JITted code functions?

Based on looking at gdb/jit.c I think I'd expect that to work.
It's creating function domain symbols in finalize_symtab.

Maybe turning on some symbol lookup debug logging would help -- not
sure.  Or just debugging gdb itself, that's what I'd try.

Edd> I'm using gdb-13.1 on Debian/amd64. I tried with gdb-14.2, but something about
Edd> my plugin causes gdb to crash with:
Edd> ```
Edd> internal-error: sect_index_text not initialized".
Edd> ```

Some parts of gdb expect objfiles to have a text section.
This is a longstanding bug but nobody's ever fixed it, presumably
because a data-only shared library is pretty rare.

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-26 17:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-05 13:06 Breakpoints on JITted code Edd Barrett
2024-06-26 17:32 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox