public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
* Example of source-location support
@ 2013-01-01  0:00 David Malcolm
  0 siblings, 0 replies; only message in thread
From: David Malcolm @ 2013-01-01  0:00 UTC (permalink / raw)
  To: jit

I've added support for source-locations to my jittest toy interpreter
[1] (as commit 4f50dee08dd92a0006b6d53d52c137adbb9932ea).  In my test
example I do it in a rather contrived way by associating the stackvm
bytecodes with the locations in main.cc containing the table
initializing them, but in a real interpreter you'd get this data from
the parser.

This allows stepping through JIT-compiled bytecodes within gdb:

(gdb) break fibonacci
(gdb) run
Breakpoint 1, fibonacci (input=8) at main.cc:43
43      DUP,
(gdb) next
47      PUSH_INT_CONST, 2,
(gdb) next
51      BINARY_INT_COMPARE_LT,
(gdb) next
55      JUMP_ABS_IF_TRUE, 17,
(gdb) next
59      DUP,
(gdb) next
63      PUSH_INT_CONST,  1,
(gdb) next
67      BINARY_INT_SUBTRACT,
(gdb) next
71      CALL_INT,
(gdb) next
Breakpoint 1, fibonacci (input=7) at main.cc:43
43      DUP,
(...etc)

So hopefully this aspect of the library should now be usable for real
interpreters, giving users the ability to step through JIT-compiled
functions from in the debugger at the level of lines of script files.

Dave

[1] https://github.com/davidmalcolm/jittest

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-10-15 21:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-01  0:00 Example of source-location support David Malcolm

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).