qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Eder <nicolas.eder@lauterbach.com>
To: qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Christian Boenig" <christian.boenig@lauterbach.com>,
	"Nicolas Eder" <nicolas.eder@lauterbach.com>
Subject: [PATCH v5 00/18] first version of mcdstub
Date: Wed, 20 Dec 2023 17:25:37 +0100	[thread overview]
Message-ID: <20231220162555.19545-1-nicolas.eder@lauterbach.com> (raw)

SUMMARY
=======

This patch-set introduces the first version of the mcdstub.
The mcdstub is a debug interface, which enables debugging QEMU
using the MCD (Multi-Core Debug) API.
The mcdstub uses TCP to communicate with the host debug software. However,
because MCD is merely an API, the TCP communication is not part of
the MCD spec but specific to this project.

To translate between the MCD API and the TCP data stream coming from the mcdstub,
the host has to use a shared library (.dll/.so).
Such a shared library is available at: https://gitlab.com/lauterbach/mcdrefsrv
The MCD API itself can be downloaded here: https://repo.lauterbach.com/sprint_mcd_api_v1_0.zip

QUICK START
===========

Attention: MCD is currently only supported for qemu-system-arm !

Three components are required to Debug QEMU via MCD:

1. qemu-system-arm (built with this patch series applied).
2. MCD shared library (translates between the MCD API and TCP data).
3. Host debugging software with support for the MCD API (e.g. Lauterbach TRACE32).

To activate the mcdstub, just use the "mcd" launch option in combination with
a TCP port.

With the default TCP port 1235:

$ qemu-system-arm -M virt -cpu cortex-a15 -mcd default

With a custom TCP port:

$ qemu-system-arm -M virt -cpu cortex-a15 -mcd tcp::1235

QEMU will listen for an MCD host to connect to the specified port.

IMPORTANT CHANGES
=================

1. DebugClass:

This patch-set introduces the DebugClass to the QOM, which is used to abstract
GDB/MCD specific debugger details.
It is declared in include/qemu/debug.h, defined in debug/common/debug.c
It currently only offers one function: set_stop_cpu, which gets called
in cpu_handle_guest_debug in softmmu/cpus.c.
In the future, other functions could be moved from the mcd/gdbstub
to the DebugClass.

2. mcd launch option:

This patch-set introduces the mcd launch option to QEMU. The quick start
section describes how to use it.

3. MCD debugging features:

* Go, break, step
* Read/write memory (user space only)
* Read/write registers (GPR and CP)
* Set breakpoints and watchpoints.

=================

Signed-off-by: Nicolas Eder <nicolas.eder@lauterbach.com>

Nicolas Eder (18):
  gdbstub, mcdstub: file and build structure adapted to accomodate for
    the mcdstub
  gdbstub: hex conversion functions moved to cutils.h
  gdbstub: GDBRegisterState moved to gdbstub.h so it can be used outside
    of the gdbstub
  gdbstub: DebugClass added to system mode.
  mcdstub: memory helper functions added
  mcdstub: -mcd start option added, mcd specific defines added
  mcdstub: mcdserver initialization functions added
  cutils: qemu_strtou32 function added
  mcdstub: TCP packet plumbing added
  mcdstub: open and close server functions added
  mcdstub: system and core queries added
  mcdstub: all core specific queries added
  mcdstub: go, step and break added
  mcdstub: state query added
  mcdstub: skeleton for reset handling added
  mcdstub: register access added
  mcdstub: memory access added
  mcdstub: break/watchpoints added

 MAINTAINERS                              |   11 +-
 debug/common/debug.c                     |   51 +
 debug/common/meson.build                 |    1 +
 {gdbstub => debug/gdbstub}/gdbstub.c     |   27 +-
 {gdbstub => debug/gdbstub}/internals.h   |   26 -
 {gdbstub => debug/gdbstub}/meson.build   |    0
 {gdbstub => debug/gdbstub}/syscalls.c    |    0
 {gdbstub => debug/gdbstub}/system.c      |   18 +
 {gdbstub => debug/gdbstub}/trace-events  |    0
 debug/gdbstub/trace.h                    |    1 +
 {gdbstub => debug/gdbstub}/user-target.c |    0
 {gdbstub => debug/gdbstub}/user.c        |    0
 debug/mcdstub/arm_mcdstub.c              |  289 +++
 debug/mcdstub/mcdstub.c                  | 2481 ++++++++++++++++++++++
 debug/mcdstub/meson.build                |   12 +
 debug/meson.build                        |    3 +
 gdbstub/trace.h                          |    1 -
 include/exec/cpu-common.h                |    3 +
 include/exec/gdbstub.h                   |    8 +
 include/exec/memory.h                    |    9 +
 include/hw/boards.h                      |    1 +
 include/mcdstub/arm_mcdstub.h            |  118 +
 include/mcdstub/mcd_shared_defines.h     |  132 ++
 include/mcdstub/mcdstub.h                |  165 ++
 include/mcdstub/mcdstub_common.h         |   83 +
 include/qemu/cutils.h                    |   32 +
 include/qemu/debug.h                     |   38 +
 include/qemu/typedefs.h                  |    2 +
 meson.build                              |    4 +-
 qemu-options.hx                          |   18 +
 system/cpus.c                            |    9 +-
 system/memory.c                          |   11 +
 system/physmem.c                         |   26 +
 system/vl.c                              |   13 +
 util/cutils.c                            |   30 +
 35 files changed, 3575 insertions(+), 48 deletions(-)
 create mode 100644 debug/common/debug.c
 create mode 100644 debug/common/meson.build
 rename {gdbstub => debug/gdbstub}/gdbstub.c (98%)
 rename {gdbstub => debug/gdbstub}/internals.h (92%)
 rename {gdbstub => debug/gdbstub}/meson.build (100%)
 rename {gdbstub => debug/gdbstub}/syscalls.c (100%)
 rename {gdbstub => debug/gdbstub}/system.c (97%)
 rename {gdbstub => debug/gdbstub}/trace-events (100%)
 create mode 100644 debug/gdbstub/trace.h
 rename {gdbstub => debug/gdbstub}/user-target.c (100%)
 rename {gdbstub => debug/gdbstub}/user.c (100%)
 create mode 100644 debug/mcdstub/arm_mcdstub.c
 create mode 100644 debug/mcdstub/mcdstub.c
 create mode 100644 debug/mcdstub/meson.build
 create mode 100644 debug/meson.build
 delete mode 100644 gdbstub/trace.h
 create mode 100644 include/mcdstub/arm_mcdstub.h
 create mode 100644 include/mcdstub/mcd_shared_defines.h
 create mode 100644 include/mcdstub/mcdstub.h
 create mode 100644 include/mcdstub/mcdstub_common.h
 create mode 100644 include/qemu/debug.h

