[PATCH v2 0/9] plugins: Use unwind info for special gdb registers

Richard Henderson posted 9 patches 5 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240606032926.83599-1-richard.henderson@linaro.org
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Yanan Wang <wangyanan55@huawei.com>, "Alex Bennée" <alex.bennee@linaro.org>, Alexandre Iooss <erdnaxe@crans.org>, Mahmoud Mandour <ma.mandourr@gmail.com>, Pierrick Bouvier <pierrick.bouvier@linaro.org>, Peter Maydell <peter.maydell@linaro.org>
include/exec/cpu-common.h     |  9 +++--
include/hw/core/cpu.h         |  4 +-
include/hw/core/tcg-cpu-ops.h | 14 +++++++
include/tcg/tcg-op-common.h   |  1 +
include/tcg/tcg-opc.h         |  1 +
target/arm/internals.h        |  8 +++-
target/i386/cpu.h             |  2 +
target/i386/gdb-internal.h    | 65 +++++++++++++++++++++++++++++++
accel/tcg/plugin-gen.c        | 49 +++++++++++++++++++++---
accel/tcg/translate-all.c     |  9 +++--
plugins/api.c                 | 36 +++++++++++++++++-
target/arm/cpu.c              | 40 ++++++++++++++++++-
target/arm/cpu64.c            | 55 ++++++++++++++++++++++++++
target/arm/tcg/cpu-v7m.c      |  2 +
target/i386/gdbstub.c         |  1 +
target/i386/helper.c          |  6 ++-
target/i386/tcg/cc_helper.c   | 10 +++++
target/i386/tcg/tcg-cpu.c     | 72 +++++++++++++++++++++++++++--------
tcg/tcg-op.c                  |  5 +++
tcg/tcg.c                     | 10 +++++
20 files changed, 360 insertions(+), 39 deletions(-)
create mode 100644 target/i386/gdb-internal.h
[PATCH v2 0/9] plugins: Use unwind info for special gdb registers
Posted by Richard Henderson 5 months, 3 weeks ago
This is an attempt to fix
https://gitlab.com/qemu-project/qemu/-/issues/2208
("PC is not updated for each instruction in TCG plugins")

I have only updated target/{i386,arm} so far, but basically all
targets need updating for the new callbacks.  Extra points to
anyone who sees how to avoid the extra code duplication.  :-)


r~


Richard Henderson (9):
  tcg: Introduce INDEX_op_plugin_pc
  accel/tcg: Set CPUState.plugin_ra before all plugin callbacks
  accel/tcg: Return the TranslationBlock from cpu_unwind_state_data
  plugins: Introduce TCGCPUOps callbacks for mid-tb register reads
  target/i386: Split out gdb-internal.h
  target/i386: Introduce cpu_compute_eflags_ccop
  target/i386: Implement TCGCPUOps for plugin register reads
  target/arm: Add aarch64_tcg_ops
  target/arm: Implement TCGCPUOps for plugin register reads

 include/exec/cpu-common.h     |  9 +++--
 include/hw/core/cpu.h         |  4 +-
 include/hw/core/tcg-cpu-ops.h | 14 +++++++
 include/tcg/tcg-op-common.h   |  1 +
 include/tcg/tcg-opc.h         |  1 +
 target/arm/internals.h        |  8 +++-
 target/i386/cpu.h             |  2 +
 target/i386/gdb-internal.h    | 65 +++++++++++++++++++++++++++++++
 accel/tcg/plugin-gen.c        | 49 +++++++++++++++++++++---
 accel/tcg/translate-all.c     |  9 +++--
 plugins/api.c                 | 36 +++++++++++++++++-
 target/arm/cpu.c              | 40 ++++++++++++++++++-
 target/arm/cpu64.c            | 55 ++++++++++++++++++++++++++
 target/arm/tcg/cpu-v7m.c      |  2 +
 target/i386/gdbstub.c         |  1 +
 target/i386/helper.c          |  6 ++-
 target/i386/tcg/cc_helper.c   | 10 +++++
 target/i386/tcg/tcg-cpu.c     | 72 +++++++++++++++++++++++++++--------
 tcg/tcg-op.c                  |  5 +++
 tcg/tcg.c                     | 10 +++++
 20 files changed, 360 insertions(+), 39 deletions(-)
 create mode 100644 target/i386/gdb-internal.h

-- 
2.34.1
Re: [PATCH v2 0/9] plugins: Use unwind info for special gdb registers
Posted by Philippe Mathieu-Daudé 5 months, 3 weeks ago
On 6/6/24 05:29, Richard Henderson wrote:
> 
> This is an attempt to fix
> https://gitlab.com/qemu-project/qemu/-/issues/2208
> ("PC is not updated for each instruction in TCG plugins")
> 
> I have only updated target/{i386,arm} so far, but basically all
> targets need updating for the new callbacks.  Extra points to
> anyone who sees how to avoid the extra code duplication.  :-)

Do you mean on ARM, aarch64_tcg_ops i.e.? Because X86 LGTM.
Re: [PATCH v2 0/9] plugins: Use unwind info for special gdb registers
Posted by Alex Bennée 5 months, 2 weeks ago
Richard Henderson <richard.henderson@linaro.org> writes:

> This is an attempt to fix
> https://gitlab.com/qemu-project/qemu/-/issues/2208
> ("PC is not updated for each instruction in TCG plugins")
>
> I have only updated target/{i386,arm} so far, but basically all
> targets need updating for the new callbacks.  Extra points to
> anyone who sees how to avoid the extra code duplication.  :-)

I've made a few comments but yeah I think we just have to live with the
extra helpers. The only other option would be pre-notifying the gdb
subsystem about which registers are "lazy" which I think amounts to the
same thing.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro