This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

We still have wrong file names in debug output (#line)


To see this

1) run gdb on "cc1" from a recent build of 3.0.
2) Put a breakpoint on start_function
3) do "set args test.c" where test.c is a file containing

int main ()
{
  return 0;
}

4) Run, and when the breakpoint is hit, do "up".

You'll see something like:-

(gdb) up
#1  0x804a0b7 in yyparse_1 () at /usr/share/bison/bison.simple:316

The line number is correct, but the filename should be "c-parse.y",
as you can see from your copy of c-parse.y.

This is caused by a #line directive.  What should #line do for debug
output?  cb_file_change in c-lex.c does debug_start_source_file and
a debug_end_source_file for entering and leaving headers, but nothing
for a #line that changes the filename.

cb_file_change in c-lex.c needs to be changed as follows, but how?

  if (fc->reason == FC_ENTER)
    {
        [....]
    }
  else if (fc->reason == FC_LEAVE)
    {
        [....]
    }
+ else
+   debug_handle_#line_somehow ();


Neil.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]