This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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 v3 8/9] compile: New compile printf


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


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