qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/21] gdbstub: re-organise to for better compilation behaviour
@ 2023-01-05 16:42 Alex Bennée
  2023-01-05 16:43 ` [PATCH v2 01/21] gdbstub/internals.h: clean up include guard Alex Bennée
                   ` (20 more replies)
  0 siblings, 21 replies; 55+ messages in thread
From: Alex Bennée @ 2023-01-05 16:42 UTC (permalink / raw)
  To: qemu-devel, alex.bennee
  Cc: David Hildenbrand, Sunil Muthuswamy, Aurelien Jarno,
	Michael Rolnik, Aleksandar Rikalo, Greg Kurz, Ilya Leoshkevich,
	Thomas Huth, qemu-ppc, Laurent Vivier, Max Filippov, Yanan Wang,
	Marek Vasut, Stafford Horne, Peter Maydell,
	Daniel Henrique Barboza, Palmer Dabbelt, Alex Bennée,
	Taylor Simpson, Marcel Apfelbaum, Alexandre Iooss, Chris Wulff,
	Richard Henderson, Eduardo Habkost, Song Gao, Mark Cave-Ayland,
	Cédric Le Goater, Artyom Tarasenko, Paolo Bonzini,
	qemu-riscv, qemu-s390x, Alistair Francis, Edgar E. Iglesias,
	Bastian Koppelmann, Jiaxun Yang, Philippe Mathieu-Daudé,
	Bin Meng, Mahmoud Mandour, David Gibson, Yoshinori Sato,
	Xiaojuan Yang, qemu-arm

I was motivated to sort this out while working on my register API
which is target agnostic but ran into the weeds when trying to link up
with the gdbstub. This was due to us building gdbstub for every single
target we support due to a few ABI sensitive bits that require CPU
specific information. This series does a bunch of surgery to break the
monolithic file apart into its constituent parts as well as simplify
the headers to users can avoid bringing in more dependencies than they
need.

While the final result does increase the number of object files we
reduce the total size of them all. We could go even further if we
manage to build just 2 ABI binaries and sort out the magic to link
them in meson. I think this requires us to removing TARGET_LONG_BITS
from cpu-defs.h and exposing it to the build machinery.

Before:

  🕙16:36:31 alex.bennee@hackbox2:qemu.git/builds/reference  on  gdbstub/next [$?⇕] took 2s
  ➜  find . -iname "gdbstub*.o" -exec echo -n -e {}"\0" \; | du -hc --files0-from=- | tail -n 1
  12M     total
  🕙16:36:42 alex.bennee@hackbox2:qemu.git/builds/reference  on  gdbstub/next  [$?⇕]
  ➜  find . -iname "gdbstub*.o" | wc -l
  68

After:

  ➜  find . -iname "gdbstub*.o" -exec echo -n -e {}"\0" \; | du -hc --files0-from=- | tail -n 1
  4.0M    total
  🕙16:41:42 alex.bennee@hackbox2:qemu.git/builds/all  on  gdbstub/next [$?⇕] took 2s
  ➜  find . -iname "gdbstub*.o" | wc -l
  105

The following patches need review:

gdbstub: only compile gdbstub twice for whole build
gdbstub: move syscall handling to new file
gdbstub: move register helpers into standalone include
gdbstub: don't use target_ulong while handling registers
gdbstub: fix address type of gdb_set_cpu_pc
gdbstub: specialise stub_can_reverse
gdbstub: introduce gdb_get_max_cpus
gdbstub: specialise target_memory_rw_debug
gdbstub: specialise handle_query_attached
gdbstub: abstract target specific details from gdb_put_packet_binary
gdbstub: make various helpers visible to the rest of the module
gdbstub: move fromhex/tohex routines to internals
gdbstub: define separate user/system structures
target/arm: fix handling of HLT semihosting in system mode

Alex Bennée (20):
  gdbstub/internals.h: clean up include guard
  target/arm: fix handling of HLT semihosting in system mode
  gdbstub: fix-up copyright and license files
  gdbstub: define separate user/system structures
  gdbstub: move GDBState to shared internals header
  includes: move tb_flush into its own header
  gdbstub: move fromhex/tohex routines to internals
  gdbstub: make various helpers visible to the rest of the module
  gdbstub: move chunk of softmmu functionality to own file
  gdbstub: move chunks of user code into own files
  gdbstub: abstract target specific details from gdb_put_packet_binary
  gdbstub: specialise handle_query_attached
  gdbstub: specialise target_memory_rw_debug
  gdbstub: introduce gdb_get_max_cpus
  gdbstub: specialise stub_can_reverse
  gdbstub: fix address type of gdb_set_cpu_pc
  gdbstub: don't use target_ulong while handling registers
  gdbstub: move register helpers into standalone include
  gdbstub: move syscall handling to new file
  gdbstub: only compile gdbstub twice for whole build

