Breakpoint setting not working on apple Mac host
Host environment
-
Operating system: Mac OS 14.4.1
-
OS/kernel version: Darwin Yaowens-MacBook-Pro.local 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:49 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6020 arm64
-
Architecture: ARM
-
QEMU flavor: qemu-system-x86_64, qemu-system-aarch64
-
QEMU version: 8.2.1
-
QEMU command line:
# Run QEMU with hvf
qemu-system-aarch64 -machine virt,accel=hvf -cpu host
-kernel arch/arm64/boot/Image
-append "nokaslr"
-nographic
-m 2G
-s
-S
launch lldb and set breakpoint
lldb vmlinux (lldb) target create "vmlinux" Current executable set to '/Users/lim/projects/linux/out/arm64/vmlinux' (aarch64). (lldb) gdb-remote 1234 Process 1 stopped
- thread #1, stop reason = signal SIGTRAP
frame #0: 0x0000000040000000
-> 0x40000000: ldr x0, #0x18
0x40000004: mov x1, xzr
0x40000008: mov x2, xzr
0x4000000c: mov x3, xzr
(lldb) breakpoint set -n start_kernel
warning: failed to set breakpoint site at 0xffff800081bf03cc for breakpoint 1.1: error: 34 sending the breakpoint request
Breakpoint 1: where = vmlinux
start_kernel + 20 at main.c:880:2, address = 0xffff800081bf03cc (lldb) breakpoint set -H -a 0xFFFF800080000000 Breakpoint 2: where = vmlinux
vmlinux[0xffff800080000000], address = 0xffff800080000000 (lldb) c Process 1 resuming (lldb)
Emulated/Virtualized environment
- Operating system: None
- OS/kernel version: Linux Kernel 6.8.2
- Architecture: x86, ARM
Description of problem
-
When use with parameter "-machine virt,accel=hvf -cpu host" to run launch a emulator, it can't set breakpoint and will report error: "warning: failed to set breakpoint site at 0xffff800081bf03cc for breakpoint 1.1: error: 34 sending the breakpoint request" but if not use with parameter "-machine virt -cpu cortex-a57",The breakpoint can be set successfully.
-
Set hardware breakpoint with lldb command "breakpoint set -H -a 0xFFFF800080000000" not report error, but can't hint breakpoint. I try set breakpoint on a old x86 MacOS, It will hint breakpoint successfully.
-
I also try run qemu-system-x86_64 emulator on apple silicon mac, It also can't hint hardware breakping. The command is:
qemu-system-x86_64 -machine q35,accel=tcg -smp cpus=8 \
-kernel arch/x86/boot/bzImage \
-append "okaslr"\
-nographic -serial mon:stdio \
-m 16G \
-s -S
Steps to reproduce
- Launch qemu on Apple silicon Mac. Remember to user "hvf"
- Launch lldb or gdb to set breakpoint.
- Set breakpoint and hardware breakpoint.
- resume to run qemu by lldb.