-- 
2.34.1



             reply	other threads:[~2023-12-20 16:28 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-20 16:25 Nicolas Eder [this message]
2023-12-20 16:25 ` [PATCH v5 01/18] gdbstub, mcdstub: file and build structure adapted to accomodate for the mcdstub Nicolas Eder
2024-02-29 15:33   ` Alex Bennée
2023-12-20 16:25 ` [PATCH v5 02/18] gdbstub: hex conversion functions moved to cutils.h Nicolas Eder
2024-02-29 15:33   ` Alex Bennée
2023-12-20 16:25 ` [PATCH v5 03/18] gdbstub: GDBRegisterState moved to gdbstub.h so it can be used outside of the gdbstub Nicolas Eder
2024-02-29 15:23   ` Alex Bennée
2023-12-20 16:25 ` [PATCH v5 04/18] gdbstub: DebugClass added to system mode Nicolas Eder
2024-02-29 16:35   ` Alex Bennée
2024-03-05 11:27     ` nicolas.eder
2023-12-20 16:25 ` [PATCH v5 05/18] mcdstub: memory helper functions added Nicolas Eder
2024-02-29 16:56   ` Alex Bennée
2024-03-05 11:03     ` nicolas.eder
2023-12-20 16:25 ` [PATCH v5 06/18] mcdstub: -mcd start option added, mcd specific defines added Nicolas Eder
2023-12-20 16:25 ` [PATCH v5 07/18] mcdstub: mcdserver initialization functions added Nicolas Eder
2023-12-20 16:25 ` [PATCH v5 08/18] cutils: qemu_strtou32 function added Nicolas Eder
2023-12-20 16:25 ` [PATCH v5 09/18] mcdstub: TCP packet plumbing added Nicolas Eder
2023-12-20 16:25 ` [PATCH v5 10/18] mcdstub: open and close server functions added Nicolas Eder
2023-12-20 16:25 ` [PATCH v5 11/18] mcdstub: system and core queries added Nicolas Eder
2024-02-29 15:11   ` Alex Bennée
2024-03-05 11:08     ` nicolas.eder
2023-12-20 16:25 ` [PATCH v5 12/18] mcdstub: all core specific " Nicolas Eder
2023-12-20 16:25 ` [PATCH v5 13/18] mcdstub: go, step and break added Nicolas Eder
2023-12-20 16:25 ` [PATCH v5 14/18] mcdstub: state query added Nicolas Eder
2023-12-20 16:25 ` [PATCH v5 15/18] mcdstub: skeleton for reset handling added Nicolas Eder
2023-12-20 16:25 ` [PATCH v5 16/18] mcdstub: register access added Nicolas Eder
2023-12-20 16:25 ` [PATCH v5 17/18] mcdstub: memory " Nicolas Eder
2023-12-20 16:25 ` [PATCH v5 18/18] mcdstub: break/watchpoints added Nicolas Eder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231220162555.19545-1-nicolas.eder@lauterbach.com \
    --to=nicolas.eder@lauterbach.com \
    --cc=alex.bennee@linaro.org \
    --cc=christian.boenig@lauterbach.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).