| From: Diego Novillo <firstname.lastname@example.org> | On Thu, 1 Sep 1994, Bob Olson wrote: | | > What you really want to do is add the cpp-style line number markers | > (take a look at the output of cc -E); that way the c compiler will | > emit error messages with file names & line numbers that refer back to | > the original code. | > | > --bob | > | Maybe. But, will that work with a sequential debugger like dbx or gdb? | The user will be debugging the executable generated with the modified | source. But we want to show the original source code, not the modified | one. | | Lets assume that we can convince the debugger to do this, and that, the | generated code does not have bugs... er, sure, why not. | | Diego. | | -- | Diego A. Novillo | "We each pay a fabulous price for our | email@example.com | visions of paradise. But a spirit with | Computing Science - U of Alberta | a vision is a dream with a mission" | Edmonton, Alberta - Canada | Rush - Mission | | Adding cpp directives work for dbx and gdb. This is how source code generating programs like yacc and lex force dbx to show the original source. But it is usually better to add the pre-cpp directives (not the post-cpp directives as Bob seem to suggest). In other words you can add: #LINE 3 "foo.c" to say that the next line is line 3 of file foo.c. cpp (or cc -E) converts this into something like: #3 "foo.c" then the rest of the compiler inserts this information in object code for debuggers. Reason that post-cpp directives are bad is that when you compile the file "cc" calls cpp and on some machines cpp chokes on post-cpp directives. Something to watch out is that format of these directives are not always portable. So you will have to check on each platform and do some format changes. I have done this, (actully I have put these directives in generated Fortran sources) and will help on format if necessary. -Daya Daya Atapattu.