Display current line of source code when displaying the current frame in the debugger
In the debugger, if you print the current frame you will get output in the format of:
#frame functionName(argument, argument) at file.js:line:column
In order to help you figure out where you are in the source without having to keep the file open and cross-reference the line numbers to your editor, it would be best to show the corresponding line of source code when the frame is printed.
Being able to load the source code would also make it possible to implement a list
command (see here for an explanation of GDB's equivalent.)
An example session might look something like this:
gjs -d examples/gtk.js
GJS debugger. Type "help" for help
db> break 27
Breakpoint 1 at examples/gtk.js:27:4
db> c
Breakpoint 1, onDeleteEvent([object GObject_Object], [object GObject_Union]) at examples/gtk.js:27:4
db> f
#0 onDeleteEvent([object GObject_Object], [object GObject_Union]) at examples/gtk.js:27:4
27 log('delete-event emitted');
db> l
22 // are marked construct-only.
23 window.title = 'Hello World!';
24
25 // This is a callback function
26 function onDeleteEvent() {
* 27 log('delete-event emitted');
28 // If you return false in the "delete_event" signal handler, Gtk will emit
29 // the "destroy" signal.
30 //
31 // Returning true gives you a chance to pop up 'are you sure you want to
32 // quit?' type dialogs.