Message ID | 20250306161631.2477685-1-alex.bennee@linaro.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [v3] meson.build: default to -gsplit-dwarf for debug info | expand |
On Thu, Mar 6, 2025 at 5:16 PM Alex Bennée <alex.bennee@linaro.org> wrote: > +if get_option('debug') > + qemu_cflags += get_option('split_debug') ? ['-gsplit-dwarf'] : ['-g'] > +endif Since -g is already added by meson, it's enough to do -if get_option('debug') - qemu_cflags += get_option('split_debug') ? ['-gsplit-dwarf'] : ['-g'] +if get_option('debug') and get_option('split_debug') + qemu_cflags += '-gsplit-dwarf' endif Applied with this change, then. Paolo
Paolo Bonzini <pbonzini@redhat.com> writes: > On Thu, Mar 6, 2025 at 5:16 PM Alex Bennée <alex.bennee@linaro.org> wrote: >> +if get_option('debug') >> + qemu_cflags += get_option('split_debug') ? ['-gsplit-dwarf'] : ['-g'] >> +endif > > Since -g is already added by meson, it's enough to do > > -if get_option('debug') > - qemu_cflags += get_option('split_debug') ? ['-gsplit-dwarf'] : ['-g'] > +if get_option('debug') and get_option('split_debug') > + qemu_cflags += '-gsplit-dwarf' > endif > > Applied with this change, then. Ahh I guess I was missing that meson does that under the hood. Can I have a r-b with that change or do do you want to wait for v4? > > Paolo
diff --git a/meson.build b/meson.build index 8d0abe7f12..bba17c73f1 100644 --- a/meson.build +++ b/meson.build @@ -601,6 +601,10 @@ if get_option('tsan') qemu_ldflags = ['-fsanitize=thread'] + qemu_ldflags endif +if get_option('debug') + qemu_cflags += get_option('split_debug') ? ['-gsplit-dwarf'] : ['-g'] +endif + # Detect support for PT_GNU_RELRO + DT_BIND_NOW. # The combination is known as "full relro", because .got.plt is read-only too. qemu_ldflags += cc.get_supported_link_arguments('-Wl,-z,relro', '-Wl,-z,now') @@ -4589,7 +4593,7 @@ if have_rust summary_info += {'bindgen': bindgen.full_path()} summary_info += {'bindgen version': bindgen.version()} endif -option_cflags = (get_option('debug') ? ['-g'] : []) +option_cflags = [] if get_option('optimization') != 'plain' option_cflags += ['-O' + get_option('optimization')] endif diff --git a/meson_options.txt b/meson_options.txt index 59d973bca0..3432123fee 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -362,6 +362,8 @@ option('debug_mutex', type: 'boolean', value: false, description: 'mutex debugging support') option('debug_stack_usage', type: 'boolean', value: false, description: 'measure coroutine stack usage') +option('split_debug', type: 'boolean', value: true, + description: 'split debug info from object files') option('qom_cast_debug', type: 'boolean', value: true, description: 'cast debugging support') option('slirp_smbd', type : 'feature', value : 'auto', diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 3e8e00852b..aca6e68830 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -504,6 +504,8 @@ _meson_option_parse() { --disable-strict-rust-lints) printf "%s" -Dstrict_rust_lints=false ;; --enable-strip) printf "%s" -Dstrip=true ;; --disable-strip) printf "%s" -Dstrip=false ;; + --enable-split-debug) printf "%s" -Dsplit_debug=true ;; + --disable-split-debug) printf "%s" -Dsplit_debug=false ;; --sysconfdir=*) quote_sh "-Dsysconfdir=$2" ;; --enable-tcg) printf "%s" -Dtcg=enabled ;; --disable-tcg) printf "%s" -Dtcg=disabled ;;