* [Qemu-devel] Should configure --enable-debug add -Og to CFLAGS?
@ 2019-06-27 15:43 Markus Armbruster
2019-06-27 16:01 ` Paolo Bonzini
2019-06-27 16:02 ` Daniel P. Berrangé
0 siblings, 2 replies; 4+ messages in thread
From: Markus Armbruster @ 2019-06-27 15:43 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Daniel P. Berrangé, Paolo Bonzini
The fine manual advises:
'-O0'
Reduce compilation time and make debugging produce the expected
results. This is the default.
[...]
'-Og'
Optimize debugging experience. '-Og' should be the optimization
level of choice for the standard edit-compile-debug cycle, offering
a reasonable level of optimization while maintaining fast
compilation and a good debugging experience. It is a better choice
than '-O0' for producing debuggable code because some compiler
passes that collect debug information are disabled at '-O0'.
Our configure --enable-debug effectively picks -O0. Should it pick -Og
instead?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] Should configure --enable-debug add -Og to CFLAGS?
2019-06-27 15:43 [Qemu-devel] Should configure --enable-debug add -Og to CFLAGS? Markus Armbruster
@ 2019-06-27 16:01 ` Paolo Bonzini
2019-06-27 16:45 ` Markus Armbruster
2019-06-27 16:02 ` Daniel P. Berrangé
1 sibling, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2019-06-27 16:01 UTC (permalink / raw)
To: Markus Armbruster, qemu-devel; +Cc: Peter Maydell, Daniel P. Berrangé
On 27/06/19 17:43, Markus Armbruster wrote:
> The fine manual advises:
>
> '-O0'
> Reduce compilation time and make debugging produce the expected
> results. This is the default.
> [...]
> '-Og'
> Optimize debugging experience. '-Og' should be the optimization
> level of choice for the standard edit-compile-debug cycle, offering
> a reasonable level of optimization while maintaining fast
> compilation and a good debugging experience. It is a better choice
> than '-O0' for producing debuggable code because some compiler
> passes that collect debug information are disabled at '-O0'.
>
> Our configure --enable-debug effectively picks -O0. Should it pick -Og
> instead?
>
commit 48e56d503e18bd1e8a75463fd7cc1580bf7e7650
Author: Paolo Bonzini <pbonzini@redhat.com>
Date: Tue Mar 6 11:32:44 2018 +0100
Revert "build-sys: compile with -Og or -O1 when --enable-debug"
This reverts commit 906548689e37ab6cca1e93b3f8d9327a4e17e8af.
Even with -Og, the debug experience is noticeably worse
because gdb shows a lot more "<optimised out>" variables and
function arguments.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
:(
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] Should configure --enable-debug add -Og to CFLAGS?
2019-06-27 15:43 [Qemu-devel] Should configure --enable-debug add -Og to CFLAGS? Markus Armbruster
2019-06-27 16:01 ` Paolo Bonzini
@ 2019-06-27 16:02 ` Daniel P. Berrangé
1 sibling, 0 replies; 4+ messages in thread
From: Daniel P. Berrangé @ 2019-06-27 16:02 UTC (permalink / raw)
To: Markus Armbruster; +Cc: Peter Maydell, qemu-devel, Paolo Bonzini
On Thu, Jun 27, 2019 at 05:43:30PM +0200, Markus Armbruster wrote:
> The fine manual advises:
>
> '-O0'
> Reduce compilation time and make debugging produce the expected
> results. This is the default.
> [...]
> '-Og'
> Optimize debugging experience. '-Og' should be the optimization
> level of choice for the standard edit-compile-debug cycle, offering
> a reasonable level of optimization while maintaining fast
> compilation and a good debugging experience. It is a better choice
> than '-O0' for producing debuggable code because some compiler
> passes that collect debug information are disabled at '-O0'.
>
> Our configure --enable-debug effectively picks -O0. Should it pick -Og
> instead?
NB, it is the --enable-debug-info option to configure that actually
adds the "-g" flag for debug info in objects, and turns off -O2.
--enable-debug turns on TCG and Mutex debugging & disables fortify
source, but doesn't affect optimization level.
Adding -Og to --enable-debug-info would be problematic for Fedora/RHEL
distro builds, as we want debugging symbols, but also still want -O2
to be used.
Yes, the naming of these options is a trapdoor over a pit of crocodiles :-)
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] Should configure --enable-debug add -Og to CFLAGS?
2019-06-27 16:01 ` Paolo Bonzini
@ 2019-06-27 16:45 ` Markus Armbruster
0 siblings, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2019-06-27 16:45 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: Peter Maydell, Daniel P. Berrangé, qemu-devel
Paolo Bonzini <pbonzini@redhat.com> writes:
> On 27/06/19 17:43, Markus Armbruster wrote:
>> The fine manual advises:
>>
>> '-O0'
>> Reduce compilation time and make debugging produce the expected
>> results. This is the default.
>> [...]
>> '-Og'
>> Optimize debugging experience. '-Og' should be the optimization
>> level of choice for the standard edit-compile-debug cycle, offering
>> a reasonable level of optimization while maintaining fast
>> compilation and a good debugging experience. It is a better choice
>> than '-O0' for producing debuggable code because some compiler
>> passes that collect debug information are disabled at '-O0'.
>>
>> Our configure --enable-debug effectively picks -O0. Should it pick -Og
>> instead?
>>
>
> commit 48e56d503e18bd1e8a75463fd7cc1580bf7e7650
> Author: Paolo Bonzini <pbonzini@redhat.com>
> Date: Tue Mar 6 11:32:44 2018 +0100
>
> Revert "build-sys: compile with -Og or -O1 when --enable-debug"
>
> This reverts commit 906548689e37ab6cca1e93b3f8d9327a4e17e8af.
> Even with -Og, the debug experience is noticeably worse
> because gdb shows a lot more "<optimised out>" variables and
> function arguments.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>
> :(
Aha, GCC's documentation is more aspirational than factual here.
Nevermind!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-06-27 17:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-27 15:43 [Qemu-devel] Should configure --enable-debug add -Og to CFLAGS? Markus Armbruster
2019-06-27 16:01 ` Paolo Bonzini
2019-06-27 16:45 ` Markus Armbruster
2019-06-27 16:02 ` Daniel P. Berrangé
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.