[LLVMdev] Preliminary patch for GDB support for JIT

Reid Kleckner rnk at mit.edu
Wed Jul 8 13:55:49 PDT 2009


On Wed, Jul 8, 2009 at 12:16 PM, Eric Christopher<echristo at apple.com> wrote:
>> For reference, here is the corresponding patch against GDB:
>> http://web.mit.edu/rnk/www/jit-patch.diff
>>
>
> This appears to be missing some hunks...

Ah, crap, there's a gdb/jit.[ch] but I don't know how to get cvs diff
to include them.  'cvs add' wants write access on the main server.
Supposedly 'cvs diff -upN' will do it, but it's not working for me...
Expect to hear back.

>> And finally, the patch to LLVM is attached and uploaded to Rietveld:
>> http://codereview.appspot.com/91042/show
>>
>
> In general I'd like to see the ELF support separated from the main
> interface. It makes any other platform support require a complete
> refactor :)

That's a goal I have for the summer.  One dumb way to approach it
would be to push the ELF creation to the GDB side of the interface,
and create the ELF there.  That would clean up the interface and make
it much nicer.

But once you've done that, then it's probably just as much work to
figure out the in memory objfile data structures and modify those
directly.  This was just the path that yielded results most quickly.

>> I know this code is sketchy and preliminary, but it's useful for us,
>> and I have plans to improve it:
>> http://wiki.llvm.org/HowTo:_Tell_GDB_about_JITted_code
>
> I'm not entirely sure about the lazy debug symbols part, but
> as far as I can tell neither are you :)

Yeah, that's seeming less and less likely to happen.

> The rest of it seems reasonable to me.

Great!

On Wed, Jul 8, 2009 at 12:27 PM, Sandeep Patel<deeppatel1987 at gmail.com> wrote:
> On Wed, Jul 8, 2009 at 11:41 AM, Reid Kleckner<rnk at mit.edu> wrote:
>> Right now, GDB has no way to be told about JITed code.  I'm working on
>> adding such an interface, and the LLVM JIT would be the first client.
>
> Have you considered how this might be made to work for embedded
> targets where remote debugging is required?

GDB supports remote debugging, and once GDB can read the info out of
the target's memory instead of off the filesystem, then it would
probably Just Work.

Reid




More information about the llvm-dev mailing list