This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v3 8/9] compile: New compile printf
- From: Pedro Alves <palves at redhat dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>, gdb-patches at sourceware dot org
- Cc: Phil Muldoon <pmuldoon at redhat dot com>
- Date: Wed, 29 Apr 2015 16:52:09 +0100
- Subject: Re: [PATCH v3 8/9] compile: New compile printf
- Authentication-results: sourceware.org; auth=none
- References: <20150411194322 dot 29128 dot 52477 dot stgit at host1 dot jankratochvil dot net> <20150411194429 dot 29128 dot 61494 dot stgit at host1 dot jankratochvil dot net>
On 04/11/2015 08:44 PM, Jan Kratochvil wrote:
> Hi,
>
> command naming needs to follow what gets decided for 'compile print'.
>
> This part sends the output to inferior stdout, only the next patch will
> redirect it to GDB (so that for example it works for remote gdbserver).
>
> It cannot work for core files as one cannot execute inferior code there.
> There were some ideas such as compiling the entered sources into GCC
> intermediate form (GIMPLE?) and interpret it by GDB on top of the core file.
Yeah, though that's a general idea for "compile print" as well, not
just printf. I'd love to see us get there, but these new commands
are useful on their own as interim steps too. The usefulness of "compile printf"
specifically isn't as immediately clear though. I think the manual
should say something about why you want to use "compile printf" over
the alternatives. (Edit: Ah, I see that's in the next patch.)
The main advantage is that after the next patch, the output always
appears in gdb's console, while "compile code printf" works just like
(gdb) print printf (...)
meaning, in the "compile the output should go to the inferior's stdout.
Or is there another advantage I missed, perhaps?
> That would be much more complicated, this implementation is made according to
> Phil's specification.
>
> Besides existing
> (gdb) set compile-args
> there will be now also:
> (gdb) set compile-printf-args
> Maybe it would be worth to start some set sub-category 'compile' such as:
> (gdb) set compile args
> (gdb) set compile printf-args
That'd be fine with me.
But can give an example of why you'd want to set "set compile-printf-args"
differently to "set compile-args" ?
> That would mean the whole process of deprecating 'set compile-args' etc.
> + add_setshow_string_cmd ("compile-printf-args", class_support,
> + &compile_printf_args,
> + _("Set compile command GCC command-line arguments FIXME"),
> + _("Show compile command GCC command-line arguments FIXME"),
Some FIXMEs here.
Overall looks reasonable.
Thanks,
Pedro Alves