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>
- Cc: gdb-patches at sourceware dot org, Phil Muldoon <pmuldoon at redhat dot com>
- Date: Wed, 06 May 2015 12:47:25 +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> <5540FE29 dot 5050004 at redhat dot com> <20150503140605 dot GC18394 at host1 dot jankratochvil dot net> <5549EB71 dot 1070101 at redhat dot com> <20150506112954 dot GA19264 at host1 dot jankratochvil dot net>
On 05/06/2015 12:29 PM, Jan Kratochvil wrote:
> On Wed, 06 May 2015 12:22:41 +0200, Pedro Alves wrote:
>> I understand that. But what I was asking is (after the series is wholly
>> pushed), what is the advantage of "(gdb) compile printf"
>> over "(gdb) compile print printf (...)" and "(gdb) call printf (...)".
>
> This patch, that is
> [PATCH v3 8/9] compile: New compile printf
> without the part
> [PATCH v3 9/9] compile: compile printf: gdbserver support
> is really just that
> (gdb) compile print printf (...)
> and the patch is also therefore very simple.
>
> According to Phil - roughly, not citing - such 'compile printf' was simple
> enough to code to make it worth such a feature, despite it has many
> shortcomings.
OK, since we don't have a real use case of calling the
inferior's printf (other than because it's seemingly simple), I'd
rather we avoid it and do as outlined in the previous email.
>> Agreed on the latter, but the question really is: why do we need
>> "set compile-printf-args" instead of using "set compile-args" for
>> all expression evaluation through the compiler?
>> Shouldn't "-Werror=format" be in "set compile-args" too?
>
> Why not, this is a matter of opinion. IMO cc itself should have -Werror by
> default as otherwise by default it is willing to knowingly produce crashing
> programs. The only safe warnings are -Wunused* ones and maybe few others.
> So again, this patch tries to make minimal changes to what is the current
> established wrong standard.
The minimal change then is putting -Werror=format in "set compile-args".
Sounds like you're OK with that; let's do it.
Thanks,
Pedro Alves