[ale] more debugging questions
Daniel S Cox
danny.cox at ecweb.com
Fri Jun 25 09:12:22 EDT 1999
Lisa,
At 08:40 AM 6/25/1999 -0500, Lisa Chiang wrote:
>Now I have another question. When I am debugging C programs, how can you see
>the values of #defines? Since these are not local variables how do I verify
>that the prepocessor/compiler saw these correctly?
The short answer is: using the debugger, you can't. The "#define THIS
(1)" performs a macro replacement of "THIS" to a "(1)", so that "THIS" is
no longer there. The compiler never sees "THIS" at all.
Now, how to check that the source has the correct replacement: use the
same compiler flags that would be used to produce the .o file, but also add
"-E". This will produce a .i file, which is the file after all macro
processing has taken place. The bad part is that for each (recursively)
included file, you'll have each and every newline. This makes the file
seem HUGE! Using your favorite editor, search for a pattern on or near the
line in question. You'll see it as the compiler would see it.
This may be a long way around, but it's effective, and I've not found a
better way.
Danny
More information about the Ale
mailing list