This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Major debugging breakage
law@redhat.com wrote:-
> Every time we parse a token we update LINENO to be equal to SRC_LINENO
> (c_lex.c). LINENO is used to initialize the line numbers in NOTEs
> that are used by the debug symbol routines. The comments in cb_line_change
> seem to indicate that SRC_LINENO is meant to be used for diagnostic
> line numbers. Maybe that is the root of our problem -- mixing the two
> purposes.
Possibly. One obvious idea I had that I never investigated was that
something was using the line number from the start or end of the
expressions only. This could be a parser problem, or a problem with a
variable being clobbered, or a whole host of things. The last big
line number complaint and bug fix was just before 3.0, which was
resolved by Mark finding a bug in the C++ front end. I suspect that
whatever is causing this is quite trivial (if hard to find).
I don't like the way that lineno is kind of global, and everything
seems to read (and in one or two places write to) it willy-nilly.
It's always struck me as wrong-headed that the debug routines should
reference it directly at all. But I'm pretty much lost when it comes
to debug info. I can find my way round the C tree front end without
too much difficulty, but I've never delved into RTL seriously.
> SRC_LINENO is updated at the start of every non-empty line via
> cb_line_change.
Yup; that's my work from 3.1; 3.0 was different (I'm responsible for
half the comments around cb_file_change, too). I don't think there's
an issue there. I think the lineno code is generally correct, because
the C / ObjC / C++ front-end diagnostics always come out at the right
place (modulo the occasional parser issue with needing to e.g. find a
brace for context). It seems that line numbers are not being
correctly assigned to (sub-)expressions somewhere.
The reason I mentioned cb_file_change at all is because there is no
real documentation of what the debug code expects lineno to be set to
at any particular time; so I'm not sure that e.g. the debug callbacks
in cb_file_change are happening at the right time w.r.t. updating
lineno. Just an idea.
> The Cygwin mmap issues are pretty serious too, so attacking that problem
> makes a lot of sense.
OK, that's top of my list then. It's pure configury stuff rather than
a direct CPP issue - not something I'm terribly knowledgable about
either (I was hoping Zack might do it 8-))
Neil.