#ifdef DEBUG
#define DEBUG_PRINT(level, format, a...) \
if ((level) & debug_print)kkprintf(format, ## a)
#else
#define DEBUG_PRINT(level, format, a...)
#endif
DEBUG is defined
debug_print was initialize to a -1 and level is passed to the
DEBUG_PRINT macro.
In the actual device driver, there might be something like this
DEBUG_PRINT(DEBUG_INIT,"this is a debug statement %x\n",error_msg);
where DEBUG_INIT might be set to #define DEBUG_INIT 1.
All other driver it works. I'm just having problems with lynxOS
compiling for a ppc development driver.
if I do kkprint() in the driver code, I get a printout.
Any Ideas?
Hardly. I've scanned your post for any concrete problem symptoms, and found only
this: "I'm just having problems with lynxOS compiling for a ppc development
driver." Well, that's unfortunate. But until you explain what your problem is
exactly (quote error message, code, etc), you'll have trouble finding helpful Ideas.
Well, I'm not having any problems compiling. No error message. I just
can't get the DEBUG_PRINT macro above to work. I only get debug print
statements to work when I eliminate the,"if (level & debug_print)"
maybe the compiler has decided that debug_print returns 0 or void and
therefore optomised it out.
I don't see anything glaring. Run the preprocessor on your code and
print the listing. That will tell you what is actually going to the
compiler. Write up a test case, and then post the results of the
processed listing if you can't see the problem. Since DEBUG_PRINT is a
macro we need the pre-processed code to help.
I'm sorta a newbie in lynxOS. I have done a device driver on an x86
platform (many many moons ago) using basically the same code.
DEBUG_PRINT macro works find.
Anyway, how do a run the preprocessor on my code. Or is there a way to
generate a compile listing where I can take a look at the generated
code.
I'm a Windows Device Driver guy. Please don't hold that against me.
John
>> I don't see anything glaring. Run the preprocessor on your code and
>> print the listing. That will tell you what is actually going to the
>> compiler. Write up a test case, and then post the results of the
>> processed listing if you can't see the problem. Since DEBUG_PRINT is a
>> macro we need the pre-processed code to help.
> I'm sorta a newbie in lynxOS. I have done a device driver on an x86
> platform (many many moons ago) using basically the same code.
> DEBUG_PRINT macro works find.
> Anyway, how do a run the preprocessor on my code. Or is there a way to
> generate a compile listing where I can take a look at the generated
> code.
Copy/paste the compile command that gets executed when you run make to the
command prompt. But instead of the -c option, pass -E to gcc. The output file
(specified after -o) will contain preprocessed code.
thanks, I'll give that a try the first chance I get.