Clarification of Question by
ignorant-ga
on
14 Jul 2004 07:57 PDT
Well... ddd shows the source in a window where one may peruse the macro
definitions! Whereas gcc does receive the output of cpp (there macros
have been expanded), ddd (and gdb) have full access to *every* macro
definition, as evidenced by their ability to list source!
Moreover, I am concerned *only* with the case where full source is
available. Hence there are no information-theoretic nor conceptual
reasons preventing ddd (or gdb) from providing a macro aware debugging
environment.
I do realize ddd/gdb are free, and one therefore should not complain;
so I hereby publicly appologize for alluding to their apparent
macro-challenged nature as lame... And it could be the case (as
far as I know) that there *is* some way to coax the collection
cpp/gcc/ddd/gdb into giving far better macro support than what I am
currently experiencing ("No symbol ...in current context").
I was once told that "gcc -gdwarf-2 -g3 ..." together with coaxing
given to ddd would help, but I was never able to make anything
in that direction work. Moreover, I have been told that even if I
could make progress in that direction, the ## token-splicing
operator, the # stringification operator, and variable-arity macros
would not be handled properly.
I have also used -E to stop after preprocessing, and then proceeded
with the output as if it were my source... But drawbacks include:
1) The syntactic sugar (macros) is gone.
2) The output of cpp is not pretty-printed (as done, for example,
by emacs in C mode) and my decaying eyesight needs a crutch
of that sort to make sense of source.
I do not know how to noninteractively pretty-print C, which would
help me with drawback 2 above, and while on this train of thought
I will also mention that there is no apparent way to have cpp
generate a newline in it's output (which in some situations is
decidedly inconvenient, though someome once told me to fix it by
rewriting cpp based on gnu M4, which I don't believe I have the
time or stomach to do).
So let me amend (broaden) the question... I will happly pay the
google answer fee for a nice (gpl) noninteractive pretty-print
program (which I can use to ameliorate point 2 above) and for
a bullet-proof method to generate newlines in macro expansions,
since I then could cobble together an acceptable code transformer.