public inbox for qemu-devel@nongnu.org
 help / color / mirror / Atom feed
* [PATCH] meson.build: Add --enable-use-pdb option
@ 2026-03-18 19:18 Steve Aarnio
  2026-03-19  1:24 ` Mohamed Mediouni
  2026-03-22 11:56 ` Michael Tokarev
  0 siblings, 2 replies; 7+ messages in thread
From: Steve Aarnio @ 2026-03-18 19:18 UTC (permalink / raw)
  To: qemu-devel@nongnu.org; +Cc: qemu-trivial@nongnu.org

[-- Attachment #1: Type: text/plain, Size: 1611 bytes --]

This option will (attempt to) modify the QEMU compile and link flags to
emit PDB symbol files rather than the standard (DWARF?) symbol output
from gcc/clang.

This enables using native Windows debug tools (Windbg/Visual Studio) for
debugging QEMU.

Signed-off-by: Steve Aarnio <saarnio@qti.qualcomm.com>
---
 meson.build       | 5 +++++
 meson_options.txt | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/meson.build b/meson.build
index d7c4095b39..d27581e0c2 100644
--- a/meson.build
+++ b/meson.build
@@ -692,6 +692,11 @@ endif

 qemu_common_flags += hardening_flags

+if get_option('debug') and get_option('use_pdb')
+  qemu_common_flags += cc.get_supported_arguments('-g','-gcodeview','-gcolumn-info','-fno-omit-frame-pointer')
+  qemu_ldflags += cc.get_supported_link_arguments('-g','-Wl,--pdb=')
+endif
+
 # Collect warning flags we want to set, sorted alphabetically
 warn_flags = [
   # First enable interesting warnings
diff --git a/meson_options.txt b/meson_options.txt
index 31d5916cfc..b1f3250d5c 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -372,6 +372,8 @@ option('debug_stack_usage', type: 'boolean', value: false,
        description: 'measure coroutine stack usage')
 option('qom_cast_debug', type: 'boolean', value: true,
        description: 'cast debugging support')
+option('use_pdb', type: 'boolean', value: false,
+       description: 'use pdb symbol format on debug windows builds')
 option('slirp_smbd', type : 'feature', value : 'auto',
        description: 'use smbd (at path --smbd=*) in slirp networking')

--
2.53.0


[-- Attachment #2: Type: text/html, Size: 9915 bytes --]

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] meson.build: Add --enable-use-pdb option
  2026-03-18 19:18 [PATCH] meson.build: Add --enable-use-pdb option Steve Aarnio
@ 2026-03-19  1:24 ` Mohamed Mediouni
  2026-03-19 15:55   ` Steve Aarnio
  2026-03-22 11:56 ` Michael Tokarev
  1 sibling, 1 reply; 7+ messages in thread
From: Mohamed Mediouni @ 2026-03-19  1:24 UTC (permalink / raw)
  To: Steve Aarnio; +Cc: qemu-devel@nongnu.org, qemu-trivial@nongnu.org



> On 18. Mar 2026, at 20:18, Steve Aarnio <saarnio@qti.qualcomm.com> wrote:
> 
> This option will (attempt to) modify the QEMU compile and link flags to
> emit PDB symbol files rather than the standard (DWARF?) symbol output
> from gcc/clang.
> 
> This enables using native Windows debug tools (Windbg/Visual Studio) for
> debugging QEMU.
> 
> Signed-off-by: Steve Aarnio <saarnio@qti.qualcomm.com>


Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr>

Already used something like this, it makes Windows debugging substantially easier.
> ---
>  meson.build       | 5 +++++
>  meson_options.txt | 2 ++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index d7c4095b39..d27581e0c2 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -692,6 +692,11 @@ endif
>   qemu_common_flags += hardening_flags
>  +if get_option('debug') and get_option('use_pdb')
> +  qemu_common_flags += cc.get_supported_arguments('-g','-gcodeview','-gcolumn-info','-fno-omit-frame-pointer')
> +  qemu_ldflags += cc.get_supported_link_arguments('-g','-Wl,--pdb=')
> +endif
> +
>  # Collect warning flags we want to set, sorted alphabetically
>  warn_flags = [
>    # First enable interesting warnings
> diff --git a/meson_options.txt b/meson_options.txt
> index 31d5916cfc..b1f3250d5c 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -372,6 +372,8 @@ option('debug_stack_usage', type: 'boolean', value: false,
>         description: 'measure coroutine stack usage')
>  option('qom_cast_debug', type: 'boolean', value: true,
>         description: 'cast debugging support')
> +option('use_pdb', type: 'boolean', value: false,
> +       description: 'use pdb symbol format on debug windows builds')
>  option('slirp_smbd', type : 'feature', value : 'auto',
>         description: 'use smbd (at path --smbd=*) in slirp networking')
>  -- 
> 2.53.0




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] meson.build: Add --enable-use-pdb option
  2026-03-19  1:24 ` Mohamed Mediouni
@ 2026-03-19 15:55   ` Steve Aarnio
  0 siblings, 0 replies; 7+ messages in thread
From: Steve Aarnio @ 2026-03-19 15:55 UTC (permalink / raw)
  To: Mohamed Mediouni; +Cc: qemu-devel@nongnu.org, qemu-trivial@nongnu.org

[-- Attachment #1: Type: text/plain, Size: 2380 bytes --]

>> On 18. Mar 2026, at 20:18, Steve Aarnio <saarnio@qti.qualcomm.com> wrote:
>>
>> This option will (attempt to) modify the QEMU compile and link flags to
>> emit PDB symbol files rather than the standard (DWARF?) symbol output
>> from gcc/clang.
>>
>> This enables using native Windows debug tools (Windbg/Visual Studio) for
>> debugging QEMU.
>>
>> Signed-off-by: Steve Aarnio <saarnio@qti.qualcomm.com>
>
>
> Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr>
>
> Already used something like this, it makes Windows debugging substantially easier.

@Mohamed Mediouni<mailto:mohamed@unpredictable.fr>, thank you for the quick review. First, thank you for your WHPX on AARCH64 Windows - no more waiting 20 minutes for the guest to boot, which is amazing. Second, regarding this patch, are there other flags that you used for your work that I have missed here? I've had reasonable success with these, just wondering if there's something that I may have missed.

>> ---
>>  meson.build       | 5 +++++
>> meson_options.txt | 2 ++
>>  2 files changed, 7 insertions(+)
>>
>> diff --git a/meson.build b/meson.build
>> index d7c4095b39..d27581e0c2 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -692,6 +692,11 @@ endif
>>   qemu_common_flags += hardening_flags
>>  +if get_option('debug') and get_option('use_pdb')
>> +  qemu_common_flags += cc.get_supported_arguments('-g','-gcodeview','-gcolumn-info','-fno-omit-frame-pointer')
>> +  qemu_ldflags += cc.get_supported_link_arguments('-g','-Wl,--pdb=')
>> +endif
>> +
>>  # Collect warning flags we want to set, sorted alphabetically
>>  warn_flags = [
>>    # First enable interesting warnings
>> diff --git a/meson_options.txt b/meson_options.txt
>> index 31d5916cfc..b1f3250d5c 100644
>> --- a/meson_options.txt
>> +++ b/meson_options.txt
>> @@ -372,6 +372,8 @@ option('debug_stack_usage', type: 'boolean', value: false,
>>         description: 'measure coroutine stack usage')
>>  option('qom_cast_debug', type: 'boolean', value: true,
>>         description: 'cast debugging support')
>> +option('use_pdb', type: 'boolean', value: false,
>> +       description: 'use pdb symbol format on debug windows builds')
>>  option('slirp_smbd', type : 'feature', value : 'auto',
>>         description: 'use smbd (at path --smbd=*) in slirp networking')
>>  --
>> 2.53.0



[-- Attachment #2: Type: text/html, Size: 4298 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] meson.build: Add --enable-use-pdb option
  2026-03-18 19:18 [PATCH] meson.build: Add --enable-use-pdb option Steve Aarnio
  2026-03-19  1:24 ` Mohamed Mediouni
@ 2026-03-22 11:56 ` Michael Tokarev
  2026-03-22 12:21   ` Mohamed Mediouni
  1 sibling, 1 reply; 7+ messages in thread
From: Michael Tokarev @ 2026-03-22 11:56 UTC (permalink / raw)
  To: Steve Aarnio, qemu-devel@nongnu.org; +Cc: qemu-trivial@nongnu.org

On 18.03.2026 22:18, Steve Aarnio wrote:
> This option will (attempt to) modify the QEMU compile and link flags to
> emit PDB symbol files rather than the standard (DWARF?) symbol output
> from gcc/clang.
> 
> This enables using native Windows debug tools (Windbg/Visual Studio) for
> debugging QEMU.

While the change looks good (but please don't use html or
quoted-printable encoding when sending patches), the name for
the option is a bit.. non-English, so to say.  It might be
--enable-pdb for example, or --use-pdb, but probably not
what's suggested initially.   There's one more possible issue
with this approach: when pdb isn't supported by the compiler,
this option is silently ignored, instead of giving some
useful diagnostics.

Overall, I think there's no need to have separate option especially
for pdb, - it can be enabled on windows when --enable-debug is
specified (or is it --debug? I don't remember).

This code:

option_cflags = (get_option('debug') ? ['-g'] : [])

can be extended to add the necessary compiler options.

Thanks,

/mjt

> Signed-off-by: Steve Aarnio <saarnio@qti.qualcomm.com>
> ---
>   meson.build       | 5 +++++
>   meson_options.txt | 2 ++
>   2 files changed, 7 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index d7c4095b39..d27581e0c2 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -692,6 +692,11 @@ endif
>   qemu_common_flags += hardening_flags
> +if get_option('debug') and get_option('use_pdb')
> +  qemu_common_flags += cc.get_supported_arguments('-g','-gcodeview','- 
> gcolumn-info','-fno-omit-frame-pointer')
> +  qemu_ldflags += cc.get_supported_link_arguments('-g','-Wl,--pdb=')
> +endif
> +
>   # Collect warning flags we want to set, sorted alphabetically
>   warn_flags = [
>     # First enable interesting warnings
> diff --git a/meson_options.txt b/meson_options.txt
> index 31d5916cfc..b1f3250d5c 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -372,6 +372,8 @@ option('debug_stack_usage', type: 'boolean', value: 
> false,
>          description: 'measure coroutine stack usage')
>   option('qom_cast_debug', type: 'boolean', value: true,
>          description: 'cast debugging support')
> +option('use_pdb', type: 'boolean', value: false,
> +       description: 'use pdb symbol format on debug windows builds')
>   option('slirp_smbd', type : 'feature', value : 'auto',
>          description: 'use smbd (at path --smbd=*) in slirp networking')
> -- 
> 2.53.0
> 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] meson.build: Add --enable-use-pdb option
  2026-03-22 11:56 ` Michael Tokarev
@ 2026-03-22 12:21   ` Mohamed Mediouni
  2026-03-23 17:44     ` [PATCH v2 1/1] meson.build: Add --enable-pdb option Steve Aarnio
  0 siblings, 1 reply; 7+ messages in thread
From: Mohamed Mediouni @ 2026-03-22 12:21 UTC (permalink / raw)
  To: Michael Tokarev
  Cc: Steve Aarnio, qemu-devel@nongnu.org, qemu-trivial@nongnu.org


> On 22. Mar 2026, at 12:56, Michael Tokarev <mjt@tls.msk.ru> wrote:
> 
> Overall, I think there's no need to have separate option especially
> for pdb, - it can be enabled on windows when --enable-debug is
> specified (or is it --debug? I don't remember).
> 
> This code:
> 
> option_cflags = (get_option('debug') ? ['-g'] : [])
> 
> can be extended to add the necessary compiler options.

Hello,

I think that’s a bit suboptimal because while Clang can generate PDBs, the same
isn’t true for a GCC build, where gdb + DWARF is in practice preferred instead.

A converter exists at https://github.com/rainers/cv2pdb however to cover the GCC
case but the compiler won’t do it by itself.

And people might also want to use gdb/lldb when they can :)

Thanks,
-Mohamed

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/1] meson.build: Add --enable-pdb option
  2026-03-22 12:21   ` Mohamed Mediouni
@ 2026-03-23 17:44     ` Steve Aarnio
  2026-03-23 21:32       ` Mohamed Mediouni
  0 siblings, 1 reply; 7+ messages in thread
From: Steve Aarnio @ 2026-03-23 17:44 UTC (permalink / raw)
  To: Mohamed Mediouni, Michael Tokarev
  Cc: qemu-devel@nongnu.org, qemu-trivial@nongnu.org

This option will (attempt to) modify the QEMU compile and link flags to
emit PDB symbol files rather than the standard (DWARF?) symbol output
from gcc/clang. Prerequisites for this are host_os == Windows and
--enable-debug flag set.

This enables using native Windows debug tools (Windbg/Visual Studio) for
debugging QEMU.

Signed-off-by: Steve Aarnio <saarnio@qti.qualcomm.com>
---
 meson.build       | 5 +++++
 meson_options.txt | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/meson.build b/meson.build
index d7c4095b39..e6f17dd5f7 100644
--- a/meson.build
+++ b/meson.build
@@ -692,6 +692,11 @@ endif

 qemu_common_flags += hardening_flags

+if host_os == 'windows' and get_option('debug') and get_option('pdb')
+  qemu_common_flags += cc.get_supported_arguments('-g','-gcodeview','-gcolumn-info','-fno-omit-frame-pointer')
+  qemu_ldflags += cc.get_supported_link_arguments('-g','-Wl,--pdb=')
+endif
+
 # Collect warning flags we want to set, sorted alphabetically
 warn_flags = [
   # First enable interesting warnings
diff --git a/meson_options.txt b/meson_options.txt
index 31d5916cfc..bffbc7923d 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -372,6 +372,8 @@ option('debug_stack_usage', type: 'boolean', value: false,
        description: 'measure coroutine stack usage')
 option('qom_cast_debug', type: 'boolean', value: true,
        description: 'cast debugging support')
+option('pdb', type: 'boolean', value: false,
+       description: 'use pdb symbol format on Windows debug builds')
 option('slirp_smbd', type : 'feature', value : 'auto',
        description: 'use smbd (at path --smbd=*) in slirp networking')

--
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/1] meson.build: Add --enable-pdb option
  2026-03-23 17:44     ` [PATCH v2 1/1] meson.build: Add --enable-pdb option Steve Aarnio
@ 2026-03-23 21:32       ` Mohamed Mediouni
  0 siblings, 0 replies; 7+ messages in thread
From: Mohamed Mediouni @ 2026-03-23 21:32 UTC (permalink / raw)
  To: Steve Aarnio
  Cc: Michael Tokarev, qemu-devel@nongnu.org, qemu-trivial@nongnu.org


> On 23. Mar 2026, at 18:44, Steve Aarnio <saarnio@qti.qualcomm.com> wrote:
> 
> This option will (attempt to) modify the QEMU compile and link flags to
> emit PDB symbol files rather than the standard (DWARF?) symbol output
> from gcc/clang. Prerequisites for this are host_os == Windows and
> --enable-debug flag set.
> 
> This enables using native Windows debug tools (Windbg/Visual Studio) for
> debugging QEMU.
> 
> Signed-off-by: Steve Aarnio <saarnio@qti.qualcomm.com>
> ---
> meson.build       | 5 +++++
> meson_options.txt | 2 ++
> 2 files changed, 7 insertions(+)

Hello,

A small thing on top:

diff --git a/configure b/configure
index cd1dadd8bb..e355484921 100755
--- a/configure
+++ b/configure
@@ -709,6 +709,9 @@ for opt do
       meson_option_add -Doptimization=0
       default_cflags='-O0 -g'
   ;;
+  --enable-pdb)
+      meson_option_add -Dpdb=true
+  ;;
   --disable-tcg) tcg="disabled"
   ;;
   --enable-tcg) tcg=“enabled"




^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-23 21:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-18 19:18 [PATCH] meson.build: Add --enable-use-pdb option Steve Aarnio
2026-03-19  1:24 ` Mohamed Mediouni
2026-03-19 15:55   ` Steve Aarnio
2026-03-22 11:56 ` Michael Tokarev
2026-03-22 12:21   ` Mohamed Mediouni
2026-03-23 17:44     ` [PATCH v2 1/1] meson.build: Add --enable-pdb option Steve Aarnio
2026-03-23 21:32       ` Mohamed Mediouni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox