]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
gdbstub: Generate a single gdbstub-xml.c / gdb_static_features[]
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 10 Mar 2026 23:20:44 +0000 (00:20 +0100)
committerPierrick Bouvier <pierrick.bouvier@linaro.org>
Wed, 11 Mar 2026 00:12:18 +0000 (17:12 -0700)
gdb_static_features[] does not depend on target-specific code.
Instead of generating one file per target, generate a single file
with a single gdb_static_features[] array.

Co-developed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Acked-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260310232045.58440-17-philmd@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
gdbstub/gdb-xml-stub.c [moved from stubs/gdbstub.c with 100% similarity]
gdbstub/meson.build
meson.build
stubs/meson.build

similarity index 100%
rename from stubs/gdbstub.c
rename to gdbstub/gdb-xml-stub.c
index 15c666f575210ae67a4a17f378e6fb298c820ffd..b61d2e915c188862de9d6bbdde366b3314204754 100644 (file)
@@ -4,6 +4,29 @@
 # types such as hwaddr.
 #
 
+gdbstub_xml_files = []
+foreach target : target_dirs
+  config_target = config_target_mak[target]
+  if 'TARGET_XML_FILES' in config_target
+    foreach gdbstub_xml : config_target['TARGET_XML_FILES'].split()
+      if not gdbstub_xml_files.contains('gdb-xml/' + gdbstub_xml)
+        gdbstub_xml_files += 'gdb-xml/' + gdbstub_xml
+      endif
+    endforeach
+  endif
+endforeach
+if gdbstub_xml_files.length() > 0
+  feature_to_c = find_program('../scripts/feature_to_c.py')
+  gdbstub_xml = custom_target('gdbstub-xml.c',
+                              output: 'gdbstub-xml.c',
+                              input: files(gdbstub_xml_files),
+                              command: [feature_to_c, '@INPUT@'],
+                              capture: true)
+else
+  gdbstub_xml = files('gdb-xml-stub.c')
+endif
+common_ss.add(gdbstub_xml)
+
 # We build two versions of gdbstub, one for each mode
 user_ss.add(files(
   'gdbstub.c',
index 503cde5ea900972e19ca6d2cf48c9cafc2b69438..538efb7092d684fdd9c6b43b6661267493f0b1b2 100644 (file)
@@ -4248,7 +4248,6 @@ if have_rust
 endif
 
 
-feature_to_c = find_program('scripts/feature_to_c.py')
 rust_root_crate = find_program('scripts/rust/rust_root_crate.sh')
 
 if host_os == 'darwin'
@@ -4328,19 +4327,6 @@ foreach target : target_dirs
     endif
   endif
 
-  if 'TARGET_XML_FILES' in config_target
-    gdbstub_xml_files = []
-    foreach gdbstub_xml : config_target['TARGET_XML_FILES'].split()
-      gdbstub_xml_files += 'gdbstub/gdb-xml/' + gdbstub_xml
-    endforeach
-    gdbstub_xml = custom_target(target + '-gdbstub-xml.c',
-                                output: target + '-gdbstub-xml.c',
-                                input: files(gdbstub_xml_files),
-                                command: [feature_to_c, '@INPUT@'],
-                                capture: true)
-    arch_srcs += gdbstub_xml
-  endif
-
   if target in config_target_info
     arch_srcs += config_target_info[target]
   else
index fad796a49da0e96975341ed87b59cbd58db20ca5..7189ff63ed502e1d145cb8361428509ca3de199a 100644 (file)
@@ -89,8 +89,6 @@ if have_system
 endif
 
 if have_system or have_user
-  stub_ss.add(files('gdbstub.c'))
-
   # Also included in have_system for --disable-tcg builds
   stub_ss.add(files('replay.c'))