GNOME Bugzilla – Bug 664922
Incorrect "#line" directives for "-g --save-temps"
Last modified: 2018-05-22 14:15:18 UTC
When debugging a vala program, you can not perform the following operations: (gdb) break main (gdb) run (gdb) next Expected result: Execute the first line of the Vala's main method. What I get: The program executes till the end. Example: ----------8<---------- // main.vala : compile with `valac -g --save-temps main.vala` int main(string[] args) { debug("Foo"); debug("Bar"); return 0; } ----------8<---------- This is the GDB session: (gdb) b main Breakpoint 1 at 0x804855e: file /home/ian/Desktop/main.vala, line 1. (gdb) r Starting program: /home/ian/Desktop/main [Thread debugging using libthread_db enabled] Breakpoint 1, main (argc=1, argv=0xbffff2d4) at /home/ian/Desktop/main.vala:1 1 int main(string[] args) (gdb) n ** (process:4685): DEBUG: main.vala:3: foo ** (process:4685): DEBUG: main.vala:4: bar 36 } (gdb)
(In reply to comment #0) > When debugging a vala program, you can not perform the following operations: > (gdb) break main > (gdb) run > (gdb) next > > Expected result: > Execute the first line of the Vala's main method. > > What I get: > The program executes till the end. > > Example: > > ----------8<---------- > // main.vala : compile with `valac -g --save-temps main.vala` > int main(string[] args) > { > debug("Foo"); > debug("Bar"); > return 0; > } Thanks for your bug report. This is not strictly a problem of the #line directive. The vala main method is in _vala_main(), not main().
Ian, did comment#1 help you in solving the problem ?
Akhil, I know the main method is _vala_main, and you can break on that method. But that seems like a workaround, not a solution. I only knew about _vala_main because I had to lurk in the generated sources. When debugging a C program, I expect that breaking on a function's name would put the break on the first line of that function; and typing next would step inside the function. The ideal would be to never see the generated source file ;-) Ian
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/256.