[PATCH 0/2] Fix GDB support for macOS hvf

Mads Ynddal posted 2 patches 7 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250402135229.28143-1-mads@ynddal.dk
Maintainers: Cameron Esfahani <dirty@apple.com>, Roman Bolshakov <rbolshakov@ddn.com>, Phil Dennis-Jordan <phil@philjordan.eu>, Alexander Graf <agraf@csgraf.de>, Peter Maydell <peter.maydell@linaro.org>
accel/hvf/hvf-all.c  |  7 ++++++-
target/arm/hvf/hvf.c | 27 +++++++++++----------------
2 files changed, 17 insertions(+), 17 deletions(-)
[PATCH 0/2] Fix GDB support for macOS hvf
Posted by Mads Ynddal 7 months, 2 weeks ago
From: Mads Ynddal <m.ynddal@samsung.com>

In (recent versions of?) macOS, calls to hv_vcpu_set_sys_reg were failing if
they were issued outside of the specific thread that owns the vCPU.

This caused a crash when attaching a debugger through the GDB stub.

This GDB stub has worked before, so it is unclear if Apple changed the
behavior of the function in a release of macOS.

Mads Ynddal (2):
  hvf: avoid repeatedly setting trap debug for each cpu
  hvf: only update sysreg from owning thread

 accel/hvf/hvf-all.c  |  7 ++++++-
 target/arm/hvf/hvf.c | 27 +++++++++++----------------
 2 files changed, 17 insertions(+), 17 deletions(-)

-- 
2.48.1
Re: [PATCH 0/2] Fix GDB support for macOS hvf
Posted by Peter Maydell 6 months, 2 weeks ago
On Wed, 2 Apr 2025 at 14:52, Mads Ynddal <mads@ynddal.dk> wrote:
>
> From: Mads Ynddal <m.ynddal@samsung.com>
>
> In (recent versions of?) macOS, calls to hv_vcpu_set_sys_reg were failing if
> they were issued outside of the specific thread that owns the vCPU.
>
> This caused a crash when attaching a debugger through the GDB stub.
>
> This GDB stub has worked before, so it is unclear if Apple changed the
> behavior of the function in a release of macOS.



Applied to target-arm.next, thanks.

-- PMM
Re: [PATCH 0/2] Fix GDB support for macOS hvf
Posted by Mads Ynddal 7 months ago
> In (recent versions of?) macOS, calls to hv_vcpu_set_sys_reg were failing if
> they were issued outside of the specific thread that owns the vCPU.
> 
> This caused a crash when attaching a debugger through the GDB stub.
> 
> This GDB stub has worked before, so it is unclear if Apple changed the
> behavior of the function in a release of macOS.
> 
> Mads Ynddal (2):
>  hvf: avoid repeatedly setting trap debug for each cpu
>  hvf: only update sysreg from owning thread
> 
> accel/hvf/hvf-all.c  |  7 ++++++-
> target/arm/hvf/hvf.c | 27 +++++++++++----------------
> 2 files changed, 17 insertions(+), 17 deletions(-)
> 

Daniel Gomez and I have been using this patch for the past two weeks. It seems to be the right fix for the issue.

—
Mads Ynddal