* [PATCH v2 1/5] include/exec: Introduce env_cpu_const()
2024-09-12 9:28 [PATCH v2 0/5] linux-user/i386: Emulate orig_ax Ilya Leoshkevich
@ 2024-09-12 9:28 ` Ilya Leoshkevich
2024-09-12 9:28 ` [PATCH v2 2/5] linux-user/i386: Emulate orig_ax Ilya Leoshkevich
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Ilya Leoshkevich @ 2024-09-12 9:28 UTC (permalink / raw)
To: Laurent Vivier, Alex Bennée, Philippe Mathieu-Daudé,
Paolo Bonzini, Richard Henderson
Cc: qemu-devel, Ilya Leoshkevich
It's the same as env_cpu(), but for const objects.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
include/exec/cpu-common.h | 13 ++++++++++++-
linux-user/elfload.c | 2 +-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index 2998c95da4a..dc5cffadf29 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -242,6 +242,17 @@ static inline ArchCPU *env_archcpu(CPUArchState *env)
return (void *)env - sizeof(CPUState);
}
+/**
+ * env_cpu_const(env)
+ * @env: The architecture environment
+ *
+ * Return the CPUState associated with the environment.
+ */
+static inline const CPUState *env_cpu_const(const CPUArchState *env)
+{
+ return (void *)env - sizeof(CPUState);
+}
+
/**
* env_cpu(env)
* @env: The architecture environment
@@ -250,7 +261,7 @@ static inline ArchCPU *env_archcpu(CPUArchState *env)
*/
static inline CPUState *env_cpu(CPUArchState *env)
{
- return (void *)env - sizeof(CPUState);
+ return (CPUState *)env_cpu_const(env);
}
#ifndef CONFIG_USER_ONLY
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 0861f115fc4..05292c27776 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -4329,7 +4329,7 @@ static int wmr_write_region(void *opaque, target_ulong start,
*/
static int elf_core_dump(int signr, const CPUArchState *env)
{
- const CPUState *cpu = env_cpu((CPUArchState *)env);
+ const CPUState *cpu = env_cpu_const(env);
const TaskState *ts = (const TaskState *)get_task_state((CPUState *)cpu);
struct rlimit dumpsize;
CountAndSizeRegions css;
--
2.46.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/5] linux-user/i386: Emulate orig_ax
2024-09-12 9:28 [PATCH v2 0/5] linux-user/i386: Emulate orig_ax Ilya Leoshkevich
2024-09-12 9:28 ` [PATCH v2 1/5] include/exec: Introduce env_cpu_const() Ilya Leoshkevich
@ 2024-09-12 9:28 ` Ilya Leoshkevich
2024-09-12 9:28 ` [PATCH v2 3/5] target/i386/gdbstub: Factor out gdb_get_reg() and gdb_write_reg() Ilya Leoshkevich
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Ilya Leoshkevich @ 2024-09-12 9:28 UTC (permalink / raw)
To: Laurent Vivier, Alex Bennée, Philippe Mathieu-Daudé,
Paolo Bonzini, Richard Henderson
Cc: qemu-devel, Ilya Leoshkevich
The kernel uses orig_rax/orig_eax to store the syscall number before
a syscall. One can see this value in core dumps and ptrace.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
linux-user/elfload.c | 4 ++--
linux-user/i386/cpu_loop.c | 3 +++
linux-user/qemu.h | 4 ++++
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 05292c27776..2d73382ae6b 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -203,7 +203,7 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUX86State *en
(*regs)[12] = tswapreg(env->regs[R_EDX]);
(*regs)[13] = tswapreg(env->regs[R_ESI]);
(*regs)[14] = tswapreg(env->regs[R_EDI]);
- (*regs)[15] = tswapreg(env->regs[R_EAX]); /* XXX */
+ (*regs)[15] = tswapreg(get_task_state(env_cpu_const(env))->orig_ax);
(*regs)[16] = tswapreg(env->eip);
(*regs)[17] = tswapreg(env->segs[R_CS].selector & 0xffff);
(*regs)[18] = tswapreg(env->eflags);
@@ -306,7 +306,7 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUX86State *en
(*regs)[8] = tswapreg(env->segs[R_ES].selector & 0xffff);
(*regs)[9] = tswapreg(env->segs[R_FS].selector & 0xffff);
(*regs)[10] = tswapreg(env->segs[R_GS].selector & 0xffff);
- (*regs)[11] = tswapreg(env->regs[R_EAX]); /* XXX */
+ (*regs)[11] = tswapreg(get_task_state(env_cpu_const(env))->orig_ax);
(*regs)[12] = tswapreg(env->eip);
(*regs)[13] = tswapreg(env->segs[R_CS].selector & 0xffff);
(*regs)[14] = tswapreg(env->eflags);
diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c
index 8707a3eaf25..43ad4e2f39e 100644
--- a/linux-user/i386/cpu_loop.c
+++ b/linux-user/i386/cpu_loop.c
@@ -172,6 +172,7 @@ static void emulate_vsyscall(CPUX86State *env)
/*
* Perform the syscall. None of the vsyscalls should need restarting.
*/
+ get_task_state(env_cpu(env))->orig_ax = syscall;
ret = do_syscall(env, syscall, env->regs[R_EDI], env->regs[R_ESI],
env->regs[R_EDX], env->regs[10], env->regs[8],
env->regs[9], 0, 0);
@@ -218,6 +219,7 @@ void cpu_loop(CPUX86State *env)
case EXCP_SYSCALL:
#endif
/* linux syscall from int $0x80 */
+ get_task_state(cs)->orig_ax = env->regs[R_EAX];
ret = do_syscall(env,
env->regs[R_EAX],
env->regs[R_EBX],
@@ -236,6 +238,7 @@ void cpu_loop(CPUX86State *env)
#ifdef TARGET_X86_64
case EXCP_SYSCALL:
/* linux syscall from syscall instruction. */
+ get_task_state(cs)->orig_ax = env->regs[R_EAX];
ret = do_syscall(env,
env->regs[R_EAX],
env->regs[R_EDI],
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index a2961f503f4..92b2bee87b1 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -113,6 +113,10 @@ struct TaskState {
struct target_vm86plus_struct vm86plus;
uint32_t v86flags;
uint32_t v86mask;
+#endif
+#if defined(TARGET_I386)
+ /* Last syscall number. */
+ target_ulong orig_ax;
#endif
abi_ulong child_tidptr;
#ifdef TARGET_M68K
--
2.46.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/5] target/i386/gdbstub: Factor out gdb_get_reg() and gdb_write_reg()
2024-09-12 9:28 [PATCH v2 0/5] linux-user/i386: Emulate orig_ax Ilya Leoshkevich
2024-09-12 9:28 ` [PATCH v2 1/5] include/exec: Introduce env_cpu_const() Ilya Leoshkevich
2024-09-12 9:28 ` [PATCH v2 2/5] linux-user/i386: Emulate orig_ax Ilya Leoshkevich
@ 2024-09-12 9:28 ` Ilya Leoshkevich
2024-09-12 9:28 ` [PATCH v2 4/5] target/i386/gdbstub: Expose orig_ax Ilya Leoshkevich
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Ilya Leoshkevich @ 2024-09-12 9:28 UTC (permalink / raw)
To: Laurent Vivier, Alex Bennée, Philippe Mathieu-Daudé,
Paolo Bonzini, Richard Henderson
Cc: qemu-devel, Ilya Leoshkevich
i386 gdbstub handles both i386 and x86_64. Factor out two functions
for reading and writing registers without knowing their bitness.
While at it, simplify the TARGET_LONG_BITS == 32 case.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
target/i386/gdbstub.c | 51 +++++++++++++++++++++++++------------------
1 file changed, 30 insertions(+), 21 deletions(-)
diff --git a/target/i386/gdbstub.c b/target/i386/gdbstub.c
index 4acf485879e..cc5eceeb7eb 100644
--- a/target/i386/gdbstub.c
+++ b/target/i386/gdbstub.c
@@ -96,6 +96,19 @@ static int gdb_write_reg_cs64(uint32_t hflags, uint8_t *buf, target_ulong *val)
return 4;
}
+static int gdb_get_reg(CPUX86State *env, GByteArray *mem_buf, target_ulong val)
+{
+ if (TARGET_LONG_BITS == 64) {
+ if (env->hflags & HF_CS64_MASK) {
+ return gdb_get_reg64(mem_buf, val);
+ } else {
+ return gdb_get_reg64(mem_buf, val & 0xffffffffUL);
+ }
+ } else {
+ return gdb_get_reg32(mem_buf, val);
+ }
+}
+
int x86_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
{
X86CPU *cpu = X86_CPU(cs);
@@ -137,15 +150,7 @@ int x86_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
} else {
switch (n) {
case IDX_IP_REG:
- if (TARGET_LONG_BITS == 64) {
- if (env->hflags & HF_CS64_MASK) {
- return gdb_get_reg64(mem_buf, env->eip);
- } else {
- return gdb_get_reg64(mem_buf, env->eip & 0xffffffffUL);
- }
- } else {
- return gdb_get_reg32(mem_buf, env->eip);
- }
+ return gdb_get_reg(env, mem_buf, env->eip);
case IDX_FLAGS_REG:
return gdb_get_reg32(mem_buf, env->eflags);
@@ -248,6 +253,21 @@ static int x86_cpu_gdb_load_seg(X86CPU *cpu, X86Seg sreg, uint8_t *mem_buf)
return 4;
}
+static int gdb_write_reg(CPUX86State *env, uint8_t *mem_buf, target_ulong *val)
+{
+ if (TARGET_LONG_BITS == 64) {
+ if (env->hflags & HF_CS64_MASK) {
+ *val = ldq_p(mem_buf);
+ } else {
+ *val = ldq_p(mem_buf) & 0xffffffffUL;
+ }
+ return 8;
+ } else {
+ *val = (uint32_t)ldl_p(mem_buf);
+ return 4;
+ }
+}
+
int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
{
X86CPU *cpu = X86_CPU(cs);
@@ -288,18 +308,7 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
} else {
switch (n) {
case IDX_IP_REG:
- if (TARGET_LONG_BITS == 64) {
- if (env->hflags & HF_CS64_MASK) {
- env->eip = ldq_p(mem_buf);
- } else {
- env->eip = ldq_p(mem_buf) & 0xffffffffUL;
- }
- return 8;
- } else {
- env->eip &= ~0xffffffffUL;
- env->eip |= (uint32_t)ldl_p(mem_buf);
- return 4;
- }
+ return gdb_write_reg(env, mem_buf, &env->eip);
case IDX_FLAGS_REG:
env->eflags = ldl_p(mem_buf);
return 4;
--
2.46.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 4/5] target/i386/gdbstub: Expose orig_ax
2024-09-12 9:28 [PATCH v2 0/5] linux-user/i386: Emulate orig_ax Ilya Leoshkevich
` (2 preceding siblings ...)
2024-09-12 9:28 ` [PATCH v2 3/5] target/i386/gdbstub: Factor out gdb_get_reg() and gdb_write_reg() Ilya Leoshkevich
@ 2024-09-12 9:28 ` Ilya Leoshkevich
2024-09-12 9:28 ` [PATCH v2 5/5] tests/tcg: Run test-proc-mappings.py on i386 Ilya Leoshkevich
2024-10-10 9:12 ` PING: [PATCH v2 0/5] linux-user/i386: Emulate orig_ax Ilya Leoshkevich
5 siblings, 0 replies; 7+ messages in thread
From: Ilya Leoshkevich @ 2024-09-12 9:28 UTC (permalink / raw)
To: Laurent Vivier, Alex Bennée, Philippe Mathieu-Daudé,
Paolo Bonzini, Richard Henderson
Cc: qemu-devel, Ilya Leoshkevich
Copy XML files describing orig_ax from GDB and glue them with
CPUX86State.orig_ax.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
configs/targets/i386-linux-user.mak | 2 +-
configs/targets/x86_64-linux-user.mak | 2 +-
gdb-xml/i386-32bit-linux.xml | 11 ++++++
gdb-xml/i386-64bit-linux.xml | 11 ++++++
target/i386/cpu.c | 1 +
target/i386/cpu.h | 1 +
target/i386/gdbstub.c | 51 +++++++++++++++++++++++++++
7 files changed, 77 insertions(+), 2 deletions(-)
create mode 100644 gdb-xml/i386-32bit-linux.xml
create mode 100644 gdb-xml/i386-64bit-linux.xml
diff --git a/configs/targets/i386-linux-user.mak b/configs/targets/i386-linux-user.mak
index 5b2546a4309..b72a156473a 100644
--- a/configs/targets/i386-linux-user.mak
+++ b/configs/targets/i386-linux-user.mak
@@ -1,4 +1,4 @@
TARGET_ARCH=i386
TARGET_SYSTBL_ABI=i386
TARGET_SYSTBL=syscall_32.tbl
-TARGET_XML_FILES= gdb-xml/i386-32bit.xml
+TARGET_XML_FILES= gdb-xml/i386-32bit.xml gdb-xml/i386-32bit-linux.xml
diff --git a/configs/targets/x86_64-linux-user.mak b/configs/targets/x86_64-linux-user.mak
index 9ceefbb615a..86042814d39 100644
--- a/configs/targets/x86_64-linux-user.mak
+++ b/configs/targets/x86_64-linux-user.mak
@@ -2,4 +2,4 @@ TARGET_ARCH=x86_64
TARGET_BASE_ARCH=i386
TARGET_SYSTBL_ABI=common,64
TARGET_SYSTBL=syscall_64.tbl
-TARGET_XML_FILES= gdb-xml/i386-64bit.xml
+TARGET_XML_FILES= gdb-xml/i386-64bit.xml gdb-xml/i386-64bit-linux.xml
diff --git a/gdb-xml/i386-32bit-linux.xml b/gdb-xml/i386-32bit-linux.xml
new file mode 100644
index 00000000000..5ffe5616e63
--- /dev/null
+++ b/gdb-xml/i386-32bit-linux.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.i386.linux">
+ <reg name="orig_eax" bitsize="32" type="int"/>
+</feature>
diff --git a/gdb-xml/i386-64bit-linux.xml b/gdb-xml/i386-64bit-linux.xml
new file mode 100644
index 00000000000..0f26990d2f7
--- /dev/null
+++ b/gdb-xml/i386-64bit-linux.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.i386.linux">
+ <reg name="orig_rax" bitsize="64" type="int"/>
+</feature>
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 85ef7452c04..52788e6170d 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -7831,6 +7831,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
mce_init(cpu);
+ x86_cpu_gdb_init(cs);
qemu_init_vcpu(cs);
/*
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 14edd57a37b..dc2e074e227 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -2231,6 +2231,7 @@ void x86_cpu_dump_state(CPUState *cs, FILE *f, int flags);
int x86_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
int x86_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
+void x86_cpu_gdb_init(CPUState *cs);
void x86_cpu_list(void);
int cpu_x86_support_mca_broadcast(CPUX86State *env);
diff --git a/target/i386/gdbstub.c b/target/i386/gdbstub.c
index cc5eceeb7eb..04c49e802d7 100644
--- a/target/i386/gdbstub.c
+++ b/target/i386/gdbstub.c
@@ -18,8 +18,13 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "qemu/osdep.h"
+#include "accel/tcg/vcpu-state.h"
#include "cpu.h"
+#include "exec/gdbstub.h"
#include "gdbstub/helpers.h"
+#ifdef CONFIG_LINUX_USER
+#include "linux-user/qemu.h"
+#endif
#ifdef TARGET_X86_64
static const int gpr_map[16] = {
@@ -406,3 +411,49 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
/* Unrecognised register. */
return 0;
}
+
+#ifdef CONFIG_LINUX_USER
+
+#define IDX_ORIG_AX 0
+
+static int x86_cpu_gdb_read_linux_register(CPUState *cs, GByteArray *mem_buf,
+ int n)
+{
+ X86CPU *cpu = X86_CPU(cs);
+ CPUX86State *env = &cpu->env;
+
+ switch (n) {
+ case IDX_ORIG_AX:
+ return gdb_get_reg(env, mem_buf, get_task_state(cs)->orig_ax);
+ }
+ return 0;
+}
+
+static int x86_cpu_gdb_write_linux_register(CPUState *cs, uint8_t *mem_buf,
+ int n)
+{
+ X86CPU *cpu = X86_CPU(cs);
+ CPUX86State *env = &cpu->env;
+
+ switch (n) {
+ case IDX_ORIG_AX:
+ return gdb_write_reg(env, mem_buf, &get_task_state(cs)->orig_ax);
+ }
+ return 0;
+}
+
+#endif
+
+void x86_cpu_gdb_init(CPUState *cs)
+{
+#ifdef CONFIG_LINUX_USER
+ gdb_register_coprocessor(cs, x86_cpu_gdb_read_linux_register,
+ x86_cpu_gdb_write_linux_register,
+#ifdef TARGET_X86_64
+ gdb_find_static_feature("i386-64bit-linux.xml"),
+#else
+ gdb_find_static_feature("i386-32bit-linux.xml"),
+#endif
+ 0);
+#endif
+}
--
2.46.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 5/5] tests/tcg: Run test-proc-mappings.py on i386
2024-09-12 9:28 [PATCH v2 0/5] linux-user/i386: Emulate orig_ax Ilya Leoshkevich
` (3 preceding siblings ...)
2024-09-12 9:28 ` [PATCH v2 4/5] target/i386/gdbstub: Expose orig_ax Ilya Leoshkevich
@ 2024-09-12 9:28 ` Ilya Leoshkevich
2024-10-10 9:12 ` PING: [PATCH v2 0/5] linux-user/i386: Emulate orig_ax Ilya Leoshkevich
5 siblings, 0 replies; 7+ messages in thread
From: Ilya Leoshkevich @ 2024-09-12 9:28 UTC (permalink / raw)
To: Laurent Vivier, Alex Bennée, Philippe Mathieu-Daudé,
Paolo Bonzini, Richard Henderson
Cc: qemu-devel, Ilya Leoshkevich
Now that orig_ax is exposed and GDB is happy, don't skip
test-proc-mappings.py on i386. In fact, it's broken only on
m68k now, so skip only this architecture.
Acked-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
.../tcg/multiarch/gdbstub/test-proc-mappings.py | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/tests/tcg/multiarch/gdbstub/test-proc-mappings.py b/tests/tcg/multiarch/gdbstub/test-proc-mappings.py
index 564613fabf0..0f687f3284a 100644
--- a/tests/tcg/multiarch/gdbstub/test-proc-mappings.py
+++ b/tests/tcg/multiarch/gdbstub/test-proc-mappings.py
@@ -8,17 +8,12 @@
def run_test():
"""Run through the tests one by one"""
- try:
- mappings = gdb.execute("info proc mappings", False, True)
- except gdb.error as exc:
- exc_str = str(exc)
- if "Not supported on this target." in exc_str:
- # Detect failures due to an outstanding issue with how GDB handles
- # the x86_64 QEMU's target.xml, which does not contain the
- # definition of orig_rax. Skip the test in this case.
- print("SKIP: {}".format(exc_str))
- return
- raise
+ if gdb.selected_inferior().architecture().name() == "m68k":
+ # m68k GDB supports only GDB_OSABI_SVR4, but GDB_OSABI_LINUX is
+ # required for the info proc support (see set_gdbarch_info_proc()).
+ print("SKIP: m68k GDB does not support GDB_OSABI_LINUX")
+ exit(0)
+ mappings = gdb.execute("info proc mappings", False, True)
report(isinstance(mappings, str), "Fetched the mappings from the inferior")
# Broken with host page size > guest page size
# report("/sha1" in mappings, "Found the test binary name in the mappings")
--
2.46.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* PING: [PATCH v2 0/5] linux-user/i386: Emulate orig_ax
2024-09-12 9:28 [PATCH v2 0/5] linux-user/i386: Emulate orig_ax Ilya Leoshkevich
` (4 preceding siblings ...)
2024-09-12 9:28 ` [PATCH v2 5/5] tests/tcg: Run test-proc-mappings.py on i386 Ilya Leoshkevich
@ 2024-10-10 9:12 ` Ilya Leoshkevich
5 siblings, 0 replies; 7+ messages in thread
From: Ilya Leoshkevich @ 2024-10-10 9:12 UTC (permalink / raw)
To: Laurent Vivier, Alex Bennée, Philippe Mathieu-Daudé,
Paolo Bonzini, Richard Henderson
Cc: qemu-devel
On Thu, 2024-09-12 at 11:28 +0200, Ilya Leoshkevich wrote:
> v1:
> https://lore.kernel.org/qemu-devel/20240802095942.34565-1-iii@linux.ibm.com/
> v1 -> v2: Move orig_ax declaration higher, simplify gdb_write_reg()
> for TARGET_LONG_BITS == 32 (Richard).
>
> Hi,
>
> Currently gdbstub is barely usable with i386-linux-user: GDB cannot
> even parse a shared library list, so no symbols are available. This
> boils down to unavailability of info proc, which is gated behind
> org.gnu.gdb.i386.linux. See amd64_linux_init_abi(); info proc is
> enabled by amd64_linux_init_abi_common() -> linux_init_abi().
>
> This series adds orig_ax support to the emulator and gdbstub, and
> enables the existing test-proc-mappings.py on i386.
>
> Best regards,
> Ilya
>
> Ilya Leoshkevich (5):
> include/exec: Introduce env_cpu_const()
> linux-user/i386: Emulate orig_ax
> target/i386/gdbstub: Factor out gdb_get_reg() and gdb_write_reg()
> target/i386/gdbstub: Expose orig_ax
> tests/tcg: Run test-proc-mappings.py on i386
>
> configs/targets/i386-linux-user.mak | 2 +-
> configs/targets/x86_64-linux-user.mak | 2 +-
> gdb-xml/i386-32bit-linux.xml | 11 ++
> gdb-xml/i386-64bit-linux.xml | 11 ++
> include/exec/cpu-common.h | 13 ++-
> linux-user/elfload.c | 6 +-
> linux-user/i386/cpu_loop.c | 3 +
> linux-user/qemu.h | 4 +
> target/i386/cpu.c | 1 +
> target/i386/cpu.h | 1 +
> target/i386/gdbstub.c | 102 ++++++++++++++--
> --
> .../multiarch/gdbstub/test-proc-mappings.py | 17 ++-
> 12 files changed, 135 insertions(+), 38 deletions(-)
> create mode 100644 gdb-xml/i386-32bit-linux.xml
> create mode 100644 gdb-xml/i386-64bit-linux.xml
Hi,
I would like to ping this series.
Patches 1-4 have R-b, patch 5 has only A-b.
Best regards,
Ilya
^ permalink raw reply [flat|nested] 7+ messages in thread