[PATCH v3 1/9] Code cleanup: Make parts of print_command_1 public
Jan Kratochvil
jan.kratochvil@redhat.com
Thu Apr 30 00:24:00 GMT 2015
On Wed, 29 Apr 2015 17:43:48 +0200, Pedro Alves wrote:
> I read the series, and AFAICS, this will be used by
> compile_print_command in patch #7. But then AFAICS, compile_print_command
> leaks fmtp.
Yes, you are right it gets leaked in the end.
> I think this all ends up simpler if it follows the pattern that
> the current code already follows.
It was reworked because struct format_data * becomes a part of struct
do_module_cleanup which can be processed independently in the future.
So the forgotten xfree was inteded+forgotten to be in do_module_cleanup.
OTOH this COMPILE_I_PRINT_ADDRESS_SCOPE and COMPILE_I_PRINT_VALUE_SCOPE
processing in do_module_cleanup is suppressed if the caller no longer exists
(the 'compile print' command already finished). That means that you are right
do_module_cleanup can depend on a local variable of the compile_print_command
caller.
I have to mention with sub-classing and C++ automatic memory management there
would be nothing left to solve.
Jan
More information about the Gdb-patches
mailing list