first version of mcdstub
PATCH 1/1 first version of mcdstub
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.
=================
From 107b25f36232d039c7ba8292eb73c907ed1ac24f Mon Sep 17 00:00:00 2001
From: Nicolas Eder <[email protected]>
Date: Wed, 26 Apr 2023 09:42:53 +0200
Subject: [PATCH 01/29] mcdstub initial commit, mcdstub file structure added
--- include/exec/mcdstub.h | 31 +++++++++++++ mcdstub/mcd_softmmu.c | 85 +++++++++++++++++++++++++++++++++++ mcdstub/mcd_syscalls.c | 0 mcdstub/mcd_tcp_server.c | 95 ++++++++++++++++++++++++++++++++++++++++ mcdstub/mcdstub.c | 0 softmmu/vl.c | 4 ++ 6 files changed, 215 insertions(+) create mode 100644 include/exec/mcdstub.h create mode 100644 mcdstub/mcd_softmmu.c create mode 100644 mcdstub/mcd_syscalls.c create mode 100644 mcdstub/mcd_tcp_server.c create mode 100644 mcdstub/mcdstub.c
include/exec/mcdstub.h new file +31 -0
@@ -0,0 +1,31 @@ +#ifndef MCDSTUB_H +#define MCDSTUB_H + +#define DEFAULT_MCDSTUB_PORT "1234" + +/* MCD breakpoint/watchpoint types */ +#define MCD_BREAKPOINT_SW 0 +#define MCD_BREAKPOINT_HW 1 +#define MCD_WATCHPOINT_WRITE 2 +#define MCD_WATCHPOINT_READ 3 +#define MCD_WATCHPOINT_ACCESS 4 + + +/* Get or set a register. Returns the size of the register. */ +typedef int (*gdb_get_reg_cb )(CPUArchState *env,GByteArray *buf,int reg); +typedef int (*gdb_set_reg_cb )(CPUArchState *env,uint8_t *buf,int reg); +void gdb_register_coprocessor (CPUState *cpu, +gdb_get_reg_cb get_reg,gdb_set_reg_cb set_reg, +int num_regs,const char *xml,int g_pos); + +/** +* mcdserver_start: start the mcd server +* @port_or_device: connection spec for mcd +* +* This is a TCP port +*/ +int mcdserver_start (const char *port_or_device); + +void gdb_set_stop_cpu (CPUState *cpu); + +#endif
mcdstub/mcd_softmmu.c new file +85 -0
86 lines not on this page · raw message
mcdstub/mcd_syscalls.c new file +0 -0
mcdstub/mcd_tcp_server.c new file +95 -0
95 lines not on this page · raw message
mcdstub/mcdstub.c new file +0 -0
softmmu/vl.c +4 -0
@@ -1258,6 +1258,7 @@ struct device_config {DEV_PARALLEL ,/* -parallel */ DEV_DEBUGCON ,/* -debugcon */ DEV_GDB ,/* -gdb, -s */ +DEV_MCD ,/* -mcd */ DEV_SCLP ,/* s390 sclp */ } type;const char *cmdline;
@@ -3011,6 +3012,9 @@ void qemu_init(int argc, char **argv)case QEMU_OPTION_gdb:add_device_config (DEV_GDB , optarg);break ; +case QEMU_OPTION_mcd: +add_device_config (DEV_MCD , optarg); +break ;case QEMU_OPTION_L :if (is_help_option (optarg)) { list_data_dirs = true;
Signature · 26 lines
2.34.1 From f35f32173f89612158c5618f2e52f3371a004f3b Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Fri, 28 Apr 2023 10:19:33 +0200 Subject: [PATCH 02/29] TCP chardev added, handshake with TRACE32 working Signed-off-by: Nicolas Eder <[email protected]> --- gdbstub/gdbstub.c | 2 +- include/exec/mcdstub.h | 21 +- include/mcdstub/syscalls.h | 6 + mcdstub/internals.h | 135 ++++++++++ mcdstub/mcd_softmmu.c | 218 +++++++++++----- mcdstub/mcd_syscalls.c | 20 ++ mcdstub/mcd_tcp_server.c | 2 +- mcdstub/mcdstub.c | 519 +++++++++++++++++++++++++++++++++++++ mcdstub/meson.build | 25 ++ meson.build | 1 + qemu-options.hx | 25 ++ softmmu/vl.c | 9 + 12 files changed, 901 insertions(+), 82 deletions(-) create mode 100644 include/mcdstub/syscalls.h create mode 100644 mcdstub/internals.h create mode 100644 mcdstub/meson.build
gdbstub/gdbstub.c +1 -1
@@ -857,7 +857,7 @@ static int process_string_cmd(const char *data,if (cmd->schema) {if (cmd_parse_params (&data[strlen (cmd->cmd)], - cmd->schema, params)) { + cmd->schema, params)) {return -1 ; } }
include/exec/mcdstub.h +7 -14
@@ -1,7 +1,10 @@#ifndef MCDSTUB_H #define MCDSTUB_H -#define DEFAULT_MCDSTUB_PORT "1234" +#define DEFAULT_MCDSTUB_PORT "1235" +#define TYPE_CHARDEV_MCD "chardev-mcd" +#define MX_INPUT_LENGTH 9 +#define MCD_TCP_DATALEN 80/* MCD breakpoint/watchpoint types */ #define MCD_BREAKPOINT_SW 0
@@ -10,22 +13,12 @@#define MCD_WATCHPOINT_READ 3#define MCD_WATCHPOINT_ACCESS 4 - -/* Get or set a register. Returns the size of the register. */ -typedef int (*gdb_get_reg_cb )(CPUArchState *env,GByteArray *buf,int reg); -typedef int (*gdb_set_reg_cb )(CPUArchState *env,uint8_t *buf,int reg); -void gdb_register_coprocessor (CPUState *cpu, -gdb_get_reg_cb get_reg,gdb_set_reg_cb set_reg, -int num_regs,const char *xml,int g_pos); -/** -* mcdserver_start: start the mcd server -* @port_or_device: connection spec for mcd +* mcd_tcp_server_start: start the tcp server to connect via mcd +* @device: connection spec for mcd * * This is a TCP port */ -int mcdserver_start (const char *port_or_device); - -void gdb_set_stop_cpu (CPUState *cpu); +int mcdserver_start (const char *device);#endif
include/mcdstub/syscalls.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef _SYSCALLS_H_ +#define _SYSCALLS_H_ + +typedef void (*gdb_syscall_complete_cb )(CPUState *cpu,uint64_t ret,int err); + +#endif /* _SYSCALLS_H_ */
mcdstub/internals.h new file +135 -0
135 lines not on this page · raw message
mcdstub/mcd_softmmu.c +152 -66
239 lines not on this page · raw message
mcdstub/mcd_syscalls.c +20 -0
@@ -0,0 +1,20 @@ +#include "qemu/osdep.h" +#include "qemu/error-report.h" +#include "semihosting/semihost.h" +#include "sysemu/runstate.h" +#include "mcdstub/syscalls.h" +//#include "trace.h" +#include "internals.h" + +typedef struct { +char syscall_buf[256 ]; +//TODO: this needs to be get fixed mcd_syscall_complete_cb +int current_syscall_cb; +}MCDSyscallState ; + +static MCDSyscallState mcdserver_syscall_state; + +void mcd_syscall_reset (void ) +{ + mcdserver_syscall_state.current_syscall_cb =0 ; +}
mcdstub/mcd_tcp_server.c +1 -1
@@ -6,8 +6,8 @@#include <sys/socket.h> #include <sys/types.h> #include <unistd.h> // read(), write(), close() +#include "exec/mcdstub.h" #define MAX 80 -#define DEFAULT_MCDSTUB_PORT "1234"#define SA struct sockaddr// Function designed for chat between client and server.
mcdstub/mcdstub.c +519 -0
520 lines not on this page · raw message
mcdstub/meson.build new file +25 -0
@@ -0,0 +1,25 @@ +# +# The main gdbstub still relies on per-build definitions of various +# types. The bits pushed to softmmu/user.c try to use guest agnostic +# types such as hwaddr. +# + +# We need to build the core mcd code via a library to be able to tweak +# cflags so: + +mcd_softmmu_ss = ss.source_set() + +# We build one version of the mcdstub, because it only needs to work for system emulation +mcd_softmmu_ss.add(files('mcdstub.c')) + +mcd_softmmu_ss = mcd_softmmu_ss.apply(config_host, strict: false) + +libmcd_softmmu = static_library('mcd_softmmu', + mcd_softmmu_ss.sources() + genh, + name_suffix: 'fa') + +mcd_softmmu = declare_dependency(link_whole: libmcd_softmmu) +softmmu_ss.add(mcd_softmmu) + +# this might cause problems because we don't support user mode +common_ss.add(files('mcd_syscalls.c'))
meson.build +1 -0
@@ -3356,6 +3356,7 @@ subdir('crypto') subdir('ui') subdir('hw') subdir('gdbstub') +subdir('mcdstub') if enable_modules libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO')
qemu-options.hx +25 -0
@@ -4414,6 +4414,31 @@ SRST (see the :ref:`GDB usage` chapter in the System Emulation Users Guide). ERST +DEF("mcd", HAS_ARG, QEMU_OPTION_mcd, \ + "-mcd dev accept mcd connection on 'dev'. (QEMU defaults to starting\n" + " the guest without waiting for a mcd client to connect; use -S too\n" + " if you want it to not start execution.)\n", + QEMU_ARCH_ALL) +SRST +``-mcd dev`` + Accept a mcd connection on device dev. Note that this option does not pause QEMU + execution -- if you want QEMU to not start the guest until you + connect with mcd and issue a ``run`` command, you will need to + also pass the ``-S`` option to QEMU. + + The most usual configuration is to listen on a local TCP socket:: + + -mcd tcp::1234 +ERST + +DEF("mcdd", 0, QEMU_OPTION_mcdd, \ + "-mcdd shorthand for -mcd tcp::" DEFAULT_MCDSTUB_PORT "\n", + QEMU_ARCH_ALL) +SRST +``-mcdd`` + Shorthand for -mcd tcp::1234, i.e. open a mcdserver on TCP port 1234 +ERST + DEF("d", HAS_ARG, QEMU_OPTION_d, \ "-d item1,... enable logging of specified items (use '-d help' for a list of log items)\n", QEMU_ARCH_ALL)
softmmu/vl.c +9 -0
@@ -68,6 +68,7 @@#include "sysemu/numa.h" #include "sysemu/hostmem.h" #include "exec/gdbstub.h" +#include "exec/mcdstub.h" #include "qemu/timer.h" #include "chardev/char.h" #include "qemu/bitmap.h"
@@ -2662,6 +2663,14 @@ static void qemu_machine_creation_done(void)if (foreach_device_config (DEV_GDB , gdbserver_start) <0 ) {exit (1 ); } + +if (foreach_device_config (DEV_MCD , mcdserver_start) <0 ) { +/* +* starts the mcdserver if the mcd option was set +*/ +exit (1 ); + } +if (!vga_interface_created && !default_vga && vga_interface_type !=VGA_NONE ) { warn_report("A -vga option was passed but this machine "
Signature · 14 lines
2.34.1 From 73eea6655ba8a7c79c7d3212e261e9744bbb8a87 Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Fri, 2 Jun 2023 16:54:56 +0200 Subject: [PATCH 03/29] TCP packet handling added Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/internals.h | 64 ++++- mcdstub/mcd_syscalls.c | 11 + mcdstub/mcdstub.c | 541 +++++++++++++++++++++++++++++++++++++++-- 3 files changed, 596 insertions(+), 20 deletions(-)
mcdstub/internals.h +59 -5
100 lines not on this page · raw message
mcdstub/mcd_syscalls.c +11 -0
@@ -12,9 +12,20 @@ typedef struct {int current_syscall_cb; } MCDSyscallState; +static enum { +MCD_SYS_UNKNOWN , +MCD_SYS_ENABLED , +MCD_SYS_DISABLED , +} mcd_syscall_mode; +static MCDSyscallState mcdserver_syscall_state;void mcd_syscall_reset (void ) { mcdserver_syscall_state.current_syscall_cb =0 ; +} + +void mcd_disable_syscalls (void ) +{ + mcd_syscall_mode =MCD_SYS_DISABLED ; }
mcdstub/mcdstub.c +526 -15
606 lines not on this page · raw message
Signature · 13 lines
2.34.1 From a05b2211045bc49a3788bfa952e9e2e26abb8dcb Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Fri, 16 Jun 2023 17:27:57 +0200 Subject: [PATCH 04/29] queries for resets and triggers added Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/internals.h | 9 +++++++++ mcdstub/mcdstub.c | 19 ++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-)
mcdstub/internals.h +9 -0
@@ -11,6 +11,14 @@#define MAX_PACKET_LENGTH 1024 +// trigger defines +#define MCD_TRIG_TYPE_IP 0x00000001 +#define MCD_TRIG_TYPE_READ 0x00000002 +#define MCD_TRIG_TYPE_WRITE 0x00000004 +#define MCD_TRIG_TYPE_RW 0x00000008 +#define MCD_TRIG_OPT_DATA_IS_CONDITION 0x00000008 +#define MCD_TRIG_ACTION_DBG_DEBUG 0x00000001 +/* * lookuptable for transmitted signals */
@@ -180,6 +188,7 @@ CPUState *find_cpu(uint32_t thread_id);void handle_core_open (GArray *params,void *user_ctx);void handle_query_reset (GArray *params,void *user_ctx);void handle_detach (GArray *params,void *user_ctx); +void handle_query_trigger (GArray *params,void *user_ctx);void mcd_continue (void );/* sycall handling */
mcdstub/mcdstub.c +18 -1
@@ -57,6 +57,10 @@ static const MCDCmdParseEntry mcd_gen_query_table[] = { .handler = handle_query_reset, .cmd = "reset", }, + { + .handler = handle_query_trigger, + .cmd = "trigger", + }, };void mcd_init_mcdserver_state (void )
@@ -991,7 +995,8 @@ void handle_core_open(GArray *params, void *user_ctx) {void handle_query_reset (GArray *params,void *user_ctx) {// resetting has to be done over a monitor (look ar Rcmd) so we tell MCD that we can reset but this still need to be implemented // we only support one reset over this monitor and that would be a fully "system_restart" -mcd_put_packet ("info_rst=\"results in a full system restart\"" ); +mcd_put_packet ("nr=\"3\",info=\"0,full_system_reset;1,gpr_reset;2,memory_reset;\"" ); +// TODO: we still need to implement the gpr and memory reset here! }void handle_detach (GArray *params,void *user_ctx) {
@@ -1022,6 +1027,18 @@ void handle_detach(GArray *params, void *user_ctx) { } } +void handle_query_trigger (GArray *params,void *user_ctx) { +// set the type, option and action bitmask and send it + +uint32_t type = (MCD_TRIG_TYPE_IP |MCD_TRIG_TYPE_READ |MCD_TRIG_TYPE_WRITE |MCD_TRIG_TYPE_RW ); +uint32_t option = (MCD_TRIG_OPT_DATA_IS_CONDITION ); +uint32_t action = (MCD_TRIG_ACTION_DBG_DEBUG ); +uint32_t nr_trigger =4 ; + +g_string_append_printf (mcdserver_state.str_buf,"nr=\"%d\",info=\"%d;%d;%d;\"" , nr_trigger, type, option, action); +mcd_put_strbuf (); +} +void mcd_continue (void ) {if (!runstate_needs_reset ()) {
Signature · 13 lines
2.34.1 From 7bad0ae1e10fc8641c24acee08706f9cf9de0131 Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Tue, 20 Jun 2023 17:34:00 +0200 Subject: [PATCH 05/29] queries for memory spaces and register groups added Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/internals.h | 29 +++--- mcdstub/mcdstub.c | 240 ++++++++++++++++++++++++-------------------- 2 files changed, 147 insertions(+), 122 deletions(-)
mcdstub/internals.h +17 -12
@@ -19,21 +19,13 @@#define MCD_TRIG_OPT_DATA_IS_CONDITION 0x00000008#define MCD_TRIG_ACTION_DBG_DEBUG 0x00000001 -/* -* lookuptable for transmitted signals -*/ - -enum { -MCD_SIGNAL_HANDSHAKE =0 -}; -/* * struct for an MCD Process, each process can establish one connection */ typedef struct MCDProcess { - //this is probably what we would call a system (in qemu its a cluster) + //this is a relict from the gdb process, we might be able to delete this uint32_t pid; bool attached;
@@ -65,6 +57,9 @@ typedef union MCDCmdVariant {uint32_t pid;uint32_t tid; } thread_id; + +// used to synchronize stub and dll for functions with multiple packets +int index_handle; } MCDCmdVariant;#define get_param (p, i) (&g_array_index(p, MCDCmdVariant, i))
@@ -88,9 +83,7 @@ enum RSState { typedef struct MCDState { bool init; /* have we been initialised? */ - CPUState *c_cpu; /* current CPU for step/continue ops */ - CPUState *g_cpu; /* current CPU for other ops */ - CPUState *query_cpu; /* for q{f|s}ThreadInfo */ + CPUState *c_cpu; /* current CPU for everything */ enum RSState state; /* parsing state */ char line_buf[MAX_PACKET_LENGTH]; int line_buf_index;
@@ -107,11 +100,19 @@ typedef struct MCDState {// maybe we don't need those flags int sstep_flags;int supported_sstep_flags; + +// my stuff +GArray *reggroups; } MCDState;/* lives in main mcdstub.c */ extern MCDState mcdserver_state; +typedef struct mcd_reg_group_st { +const char *name; +const char *id; +}mcd_reg_group_st ; +// Inline utility function, convert from int to hex and back
@@ -190,6 +191,10 @@ void handle_query_reset(GArray *params, void *user_ctx);void handle_detach (GArray *params,void *user_ctx);void handle_query_trigger (GArray *params,void *user_ctx);void mcd_continue (void ); +void handle_query_mem_spaces (GArray *params,void *user_ctx); +void handle_query_reg_groups_f (GArray *params,void *user_ctx); +void handle_query_reg_groups_c (GArray *params,void *user_ctx); +void handle_init (GArray *params,void *user_ctx);/* sycall handling */ void mcd_syscall_reset (void );
mcdstub/mcdstub.c +130 -110
361 lines not on this page · raw message
Signature · 14 lines
2.34.1 From 4e5b0cb290eddd633407bc37322e437422ee5897 Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Fri, 23 Jun 2023 18:12:42 +0200 Subject: [PATCH 06/29] query for registers added Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/internals.h | 55 +++++-- mcdstub/mcdstub.c | 320 ++++++++++++++++++++++++++++++++++++++--- target/arm/meson.build | 1 + 3 files changed, 344 insertions(+), 32 deletions(-)
mcdstub/internals.h +44 -11
103 lines not on this page · raw message
mcdstub/mcdstub.c +299 -21
394 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 13 lines
2.34.1 From 304f3b11febb1a0f3350cbcdd362929746dc807a Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Mon, 26 Jun 2023 17:19:41 +0200 Subject: [PATCH 07/29] query data preparation improved Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/internals.h | 35 +++- mcdstub/mcdstub.c | 382 ++++++++++++++++++++++---------------------- 2 files changed, 215 insertions(+), 202 deletions(-)
mcdstub/mcdstub.c +187 -195
382 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 15 lines
2.34.1 From 499ed6ab8d47ef63c584a489265bf2b24a3fd680 Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Tue, 27 Jun 2023 12:47:57 +0200 Subject: [PATCH 08/29] shared header file added, used for TCP packet data Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/internals.h | 4 +- mcdstub/mcd_shared_defines.h | 24 ++++++++++++ mcdstub/mcdstub.c | 72 ++++++++++++++++++------------------ 3 files changed, 62 insertions(+), 38 deletions(-) create mode 100644 mcdstub/mcd_shared_defines.h
mcdstub/mcdstub.c +36 -36
72 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 14 lines
2.34.1 From e448b636347739b964d2f24a343c8c009205a82e Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Tue, 27 Jun 2023 17:23:05 +0200 Subject: [PATCH 09/29] memory and register query data now stored per core Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/internals.h | 63 +++- mcdstub/mcd_shared_defines.h | 43 ++- mcdstub/mcdstub.c | 693 ++++++++++++++++++++++------------- 3 files changed, 533 insertions(+), 266 deletions(-)
mcdstub/internals.h +50 -13
63 lines not on this page · raw message
mcdstub/mcd_shared_defines.h +38 -5
43 lines not on this page · raw message
mcdstub/mcdstub.c +445 -248
693 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 14 lines
2.34.1 From e6c686ad758340f1545b928ee54fb4929402ced7 Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Wed, 28 Jun 2023 18:01:44 +0200 Subject: [PATCH 10/29] handler for resets added Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/internals.h | 14 ++++---- mcdstub/mcd_shared_defines.h | 4 +++ mcdstub/mcdstub.c | 65 ++++++++++++++++++++++++++++-------- 3 files changed, 63 insertions(+), 20 deletions(-)
mcdstub/mcdstub.c +51 -14
65 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 14 lines
2.34.1 From cade07c1cd8929a4116711a2e798b5983a2aaec2 Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Thu, 29 Jun 2023 16:06:28 +0200 Subject: [PATCH 11/29] query for the VM state added Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/internals.h | 54 ++++++++- mcdstub/mcd_shared_defines.h | 13 ++ mcdstub/mcdstub.c | 229 ++++++++++++++++++++++++++++------- 3 files changed, 249 insertions(+), 47 deletions(-)
mcdstub/internals.h +48 -6
54 lines not on this page · raw message
mcdstub/mcdstub.c +188 -41
229 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 18 lines
2.34.1 From f7175242512470cccc930f10759327553e1e4b03 Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Sun, 2 Jul 2023 14:44:05 +0200 Subject: [PATCH 12/29] handler for reading registers added Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/internals.h | 11 ++- mcdstub/mcd_shared_defines.h | 7 ++ mcdstub/mcdstub.c | 129 +++++++++++++++++++++++++++++++++++ target/arm/mcdstub.c | 75 ++++++++++++++++++++ target/arm/mcdstub.h | 7 ++ 5 files changed, 228 insertions(+), 1 deletion(-) create mode 100644 target/arm/mcdstub.c create mode 100644 target/arm/mcdstub.h
mcdstub/mcdstub.c +129 -0
129 lines not on this page · raw message
target/arm/mcdstub.c new file +75 -0
75 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 14 lines
2.34.1 From 6fc5138b201233e306f60e06c51bdc63d08492b3 Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Mon, 3 Jul 2023 17:08:44 +0200 Subject: [PATCH 13/29] handler for reading memory added Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/internals.h | 9 ++- mcdstub/mcd_shared_defines.h | 2 +- mcdstub/mcdstub.c | 124 +++++++++++++++++++++++------------ 3 files changed, 89 insertions(+), 46 deletions(-)
mcdstub/mcdstub.c +82 -42
124 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 19 lines
2.34.1 From 0212c248b318acd70df2b68ae89204622a33996b Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Wed, 5 Jul 2023 18:25:56 +0200 Subject: [PATCH 14/29] handler for single step added Signed-off-by: Nicolas Eder <[email protected]> --- include/exec/mcdstub.h | 6 +- include/mcdstub/syscalls.h | 4 +- mcdstub/internals.h | 77 +++---- mcdstub/mcd_shared_defines.h | 3 +- mcdstub/mcdstub.c | 428 ++++++++++++++--------------------- softmmu/cpus.c | 2 +- target/arm/mcdstub.c | 66 +++++- target/arm/mcdstub.h | 1 + 8 files changed, 269 insertions(+), 318 deletions(-)
mcdstub/internals.h +29 -48
77 lines not on this page · raw message
mcdstub/mcdstub.c +174 -254
428 lines not on this page · raw message
target/arm/mcdstub.c +59 -7
66 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 27 lines
2.34.1 From a0a4aacb667ec3161642bd1831b7ba359a87357a Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Fri, 7 Jul 2023 15:25:15 +0200 Subject: [PATCH 15/29] adapting to the qemu coding style Signed-off-by: Nicolas Eder <[email protected]> --- gdbstub/gdbstub.c | 2 +- include/exec/mcdstub.h | 3 +- include/mcdstub/syscalls.h | 2 +- mcdstub/mcd_shared_defines.h | 17 +- mcdstub/mcd_softmmu.c | 171 ----- mcdstub/mcd_syscalls.c | 7 +- mcdstub/mcd_tcp_server.c | 95 --- mcdstub/mcdstub.c | 1037 ++++++++++++++++------------ mcdstub/{internals.h => mcdstub.h} | 102 +-- mcdstub/meson.build | 16 +- softmmu/cpus.c | 2 +- softmmu/vl.c | 4 +- target/arm/mcdstub.c | 24 +- 13 files changed, 684 insertions(+), 798 deletions(-) delete mode 100644 mcdstub/mcd_softmmu.c delete mode 100644 mcdstub/mcd_tcp_server.c rename mcdstub/{internals.h => mcdstub.h} (69%)
mcdstub/mcd_softmmu.c deleted +0 -171
171 lines not on this page · raw message
mcdstub/mcd_tcp_server.c deleted +0 -95
95 lines not on this page · raw message
mcdstub/mcdstub.c +591 -446
1,037 lines not on this page · raw message
mcdstub/mcdstub.h renamed from mcdstub/internals.h +51 -51
102 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 13 lines
2.34.1 From 30dc5d9df62fdb38fb8fe7b06f0f84c8a614e18e Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Mon, 10 Jul 2023 12:53:32 +0200 Subject: [PATCH 16/29] deleting the mcdd startup option Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/meson.build | 10 +--------- qemu-options.hx | 13 +++---------- 2 files changed, 4 insertions(+), 19 deletions(-)
The rest of this diff is not shown. View the raw message.
Signature · 15 lines
2.34.1 From 0c3a643cbe9923c26bb21e420f3a7ffa10a3cd6a Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Mon, 10 Jul 2023 18:34:04 +0200 Subject: [PATCH 17/29] handler for breakpoints and watchpoints added Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/mcd_shared_defines.h | 8 +++ mcdstub/mcdstub.c | 124 ++++++++++++++++++++++++++++++++++- mcdstub/mcdstub.h | 4 ++ softmmu/cpus.c | 2 +- 4 files changed, 135 insertions(+), 3 deletions(-)
mcdstub/mcdstub.c +122 -2
124 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 13 lines
2.34.1 From 8d3d3659010bd71f94c506e0d859fba35f69b7ef Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Wed, 12 Jul 2023 11:53:29 +0200 Subject: [PATCH 18/29] making step and go handlers core-specific Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/mcdstub.c | 26 ++++++++++++++++++++++---- mcdstub/mcdstub.h | 3 ++- 2 files changed, 24 insertions(+), 5 deletions(-)
The rest of this diff is not shown. View the raw message.
Signature · 14 lines
2.34.1 From d8d56695e2c9fcab1bb2ecaa5d5fac994088adce Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Thu, 13 Jul 2023 15:36:29 +0200 Subject: [PATCH 19/29] adding trigger ID handling for TRACE32 Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/mcd_shared_defines.h | 2 +- mcdstub/mcdstub.c | 101 +++++++++++++++++++++-------------- mcdstub/mcdstub.h | 29 ++++++---- 3 files changed, 82 insertions(+), 50 deletions(-)
mcdstub/mcdstub.c +62 -39
101 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 16 lines
2.34.1 From ad46b0fb59ad4c191a5be656cb7adeaa4b68ea5b Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Fri, 14 Jul 2023 13:06:46 +0200 Subject: [PATCH 20/29] cp register read/write added Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/mcd_shared_defines.h | 1 + mcdstub/mcdstub.c | 117 ++++++++++------ mcdstub/mcdstub.h | 18 ++- target/arm/mcdstub.c | 265 ++++++++++++++++++++++++++++++----- target/arm/mcdstub.h | 16 ++- 5 files changed, 330 insertions(+), 87 deletions(-)
mcdstub/mcdstub.c +74 -43
117 lines not on this page · raw message
target/arm/mcdstub.c +233 -32
265 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 15 lines
2.34.1 From c59ef5b700e25c8f4b739354377117903b94ab08 Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Wed, 19 Jul 2023 17:07:45 +0200 Subject: [PATCH 21/29] switching between secure and non-secure memory added Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/mcdstub.c | 131 +++++++++++++++++++++++++++---------------- mcdstub/mcdstub.h | 4 +- target/arm/mcdstub.c | 14 +++++ target/arm/mcdstub.h | 1 + 4 files changed, 100 insertions(+), 50 deletions(-)
mcdstub/mcdstub.c +82 -49
131 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 16 lines
2.34.1 From 64b4aacccd13fe0e642b5c233adc457bbc4c0c9e Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Sat, 22 Jul 2023 16:55:45 +0200 Subject: [PATCH 22/29] transitioning to unsinged integers in TCP packets and removing MCD-API-specific terms Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/mcd_shared_defines.h | 8 ++++ mcdstub/mcdstub.c | 74 ++++++++++++++++++++---------------- mcdstub/mcdstub.h | 33 +++++----------- target/arm/mcdstub.c | 2 +- 4 files changed, 60 insertions(+), 57 deletions(-)
mcdstub/mcdstub.c +42 -32
74 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 18 lines
2.34.1 From 863b297e6e58d285098ca9d21f4a353b4b9658e7 Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Wed, 9 Aug 2023 11:26:16 +0200 Subject: [PATCH 23/29] moved all ARM code to the ARM mcdstub and added now commom header file Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/mcdstub.c | 244 ++------------------------------------- mcdstub/mcdstub.h | 64 +--------- mcdstub/mcdstub_common.h | 46 ++++++++ target/arm/mcdstub.c | 231 ++++++++++++++++++++++++++++++++++++ target/arm/mcdstub.h | 22 ++++ 5 files changed, 310 insertions(+), 297 deletions(-) create mode 100644 mcdstub/mcdstub_common.h
mcdstub/mcdstub.c +7 -237
244 lines not on this page · raw message
mcdstub/mcdstub.h +4 -60
64 lines not on this page · raw message
mcdstub/mcdstub_common.h new file +46 -0
46 lines not on this page · raw message
target/arm/mcdstub.c +231 -0
231 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 14 lines
2.34.1 From 011ef906c4fbe79c188caad6591ddcd30b90026f Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Fri, 18 Aug 2023 15:56:21 +0200 Subject: [PATCH 24/29] step and go handlers now propperly perform global operations Signed-off-by: Nicolas Eder <[email protected]> --- mcdstub/mcd_shared_defines.h | 2 ++ mcdstub/mcdstub.c | 35 +++++++++++++++++++++-------------- 2 files changed, 23 insertions(+), 14 deletions(-)
The rest of this diff is not shown. View the raw message.
Signature · 19 lines
2.34.1 From 7ea2961119797d28034d5d1114a9e78e35e2bc68 Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Tue, 22 Aug 2023 11:59:42 +0200 Subject: [PATCH 25/29] Doxygen documentation added Signed-off-by: Nicolas Eder <[email protected]> --- include/exec/mcdstub.h | 7 - include/mcdstub/syscalls.h | 2 +- mcdstub/mcd_shared_defines.h | 1 + mcdstub/mcdstub.c | 61 ++-- mcdstub/mcdstub.h | 579 ++++++++++++++++++++++++++++++++++- mcdstub/mcdstub_common.h | 18 ++ target/arm/mcdstub.c | 6 - target/arm/mcdstub.h | 105 +++++++ 8 files changed, 709 insertions(+), 70 deletions(-)
mcdstub/mcdstub.c +21 -40
61 lines not on this page · raw message
mcdstub/mcdstub.h +563 -16
579 lines not on this page · raw message
target/arm/mcdstub.h +105 -0
105 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 22 lines
2.34.1 From 40cd4a9d23f24b6350ce14fd6377e05a15e9c66b Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Mon, 11 Sep 2023 11:36:24 +0200 Subject: [PATCH 26/29] moved all mcd related header files into include/mcdstub Signed-off-by: Nicolas Eder <[email protected]> --- target/arm/mcdstub.h => include/mcdstub/arm_mcdstub.h | 2 +- {mcdstub => include/mcdstub}/mcd_shared_defines.h | 0 {mcdstub => include/mcdstub}/mcdstub.h | 0 {mcdstub => include/mcdstub}/mcdstub_common.h | 0 mcdstub/mcd_syscalls.c | 2 +- mcdstub/mcdstub.c | 6 +++--- target/arm/mcdstub.c | 3 ++- 7 files changed, 7 insertions(+), 6 deletions(-) rename target/arm/mcdstub.h => include/mcdstub/arm_mcdstub.h (99%) rename {mcdstub => include/mcdstub}/mcd_shared_defines.h (100%) rename {mcdstub => include/mcdstub}/mcdstub.h (100%) rename {mcdstub => include/mcdstub}/mcdstub_common.h (100%)
include/mcdstub/arm_mcdstub.h renamed from target/arm/mcdstub.h +1 -1
Lines of this file are not shown. View the raw message.
include/mcdstub/mcd_shared_defines.h renamed from mcdstub/mcd_shared_defines.h +0 -0
include/mcdstub/mcdstub.h renamed from mcdstub/mcdstub.h +0 -0
include/mcdstub/mcdstub_common.h renamed from mcdstub/mcdstub_common.h +0 -0
The rest of this diff is not shown. View the raw message.
Signature · 12 lines
2.34.1 From 5f5795d6aa758484e61ee4bdc2ae210c47e788f2 Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Mon, 11 Sep 2023 11:42:29 +0200 Subject: [PATCH 27/29] MCD stub entry added to maintainers file Signed-off-by: Nicolas Eder <[email protected]> --- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+)
The rest of this diff is not shown. View the raw message.
Signature · 12 lines
2.34.1 From 834f013b92d7b6b2039b7bd5802fc1072d621963 Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Mon, 11 Sep 2023 11:45:51 +0200 Subject: [PATCH 28/29] added description to out-commented gdb function Signed-off-by: Nicolas Eder <[email protected]> --- softmmu/cpus.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
The rest of this diff is not shown. View the raw message.
Signature · 33 lines
2.34.1 From c32c1312e521a7155810e0a00298bdc8be37dd0a Mon Sep 17 00:00:00 2001 From: Nicolas Eder <[email protected]> Date: Thu, 21 Sep 2023 15:44:34 +0200 Subject: [PATCH 29/29] introducing the DebugClass. It is used to abstract the gdb/mcd set_stop_cpu function. Signed-off-by: Nicolas Eder <[email protected]> --- MAINTAINERS | 3 + debug/debug-common.c | 42 ++++++++++++ debug/debug-gdb.c | 24 +++++++ debug/debug-mcd.c | 25 +++++++ gdbstub/meson.build | 4 +- gdbstub/softmmu.c | 4 ++ gdbstub/user.c | 2 + include/exec/gdbstub.h | 5 ++ include/hw/boards.h | 1 + include/mcdstub/arm_mcdstub.h | 25 +++---- include/mcdstub/mcdstub.h | 122 ++++++++++++++++++---------------- include/qemu/debug.h | 19 ++++++ include/qemu/typedefs.h | 2 + mcdstub/mcdstub.c | 51 +++++++++----- mcdstub/meson.build | 4 +- softmmu/cpus.c | 12 ++-- target/arm/mcdstub.c | 17 +---- 17 files changed, 247 insertions(+), 115 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/qemu/debug.h
debug/debug-common.c new file +42 -0
42 lines not on this page · raw message
include/mcdstub/mcdstub.h +65 -57
122 lines not on this page · raw message
mcdstub/mcdstub.c +33 -18
51 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.34.1
Part of the diff is not shown here. View the raw message.
Hi Nicolas,
Quoted 9 lines · Nicolas Eder
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.
[...]
Thanks for this contribution!
Unfortunately your patch series isn't correctly formatted, so it is too hard to review as it.
I recommend the git-publish tool which usually "do the right thing" and is very easy to use:
https://github.com/stefanha/git-publish#how-to-install
Looking forward to review your v2!
Regards,
Phil.