Update gdbstub.
This commit is contained in:
parent
9ac39e6a12
commit
8eaf2c0b7b
|
@ -53,6 +53,7 @@
|
||||||
"ostream": "cpp",
|
"ostream": "cpp",
|
||||||
"stdexcept": "cpp",
|
"stdexcept": "cpp",
|
||||||
"streambuf": "cpp",
|
"streambuf": "cpp",
|
||||||
"typeinfo": "cpp"
|
"typeinfo": "cpp",
|
||||||
|
"internals.h": "c"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* QEMU breakpoint & watchpoint definitions
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012 SUSE LINUX Products GmbH
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
*/
|
||||||
|
#ifndef EXEC_BREAKPOINT_H
|
||||||
|
#define EXEC_BREAKPOINT_H
|
||||||
|
|
||||||
|
#include "qemu/queue.h"
|
||||||
|
#include "exec/vaddr.h"
|
||||||
|
#include "exec/memattrs.h"
|
||||||
|
|
||||||
|
typedef struct CPUBreakpoint {
|
||||||
|
vaddr pc;
|
||||||
|
int flags; /* BP_* */
|
||||||
|
QTAILQ_ENTRY(CPUBreakpoint) entry;
|
||||||
|
} CPUBreakpoint;
|
||||||
|
|
||||||
|
typedef struct CPUWatchpoint {
|
||||||
|
vaddr vaddr;
|
||||||
|
vaddr len;
|
||||||
|
vaddr hitaddr;
|
||||||
|
MemTxAttrs hitattrs;
|
||||||
|
int flags; /* BP_* */
|
||||||
|
QTAILQ_ENTRY(CPUWatchpoint) entry;
|
||||||
|
} CPUWatchpoint;
|
||||||
|
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -46,6 +46,13 @@ set(CMAKE_CXX_EXTENSIONS ON)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
find_package(PkgConfig REQUIRED) # 查找 GLib 库
|
||||||
|
pkg_check_modules(GLIB REQUIRED glib-2.0)
|
||||||
|
include_directories(${GLIB_INCLUDE_DIRS}) # 添加头文件路径
|
||||||
|
link_directories(${GLIB_LIBRARY_DIRS}) # 添加链接库
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
file(GLOB UTILS_SRC
|
file(GLOB UTILS_SRC
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/utils/*.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/utils/*.cpp
|
||||||
|
@ -55,4 +62,4 @@ set_source_files_properties(${UTILS_SRC} PROPERTIES LANGUAGE CXX)
|
||||||
add_executable(stub ${UTILS_SRC} stub.cpp)
|
add_executable(stub ${UTILS_SRC} stub.cpp)
|
||||||
target_include_directories(stub PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(stub PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
target_include_directories(stub PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/utils)
|
target_include_directories(stub PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/utils)
|
||||||
|
target_link_libraries(stub ${GLIB_LIBRARIES})
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* QEMU breakpoint & watchpoint definitions
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012 SUSE LINUX Products GmbH
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
*/
|
||||||
|
#ifndef EXEC_BREAKPOINT_H
|
||||||
|
#define EXEC_BREAKPOINT_H
|
||||||
|
|
||||||
|
// #include "qemu/queue.h"
|
||||||
|
// #include "exec/vaddr.h"
|
||||||
|
// #include "exec/memattrs.h"
|
||||||
|
|
||||||
|
typedef struct CPUBreakpoint {
|
||||||
|
uintptr_t pc;
|
||||||
|
int flags; /* BP_* */
|
||||||
|
struct CPUBreakpoint* entry;
|
||||||
|
} CPUBreakpoint;
|
||||||
|
|
||||||
|
typedef struct CPUWatchpoint {
|
||||||
|
uintptr_t vaddr;
|
||||||
|
uintptr_t len;
|
||||||
|
uintptr_t hitaddr;
|
||||||
|
// MemTxAttrs hitattrs;
|
||||||
|
int flags; /* BP_* */
|
||||||
|
struct CPUWatchpoint* entry;
|
||||||
|
} CPUWatchpoint;
|
||||||
|
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -11,6 +11,12 @@
|
||||||
|
|
||||||
#define DEFAULT_GDBSTUB_PORT "1234"
|
#define DEFAULT_GDBSTUB_PORT "1234"
|
||||||
|
|
||||||
|
|
||||||
|
typedef uintptr_t vaddr;
|
||||||
|
typedef int Error;
|
||||||
|
|
||||||
|
#define MMU_ACCESS_COUNT 16
|
||||||
|
|
||||||
/* GDB breakpoint/watchpoint types */
|
/* GDB breakpoint/watchpoint types */
|
||||||
#define GDB_BREAKPOINT_SW 0
|
#define GDB_BREAKPOINT_SW 0
|
||||||
#define GDB_BREAKPOINT_HW 1
|
#define GDB_BREAKPOINT_HW 1
|
||||||
|
|
|
@ -1,22 +1,23 @@
|
||||||
#ifndef GDBSTUB_H
|
#ifndef GDBSTUB_H
|
||||||
#define GDBSTUB_H
|
#define GDBSTUB_H
|
||||||
|
|
||||||
|
#include "cpu.h"
|
||||||
|
|
||||||
typedef struct GDBFeature {
|
typedef struct GDBFeature {
|
||||||
const char *xmlname;
|
const char *xmlname;
|
||||||
const char *xml;
|
const char *xml;
|
||||||
const char *name;
|
const char *name;
|
||||||
const char * const *regs;
|
const char *const *regs;
|
||||||
int num_regs;
|
int num_regs;
|
||||||
} GDBFeature;
|
} GDBFeature;
|
||||||
|
|
||||||
typedef struct GDBFeatureBuilder {
|
typedef struct GDBFeatureBuilder {
|
||||||
GDBFeature *feature;
|
GDBFeature *feature;
|
||||||
GPtrArray *xml;
|
GPtrArray *xml;
|
||||||
GPtrArray *regs;
|
GPtrArray *regs;
|
||||||
int base_reg;
|
int base_reg;
|
||||||
} GDBFeatureBuilder;
|
} GDBFeatureBuilder;
|
||||||
|
|
||||||
|
|
||||||
/* Get or set a register. Returns the size of the register. */
|
/* Get or set a register. Returns the size of the register. */
|
||||||
typedef int (*gdb_get_reg_cb)(CPUState *cpu, GByteArray *buf, int reg);
|
typedef int (*gdb_get_reg_cb)(CPUState *cpu, GByteArray *buf, int reg);
|
||||||
typedef int (*gdb_set_reg_cb)(CPUState *cpu, uint8_t *buf, int reg);
|
typedef int (*gdb_set_reg_cb)(CPUState *cpu, uint8_t *buf, int reg);
|
||||||
|
@ -36,9 +37,8 @@ void gdb_init_cpu(CPUState *cpu);
|
||||||
* @xml - xml name of set
|
* @xml - xml name of set
|
||||||
* @gpos - non-zero to append to "general" register set at @gpos
|
* @gpos - non-zero to append to "general" register set at @gpos
|
||||||
*/
|
*/
|
||||||
void gdb_register_coprocessor(CPUState *cpu,
|
void gdb_register_coprocessor(CPUState *cpu, gdb_get_reg_cb get_reg, gdb_set_reg_cb set_reg, const GDBFeature *feature,
|
||||||
gdb_get_reg_cb get_reg, gdb_set_reg_cb set_reg,
|
int g_pos);
|
||||||
const GDBFeature *feature, int g_pos);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdb_unregister_coprocessor_all() - unregisters supplemental set of registers
|
* gdb_unregister_coprocessor_all() - unregisters supplemental set of registers
|
||||||
|
@ -70,8 +70,7 @@ bool gdbserver_start(const char *port_or_device, Error **errp);
|
||||||
* @xmlname: The name of the XML.
|
* @xmlname: The name of the XML.
|
||||||
* @base_reg: The base number of the register ID.
|
* @base_reg: The base number of the register ID.
|
||||||
*/
|
*/
|
||||||
void gdb_feature_builder_init(GDBFeatureBuilder *builder, GDBFeature *feature,
|
void gdb_feature_builder_init(GDBFeatureBuilder *builder, GDBFeature *feature, const char *name, const char *xmlname,
|
||||||
const char *name, const char *xmlname,
|
|
||||||
int base_reg);
|
int base_reg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -80,9 +79,7 @@ void gdb_feature_builder_init(GDBFeatureBuilder *builder, GDBFeature *feature,
|
||||||
* @format: The format of the tag.
|
* @format: The format of the tag.
|
||||||
* @...: The values to be formatted.
|
* @...: The values to be formatted.
|
||||||
*/
|
*/
|
||||||
void G_GNUC_PRINTF(2, 3)
|
void G_GNUC_PRINTF(2, 3) gdb_feature_builder_append_tag(const GDBFeatureBuilder *builder, const char *format, ...);
|
||||||
gdb_feature_builder_append_tag(const GDBFeatureBuilder *builder,
|
|
||||||
const char *format, ...);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdb_feature_builder_append_reg() - Append a register.
|
* gdb_feature_builder_append_reg() - Append a register.
|
||||||
|
@ -93,12 +90,8 @@ gdb_feature_builder_append_tag(const GDBFeatureBuilder *builder,
|
||||||
* @type: The type of the register.
|
* @type: The type of the register.
|
||||||
* @group: The register group to which this register belongs; it can be NULL.
|
* @group: The register group to which this register belongs; it can be NULL.
|
||||||
*/
|
*/
|
||||||
void gdb_feature_builder_append_reg(const GDBFeatureBuilder *builder,
|
void gdb_feature_builder_append_reg(const GDBFeatureBuilder *builder, const char *name, int bitsize, int regnum,
|
||||||
const char *name,
|
const char *type, const char *group);
|
||||||
int bitsize,
|
|
||||||
int regnum,
|
|
||||||
const char *type,
|
|
||||||
const char *group);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdb_feature_builder_end() - End building GDBFeature.
|
* gdb_feature_builder_end() - End building GDBFeature.
|
||||||
|
@ -142,9 +135,9 @@ int gdb_write_register(CPUState *cpu, uint8_t *mem_buf, int reg);
|
||||||
* typedef GDBRegDesc - a register description from gdbstub
|
* typedef GDBRegDesc - a register description from gdbstub
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int gdb_reg;
|
int gdb_reg;
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *feature_name;
|
const char *feature_name;
|
||||||
} GDBRegDesc;
|
} GDBRegDesc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
// #include "gdbstub.h"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "conn.h"
|
#include "conn.h"
|
||||||
|
#include "gdbstub.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
conn_t conn;
|
conn_t conn;
|
||||||
|
|
834
gdbstub/system.c
834
gdbstub/system.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue