[3.0 regression] File naming confusion
Neil Booth
neil@daikokuya.demon.co.uk
Thu May 24 00:00:00 GMT 2001
Many moons ago, Benjamin Kosnik wrote:-
> I keep dropping the ball WRT the line-numbering issue. Here's a
> small example:
Here's a *really easy* testcase. We MUST get this fixed for 3.0.
#line 500 "foo.c"
int
main ()
{
return 0;
}
Compile with -g, and run gdb. Put a breakpoint on main. Run to see
the problem.
Clearly, the problem is the #line (or #pragma GCC system_header).
I'm 99% certain the bug is in c-lex.c in the cb_file_change function.
It goes like this [unimportant bits skipped]:-
if (fc->reason == FC_ENTER)
{
[...]
push_srcloc (fc->to.filename, 1);
debug_start_source_file (fc->to.filename);
[...]
}
else if (fc->reason == FC_LEAVE)
{
[...]
pop_srcloc ();
debug_end_source_file (input_file_stack->line);
[...]
}
This handles the cases of FC_ENTER (which is when entering the main
file or a #included file), FC_LEAVE (when leaving a header). There is
one more case for which we do nothing special: FC_RENAME. This is
used for #line and the #pragma.
It is clear to me that debug_* and maybe *_srcloc are needed for
FC_RENAME, but I'm not sure what.
I'm going to try a few things now.
Neil.
More information about the Gcc-bugs
mailing list