qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v3 00/20] first version of mcdstub


From: Nicolas Eder
Subject: [PATCH v3 00/20] first version of mcdstub
Date: Tue, 7 Nov 2023 14:03:03 +0100

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 will be available soon Lauterbach's open source site
and will be linked to from inside this project in a future patch.
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/debug-common.c
and configured in debug/debug-gdb.c and debug/debug-mcd.c respectively.
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 (20):
  mcdstub: initial file structure for new mcdstub created. -mcd QEMU
    startup option added. Functions for initializing the mcdstub added.
    Basic helper functions for processes/cpus in the mcdstub added
  mcdstub gdbstub: new DebugClass and DebugState introduced. They are
    used to abstract the debugger details behind a QOM. This is
    currently used in the cpu_handle_guest_debug function
  gdbstub: moving code so that it can be easier accessed from outside
    the gdbstub: fromhex and tohex functions moved to a cutils header.
    GDBRegisterState moved to gdbstub.h
  mcdstub: added header with defines specific to the mcd tcp packet
    communication
  mcdstub: tcp packet processing added
  mcdstub: open/close server functions and trigger/reset data added.
    User for initial connection with an mcd client
  mcdstub: quitting QEMU via mcd command added
  mcdstub: query packet processing added and core/system querie added
  mcdstub: open/close core added. This includes core specific data
    preparation: memory spaces, register groups and registers. This data
    preparation is done in the arm mcdstub
  mcdstub: state query added: this query collects information about the
    state of a specific core. This commit also includes
    mcd_vm_state_change, which is called when the cpu state changes
    because it collects data for the query
  mcdstub: reset and trigger queries added
  mcdstub: missing parse_reg_xml function for parsing gdb register xml
    files added
  mcdstub: added queries for memory spaces, register groups and
    registers
  mcdstub: missing handle_query_state function added
  mcdstub: added go, break and step functionality and all corresponding
    functions
  mcdstub: function construct for resets added
  mcdstub: reading/writing registers added
  mcdstub: read/write to memory added: This also includes various helper
    functions in the QEMU memory code
  mcdstub: break/watchpoints added
  mcdstub: updated MAINTAINERS file and fully activated the mcdstub in
    the meson build system

 MAINTAINERS                          |   11 +
 debug/debug-common.c                 |   42 +
 debug/debug-gdb.c                    |   24 +
 debug/debug-mcd.c                    |   25 +
 gdbstub/gdbstub.c                    |    9 +-
 gdbstub/internals.h                  |   26 -
 gdbstub/meson.build                  |    4 +-
 gdbstub/system.c                     |    4 +
 gdbstub/user.c                       |    2 +
 include/cutils.h                     |   30 +
 include/exec/cpu-common.h            |    2 +
 include/exec/gdbstub.h               |   14 +-
 include/exec/memory.h                |    9 +
 include/hw/boards.h                  |    1 +
 include/mcdstub/arm_mcdstub.h        |  107 ++
 include/mcdstub/mcd_shared_defines.h |  108 ++
 include/mcdstub/mcdstub.h            |  893 ++++++++++++
 include/mcdstub/mcdstub_common.h     |   59 +
 include/qemu/debug.h                 |   19 +
 include/qemu/typedefs.h              |    2 +
 mcdstub/mcdstub.c                    | 1998 ++++++++++++++++++++++++++
 mcdstub/meson.build                  |   15 +
 meson.build                          |    1 +
 qemu-options.hx                      |   18 +
 system/cpus.c                        |    9 +-
 system/memory.c                      |   11 +
 system/physmem.c                     |   26 +
 system/vl.c                          |   13 +
 target/arm/mcdstub.c                 |  304 ++++
 target/arm/meson.build               |    1 +
 30 files changed, 3749 insertions(+), 38 deletions(-)
 create mode 100644 debug/debug-common.c
 create mode 100644 debug/debug-gdb.c
 create mode 100644 debug/debug-mcd.c
 create mode 100644 include/cutils.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
 create mode 100644 mcdstub/mcdstub.c
 create mode 100644 mcdstub/meson.build
 create mode 100644 target/arm/mcdstub.c

-- 
2.34.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]