After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 664922 - Incorrect "#line" directives for "-g --save-temps"
Incorrect "#line" directives for "-g --save-temps"
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Code Generator
0.14.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2011-11-27 17:04 UTC by Ian Liu Rodrigues
Modified: 2018-05-22 14:15 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ian Liu Rodrigues 2011-11-27 17:04:59 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)
Comment 1 Luca Bruno 2011-12-25 12:52:11 UTC
(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().
Comment 2 Akhil Laddha 2012-02-13 13:12:06 UTC
Ian, did comment#1 help you in solving the problem ?
Comment 3 Ian Liu Rodrigues 2012-02-13 19:26:19 UTC
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
Comment 4 GNOME Infrastructure Team 2018-05-22 14:15:18 UTC
-- 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.