RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 839263 - cannot set gdb breakpoints on kvm guest
Summary: cannot set gdb breakpoints on kvm guest
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm
Version: 7.0
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: pre-dev-freeze
: ---
Assignee: Virtualization Maintenance
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-07-11 12:06 UTC by Stefan Assmann
Modified: 2013-01-09 12:04 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-07-12 12:24:06 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Stefan Assmann 2012-07-11 12:06:46 UTC
Description of problem:
Starting a guest with
# /usr/libexec/qemu-kvm -s -S -enable-kvm -kernel arch/x86/boot/bzImage -nographic --append "console=ttyS0 ignore_loglevel earlyprintk=ttyS0"
Then in a second window
# /usr/local/bin/gdb vmlinux -ex 'target remote localhost:1234' -ex 'b request_threaded_irq' -ex 'c'

The guest starts to run but it does not stop on the breakpoint.
However this works by using "-no-kvm" instead of "-enable-kvm"

Version-Release number of selected component (if applicable):
kernel-2.6.32-279.el6.x86_64
qemu-kvm-0.12.1.2-2.295.el6.x86_64
gdb-7.2-56.el6.x86_64

Actual results:
breakpoints don't work with kvm enabled

Expected results:
breakpoints work with kvm enabled

Additional info:
Also tried upstream qemu-kvm, but it didn't work either

Comment 2 Ademar Reis 2012-07-11 18:17:01 UTC
You may have more luck with hardware breakpoints (hbreak in gdb). Moving to RHEL7: not a high priority and doesn't work on upstream yet.

Comment 3 Avi Kivity 2012-07-12 12:24:06 UTC
Software breakpoints will not work in the scenario described, since the kernel is loaded after the breakpoints are set.  The INT 3 instructions are overwritten by the kernel (well, actually the breakpoints aren't even set correctly because paging is enabled).

You'll have better luck with hbreak.  You can also use break after the kernel has been loaded, but hbreak will be more reliable.

Closing as invalid.

Comment 4 Stefan Assmann 2012-07-13 07:16:02 UTC
Thanks Avi and Ademar! Now gdb stops at the hbreak, but shows the following error.

Reading symbols from /home/nfs/rhel6/vmlinux...done.
Remote debugging using localhost:1234
0x0000000000000000 in ?? ()
Hardware assisted breakpoint 1 at 0xffffffff810daaf0: file kernel/irq/manage.c, line 1041.
Continuing.
kvm: 26628: cpu0 disabled perfctr wrmsr: 0xc1 data 0xabcd
Remote 'g' packet reply is too long: 000000000000000096512d81ffffffff800000000000000000000000000000009c4e2c81ffffffff0900000000000000c03d6a070088ffff883d6a070088ffff8fac7781ffffffff9c4e2c81fffffffff017c3060088ffff90000000000000000900000000000000a09476070088ffff01000000000000000000000000000000f0aa0d81ffffffff4602000010000000180000001800000018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007f0300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000801f0000
(gdb) bt
Target is executing.

Any clues?

Comment 5 Avi Kivity 2012-07-15 09:10:46 UTC
This is a longstanding gdb bug, caused by target mode switches.

A workaround is to let the guest boot into 64-bit mode, stop it, set the hardware breakpoint, continue the guest, and issue system_reset.


Note You need to log in before you can comment on or make changes to this bug.