lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lightning] Implement a GDB Interface


From: Paulo César Pereira de Andrade
Subject: Re: [Lightning] Implement a GDB Interface
Date: Wed, 11 Sep 2019 17:23:24 -0300

Em dom, 8 de set de 2019 às 06:25, Marc Nieper-Wißkirchen
<address@hidden> escreveu:
>
> Hi Paulo,

  Hi Marc,

> this is a more involved feature request.
>
> The GNU Project debugger, gdb, provides a JIT compilation interface:
> http://sourceware.org/gdb/onlinedocs/gdb/JIT-Interface.html#JIT-Interface
>
> Currently, the only known client of this interface seems to be the LLVM JIT.
>
> It would be awesome if GNU lightning were the second client. :)

  The problem is that lightning does not understand the concept of
variables, only registers. It has the concept of functions, just that
it might not be trivial to infer the arguments and return type.
  There would not be much to offer just with lightning. It would be
better done in some higher level language using lightning to generate
code. And such language would generate the debuginfo as appropriate.
  What I do to debug is to use jit_note, from gdb call jit_disassembly,
and then set breakpoints on instructions as appropriate. In case you
are not aware, type b *0x.... to break in a specific address, after
that one can also watch a register value, e.g. watch $name. Better
with a lightning build with --enable-devel-disassembler, so that it
prints the lightning instruction, followed by the generate assembly.
For example, with two terminals one can do something like this:
(gdb) b _jit_emit
(gdb) r > foo.txt
Breakpoint 1, _jit_emit (_jit....
(gdb) fin  # finish jit_emit
(gdb) call _jit_disassembly(_jit)
(gdb) call fflush(stdout)
Now, in another terminal check "foo.txt" for the disassembly, so that
breakpoints can be added, check the generated code, etc.

> Cheers,
>
> Marc

Thanks,
Paulo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]