Philippe Mathieu-Daudé (1):
  gdbstub: Make syscall_complete/[gs]et_reg target-agnostic typedefs

 gdbstub/internals.h                    |  207 ++-
 include/exec/exec-all.h                |    1 -
 include/exec/gdbstub.h                 |  208 ---
 include/exec/tb-flush.h                |   26 +
 include/gdbstub/helpers.h              |  103 ++
 include/gdbstub/syscalls.h             |  124 ++
 include/gdbstub/user.h                 |   43 +
 linux-user/user-internals.h            |    1 +
 accel/stubs/tcg-stub.c                 |    1 +
 accel/tcg/tb-maint.c                   |    1 +
 accel/tcg/translate-all.c              |    1 +
 cpu.c                                  |    1 +
 gdbstub/gdbstub.c                      | 1654 ++----------------------
 gdbstub/softmmu.c                      |  589 ++++++++-
 gdbstub/syscalls.c                     |  230 ++++
 gdbstub/user-target.c                  |  283 ++++
 gdbstub/user.c                         |  406 +++++-
 hw/ppc/spapr_hcall.c                   |    1 +
 linux-user/exit.c                      |    2 +-
 linux-user/main.c                      |    1 +
 linux-user/signal.c                    |    2 +-
 plugins/core.c                         |    1 +
 plugins/loader.c                       |    2 +-
 semihosting/arm-compat-semi.c          |    1 +
 semihosting/guestfd.c                  |    2 +-
 semihosting/syscalls.c                 |    3 +-
 softmmu/runstate.c                     |    2 +-
 target/alpha/gdbstub.c                 |    2 +-
 target/alpha/sys_helper.c              |    1 +
 target/arm/gdbstub.c                   |    1 +
 target/arm/gdbstub64.c                 |    2 +-
 target/arm/helper-a64.c                |    2 +-
 target/arm/m_helper.c                  |    2 +-
 target/arm/translate.c                 |    2 +-
 target/avr/gdbstub.c                   |    2 +-
 target/cris/gdbstub.c                  |    2 +-
 target/hexagon/gdbstub.c               |    2 +-
 target/hppa/gdbstub.c                  |    2 +-
 target/i386/gdbstub.c                  |    2 +-
 target/i386/whpx/whpx-all.c            |    2 +-
 target/loongarch/gdbstub.c             |    1 +
 target/m68k/gdbstub.c                  |    2 +-
 target/m68k/helper.c                   |    1 +
 target/m68k/m68k-semi.c                |    3 +-
 target/microblaze/gdbstub.c            |    2 +-
 target/mips/gdbstub.c                  |    2 +-
 target/mips/tcg/sysemu/mips-semi.c     |    3 +-
 target/nios2/cpu.c                     |    2 +-
 target/nios2/nios2-semi.c              |    3 +-
 target/openrisc/gdbstub.c              |    2 +-
 target/openrisc/interrupt.c            |    2 +-
 target/openrisc/mmu.c                  |    2 +-
 target/ppc/cpu_init.c                  |    2 +-
 target/ppc/gdbstub.c                   |    1 +
 target/riscv/csr.c                     |    1 +
 target/riscv/gdbstub.c                 |    1 +
 target/rx/gdbstub.c                    |    2 +-
 target/s390x/gdbstub.c                 |    1 +
 target/s390x/helper.c                  |    2 +-
 target/sh4/gdbstub.c                   |    2 +-
 target/sparc/gdbstub.c                 |    2 +-
 target/tricore/gdbstub.c               |    2 +-
 target/xtensa/core-dc232b.c            |    2 +-
 target/xtensa/core-dc233c.c            |    2 +-
 target/xtensa/core-de212.c             |    2 +-
 target/xtensa/core-de233_fpu.c         |    2 +-
 target/xtensa/core-dsp3400.c           |    2 +-
 target/xtensa/core-fsf.c               |    2 +-
 target/xtensa/core-lx106.c             |    2 +-
 target/xtensa/core-sample_controller.c |    2 +-
 target/xtensa/core-test_kc705_be.c     |    2 +-
 target/xtensa/core-test_mmuhifi_c3.c   |    2 +-
 target/xtensa/gdbstub.c                |    2 +-
 target/xtensa/helper.c                 |    2 +-
 MAINTAINERS                            |    1 +
 gdbstub/meson.build                    |   35 +-
 gdbstub/trace-events                   |    4 +-
 77 files changed, 2250 insertions(+), 1775 deletions(-)
 create mode 100644 include/exec/tb-flush.h
 create mode 100644 include/gdbstub/helpers.h
 create mode 100644 include/gdbstub/syscalls.h
 create mode 100644 include/gdbstub/user.h
 create mode 100644 gdbstub/syscalls.c
 create mode 100644 gdbstub/user-target.c

