qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH for-next v3 2/5] tmp105: Add debug output


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH for-next v3 2/5] tmp105: Add debug output
Date: Mon, 25 Feb 2013 12:18:35 +0100

On 16.02.2013, at 12:59, Andreas Färber wrote:

> Am 15.02.2013 14:14, schrieb Alexander Graf:
>> In parallel to the completely disastrous user experience when using trace 
>> points. Debug printfs are easy and understandable. Tracepoints are not.
>> 
>> However, how about we take this one gradually?
> 
> +1, I'm looking for a minimally invasive solution that addresses my
> compilation-test needs. It doesn't need to be the final
> bells-and-whistles version. :)
> 
>> If all debug prints in all files do an
>> 
>>  #ifdef DEBUG
>>  static const debug_enabled = 1;
>>  #else
>>  static const debug_enabled = 0;
>>  #endif
>> 
>> then Stefan can probably add a -DDEBUG to a specific c file through Makefile 
>> magic if he wants to do iPXE-style debugging. And if you're - like me - more 
>> happy with local #define DEBUG, then you can do that as well.
> 
> Could you please clarify: Are you suggesting to consistently use just
> DEBUG in place of the various FOO_DEBUGs? That would enable all debug
> output for --enable-debug builds, wouldn't it? (Or am I mixing that up
> with NDEBUG in the opposite case...?)

Ah, DEBUG is already taken. I was thinking of some define that only applies to 
files you want to debug, which you can then mark the debug_enabled variable to 
true with. I see 2 options to do this:

- Add a DEBUG_THIS_FILE define. This define is only set for files you 
explicitly mark to debug. I don't know how hard it would be to do this for a 
Makefile magician

- Convert file paths into define compatible strings. hw/ppc/ppc_newworld.c 
would become HW_PPC_MAC_NEWWORLD_C. In that file, check for 
DEBUG_HW_PPC_MAC_NEWWORLD_C and set debug to enabled if it's defined. With a 
small script that does the above conversion you could then maybe do "make 
debug=hw/ppc/mac_newworld.c" to easily enable debugging for that whole file. 
That's iPXE style :).


Alex

> 
> Or just having a static const variable to avoid #ifdef FOO_DEBUG for
> statements as done in openpic code?
> 
> Andreas
> 
>> 
>> I would definitely oppose moving to tracepoints.
>> 
>> 
>> Alex
>> 
> 
> 
> -- 
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg




reply via email to

[Prev in Thread] Current Thread [Next in Thread]