This is the mail archive of the
mailing list for the GDB project.
Re: [RFA] Add interface for registering JITed code
>>>>> "Reid" == Reid Kleckner <firstname.lastname@example.org> writes:
Tom> Yeah. This would work if you had two JITs in a process, say loaded
Tom> dynamically, and the various __jit symbols had hidden visibility.
Reid> I think if someone has that use case, then they can write a client
Reid> side library that wraps the __jit symbols and make the two JITs call
Yeah, I changed my mind, let's not worry about it. If it ever comes up,
we can deal with it then without breaking compatibility.
Reid> + /* Remember a mapping from entry_addr to objfile. */
Reid> + set_objfile_data (objfile, jit_objfile_data, (void*) entry_addr);
Tom> I don't think you need the cast here. There are a few of these.
Reid> Actually, it is, because entry_addr is a CORE_ADDR. CORE_ADDR fits
Reid> into a void* right? I'm just doing it to avoid mallocing a single
Oh, I see. It is better to just do the allocation; I think we try to
avoid casting between CORE_ADDR and void*.
Reid> + case BPSTAT_WHAT_CHECK_JIT:
Reid> + if (debug_infrun)
Reid> + fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_CHECK_JIT\n");
Reid> + /* Switch terminal for any messages produced by breakpoint_re_set. */
Reid> + target_terminal_ours_for_output ();
Is the comment here really valid?
I think it should probably mention jit_event_handler, not
Reid> +//#include "assert.h"
Reid> +//#include "string.h"
Just delete these.
(And just FYI, gdb doesn't allow "//" comments.)
Reid> +/* Openning the file is a no-op. */
Typo, should be "opening".
Reid> + /* If we already found the symbols and successfully set the breakpoint, don't
Reid> + do it again. */
Reid> + if (jit_descriptor_addr != 0)
Reid> + return;
I'm sorry I didn't notice this before.
This approach won't work if you have address space randomization enabled
and you re-run the inferior.