-- 
2.34.1



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

end of thread, other threads:[~2023-02-21 10:59 UTC | newest]

Thread overview: 55+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-05 16:42 [PATCH v2 00/21] gdbstub: re-organise to for better compilation behaviour Alex Bennée
2023-01-05 16:43 ` [PATCH v2 01/21] gdbstub/internals.h: clean up include guard Alex Bennée
2023-01-05 17:01   ` Philippe Mathieu-Daudé
2023-01-08 12:51   ` Bin Meng
2023-01-05 16:43 ` [PATCH v2 02/21] target/arm: fix handling of HLT semihosting in system mode Alex Bennée
2023-01-06 20:36   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 03/21] gdbstub: fix-up copyright and license files Alex Bennée
2023-01-05 17:02   ` Philippe Mathieu-Daudé
2023-01-05 16:43 ` [PATCH v2 04/21] gdbstub: Make syscall_complete/[gs]et_reg target-agnostic typedefs Alex Bennée
2023-01-05 16:43 ` [PATCH v2 05/21] gdbstub: define separate user/system structures Alex Bennée
2023-01-06 20:39   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 06/21] gdbstub: move GDBState to shared internals header Alex Bennée
2023-01-06 20:42   ` Richard Henderson
2023-02-21 10:24     ` Alex Bennée
2023-02-21 10:36       ` Richard Henderson
2023-02-21 10:58         ` Alex Bennée
2023-01-05 16:43 ` [PATCH v2 07/21] includes: move tb_flush into its own header Alex Bennée
2023-01-05 16:43 ` [PATCH v2 08/21] gdbstub: move fromhex/tohex routines to internals Alex Bennée
2023-01-06 20:43   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 09/21] gdbstub: make various helpers visible to the rest of the module Alex Bennée
2023-01-05 17:09   ` Philippe Mathieu-Daudé
2023-01-06 21:37   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 10/21] gdbstub: move chunk of softmmu functionality to own file Alex Bennée
2023-01-06 21:51   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 11/21] gdbstub: move chunks of user code into own files Alex Bennée
2023-01-06 21:56   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 12/21] gdbstub: abstract target specific details from gdb_put_packet_binary Alex Bennée
2023-01-05 17:13   ` Philippe Mathieu-Daudé
2023-01-06 21:57   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 13/21] gdbstub: specialise handle_query_attached Alex Bennée
2023-01-05 17:22   ` Philippe Mathieu-Daudé
2023-01-06 21:59   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 14/21] gdbstub: specialise target_memory_rw_debug Alex Bennée
2023-01-06 23:14   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 15/21] gdbstub: introduce gdb_get_max_cpus Alex Bennée
2023-01-06 23:16   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 16/21] gdbstub: specialise stub_can_reverse Alex Bennée
2023-01-05 17:25   ` Philippe Mathieu-Daudé
2023-01-06 23:17   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 17/21] gdbstub: fix address type of gdb_set_cpu_pc Alex Bennée
2023-01-05 17:26   ` Philippe Mathieu-Daudé
2023-01-06 23:19   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 18/21] gdbstub: don't use target_ulong while handling registers Alex Bennée
2023-01-05 17:28   ` Philippe Mathieu-Daudé
2023-01-06 23:24     ` Richard Henderson
2023-01-06 23:23   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 19/21] gdbstub: move register helpers into standalone include Alex Bennée
2023-01-05 16:56   ` Taylor Simpson
2023-01-05 17:30   ` Philippe Mathieu-Daudé
2023-01-05 19:05   ` Max Filippov
2023-01-06 23:28   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 20/21] gdbstub: move syscall handling to new file Alex Bennée
2023-01-06 23:46   ` Richard Henderson
2023-01-05 16:43 ` [PATCH v2 21/21] gdbstub: only compile gdbstub twice for whole build Alex Bennée
2023-01-06 23:55   ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).