Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot set GDB watchpoints on QEMU x86 with icount enabled #28613

Closed
andrewboie opened this issue Sep 22, 2020 · 3 comments
Closed

cannot set GDB watchpoints on QEMU x86 with icount enabled #28613

andrewboie opened this issue Sep 22, 2020 · 3 comments
Labels
bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug Stale

Comments

@andrewboie
Copy link
Contributor

andrewboie commented Sep 22, 2020

Describe the bug

If I try to watch a memory address:

(gdb) p &z_idle_threads[0].arch.rsi
$1 = (uint64_t *) 0x116f20 <z_idle_threads+352>
(gdb) x/fx 0x116f20
0x116f20 <z_idle_threads+352>:  0x00000000
(gdb) watch *0x116f20
Hardware watchpoint 2: *0x116f20
(gdb) c
Continuing.

The emulator explodes:

qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.x2apic [bit 21]
SeaBIOS (version rel-1.12.1-0-ga5cab58-dirty-20200625_115407-9426dddc0a1f-zephyr
)
Booting from ROM..qemu: fatal: Raised interrupt while not in I/O function
EAX=00000000 EBX=00009500 ECX=000000df EDX=00000511
ESI=00000000 EDI=00116f20 EBP=00000000 ESP=00006f08
EIP=00008031 EFL=00000046 [---Z-P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0010 00000000 ffffffff 00cf9300 DPL=0 DS   [-WA]
CS =0008 00000000 ffffffff 00cf9a00 DPL=0 CS32 [-R-]
SS =0010 00000000 ffffffff 00cf9300 DPL=0 DS   [-WA]
DS =0010 00000000 ffffffff 00cf9300 DPL=0 DS   [-WA]
FS =0010 00000000 ffffffff 00cf9300 DPL=0 DS   [-WA]
GS =0010 00000000 ffffffff 00cf9300 DPL=0 DS   [-WA]
LDT=0000 00000000 0000ffff 00008200 DPL=0 LDT
TR =0000 00000000 0000ffff 00008b00 DPL=0 TSS32-busy
GDT=     0000c070 0000004f
IDT=     00009000 00000fff
CR0=00000011 CR2=00000000 CR3=00000000 CR4=00000000
DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000
DR6=00000000ffff0ff0 DR7=0000000000000400
CCS=004a8000 CCD=00950000 CCO=CLR
EFER=0000000000000000
FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00001f80
FPR0=0000000000000000 0000 FPR1=0000000000000000 0000
FPR2=0000000000000000 0000 FPR3=0000000000000000 0000
FPR4=0000000000000000 0000 FPR5=0000000000000000 0000
FPR6=0000000000000000 0000 FPR7=0000000000000000 0000
XMM00=00000000000000000000000000000000 XMM01=00000000000000000000000000000000
XMM02=00000000000000000000000000000000 XMM03=00000000000000000000000000000000
XMM04=00000000000000000000000000000000 XMM05=00000000000000000000000000000000
XMM06=00000000000000000000000000000000 XMM07=00000000000000000000000000000000

This only happens with icount enabled. I have seen this on x86 32-bit, and on x86_64 with CONFIG_MP_NUM_CPUS=1 (which enables icount since we only have one CPU)

To Reproduce
Steps to reproduce the behavior:

  1. Build some test application and set a watch to some symbol or memory address in RAM in GDB
  2. Continue execution

Expected behavior
GDB watches the memory as expected.

Impact
Annoyance to moderate. Disabling icount adds variance to test results and things may not be reproducible, and x86 is VERY difficult to get a real debugger attached for HW testing

@andrewboie andrewboie added the bug The issue is a bug, or the PR is fixing a bug label Sep 22, 2020
@andrewboie andrewboie changed the title cannot set watchpoints on x86 with icount enabled cannot set GDB watchpoints on QEMU x86 with icount enabled Sep 22, 2020
@nashif nashif added the priority: low Low impact/importance bug label Sep 24, 2020
@galak
Copy link
Collaborator

galak commented Sep 24, 2020

Can you try w/qemu 5.1:

builds.zephyrproject.org/zephyrproject-rtos/sdk-ng/272/zephyr-sdk-0.11.4-pr-272-x86_64-linux-setup.run

If still an issue, this should be filed w/upstream qemu.

@github-actions
Copy link

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

@stsquad
Copy link

stsquad commented Dec 9, 2021

The next QEMU release (6.2) has a fix for the watchpoint with icount bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug Stale
Projects
None yet
Development

No branches or pull requests

4 participants