This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch,AVR]: Better log output with -mdeb/-mdebug=


2011/9/29 Georg-Johann Lay <avr@gjlay.de>:
> Georg-Johann Lay wrote:
>> This is a tentative patch for better support of logging information for avr BE
>> developers.
>>
>> There are situations where it is more convenient to let the compiler produce
>> information than to debug into the compiler. One example are -da dumps.
>>
>> This patch proposes a better support to print information by means of a
>> printf-like function via %-codes.
>>
>> The current debug output with avr-gcc's option -mdeb produces bulk of
>> information that is very hard to read because
>> Â- there is much output
>> Â- there is no information on current_function_decl
>> Â- there is no information on current pass name/number
>> Â- there is no print-like function so the trees, rtxes so that it is
>> Â Âtedious to get formatted output.
>>
>> For example, the following call to avr_edump
>>
>> static int
>> avr_OS_main_function_p (tree func)
>> {
>> Â avr_edump ("%?: %t\n", func);
>> Â return avr_lookup_function_attribute1 (func, "OS_main");
>> }
>>
>> prints additional information in a convenient way (foo is function to be compiled):
>>
>> avr_OS_main_function_p[foo:pro_and_epilogue(202)]: <function_decl # foo
>> Â Â type <function_type #
>> Â Â Â Â type <void_type # void VOID
>> ...
>>
>> Wondering that similar functionality is not provided by GCC itself, I wrote
>> this patch. GCC's diagnostic seems to be overwhelmingly complicated and not
>> intended for the purpose mentioned above.
>>
>> The code is dead code at the moment. No function in the BE uses the new
>> functions. This patch just adds them.
>>
>> Moreover; I don't know if avr port maintainers or global reviewers like such
>> stuff in the compiler... Therefore it's just tentative draft.
>>
>> Supported %-codes are:
>>
>> Â r: rtx
>> Â t: tree
>> Â T: tree (brief)
>> Â C: enum rtx_code
>> Â m: enum machine_mode
>> Â R: enum reg_class
>> Â L: insn list
>> Â H: location_t
>>
>> Â -- no args --
>> Â A: call abort()
>> Â f: current_function_name()
>> Â F: caller (via __FUNCTION__)
>> Â P: Pass name and number
>> Â ?: Print caller, current function and pass info
>>
>> Â -- same as printf --
>> Â %: %
>> Â c: char
>> Â s: string
>> Â d: int (decimal)
>> Â x: int (hex)
>>
>> These codes cover great deal of BE developers needs and if something is missing
>> it can be added easily.
>
> Here is now the patch for review.
>
> As Denis proposed in http://gcc.gnu.org/ml/gcc/2011-09/msg00357.html all
> additional functions are put in the new file avr-log.c.
>
> -mdebug= is a new command line option that takes a string argument to filter
> specific log messages. ÂThe purpose of -mdebug=all is to be similar to -mdeb
> and, e.g, -mdebug=rtx_costs,legitimate_address_p is intended to print
> information from respective named hooks.
>
> avr.c:avr_option_override calls avr-log.c:avr__set_avr_debug to parse -mdebug
> and set bitfield avr_debug accordingly, but using the log functions and
> avr_debug is still to come. ÂThis patch just supplies the basis.
>
> I opened PR50566 to collect changes for better logging.
>
> Ok for trunk?

Ok.
Please apply.

Denis


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]