Pip Cet via Gcc <gcc@gcc.gnu.org> writes: > I may be missing an obvious workaround, but it seems we currently emit > a #line directive when including lines from machine description files > in C files, but never emit a second directive when switching back to > the generated C file. This makes stepping through the backend in gdb > somewhat painful, because gdb thinks it should display lines from the > md file even after leaving the included fragment.
FWIW, probably the easiest way is to: sed -i '/^#line/' insn-foo.c on the file you're debugging and rebuild cc1 or whatever. > The attached patch is a proof of concept which unconditionally emits a > line containing "/* #unline */" after such fragments, and runs all > generated C files through a trivial filter which replaces those lines > by #line directives pointing back to the original file. It appears to > work. Nice hack ;-) I had a patch a while ago that put all output through routines that track the line number and then emitted the #line at the end of the quoted text. The reason I dropped it was that C++98 only guaranteed #line numbes up to 32767, and some of the generated files are longer than that. Now that we're C++11 we no longer have that restriction. I think I'd slightly prefer to go back to tracking the line number directly in the generators, but please ping me if I don't get to it by the end of October. Thanks, Richard