From: Wei Yang <weiyang.kernel@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Failed to set a breakpoint on start_kernel
Date: Fri, 16 Mar 2012 10:43:31 +0800 [thread overview]
Message-ID: <CADLM8XP38U-Ky8Su+xNjbLJS3MX7MVUs6aPDB4UR4FuETOhW8A@mail.gmail.com> (raw)
All
I like qemu very much and know it could debug the kernel.
I tried what I searched on web but couldn't stop at the break point.
Below is what I did.
1. Both host and guest installed the same OS, Fedora16 x86_64.
2. Compile the qemu with
./configure --target-list=x86_64-softmmu --enable-kvm
--enable-debug-tcg --enable-debug --enable-trace-backend=simple
3. With this command I can boot up my guest.
./../qemu/x86_64-softmmu/qemu-system-x86_64 -enable-kvm -smp 4 -m
1024 -boot dc fedora16.img -monitor stdio
4. I git clone the kernel source in the guest and make a new kernel and initrd.
I start the guest with this new kernel successfully
5. I copy out the initrd.img and the .config of kernel to host.
compile the kernel on host.
the kernel source code is identical on host and gueset,
6. I start the guest with the kernel and initrd on host
./../qemu/x86_64-softmmu/qemu-system-x86_64 -enable-kvm -smp 4 -m
1024 -boot dc fedora16.img -monitor stdio -kernel
~/git/linux-yinghai/arch/x86_64/boot/bzImage -initrd
~/git/debug/initramfs-3.0.0.img -append
"root=/dev/mapper/vg_wizard-lv_root ro rd.lvm.lv=vg_wizard/lv_root
rd.md=0 rd.lvm.lv=vg_wizard/lv_swap"
This works fine.
7. Then I start the guest with gdbstub option
./../qemu/x86_64-softmmu/qemu-system-x86_64 -enable-kvm -smp 4 -m
1024 -boot dc fedora16.img -monitor stdio -kernel
/home/ywywyang/git/linux-yinghai/arch/x86_64/boot/bzImage -initrd
/home/ywywyang/git/debug/initramfs-3.0.0.img -append
"root=/dev/mapper/vg_wizard-lv_root ro rd.lvm.lv=vg_wizard/lv_root
rd.md=0 rd.lvm.lv=vg_wizard/lv_swap" -S -gdb tcp::4321
Then the guest stop at the beginning.
8. Attach the gdb in the kernel source directory
gdb
file vmlinux
target remote localhost:4321
b start_kernel
c
Then the guest will run very happily....
Also use the "info b " could show the break point is set.
Which step I made a mistake?
--
Wei Yang
Help You, Help Me
next reply other threads:[~2012-03-16 2:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-16 2:43 Wei Yang [this message]
2012-03-16 18:59 ` [Qemu-devel] Failed to set a breakpoint on start_kernel Mulyadi Santosa
2012-03-17 8:53 ` Jan Kiszka
2012-03-17 11:25 ` Laurent Vivier
2012-03-17 13:52 ` Jan Kiszka
2012-03-17 14:16 ` Wei Yang
2012-03-17 14:51 ` Jan Kiszka
[not found] ` <CADLM8XMYHH8ErMqYMYDPWPF_NB5=1RPLKqtcbVBucYuXCvDvTQ@mail.gmail.com>
2012-03-17 13:31 ` Jan Kiszka
2012-03-17 14:01 ` Wei Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADLM8XP38U-Ky8Su+xNjbLJS3MX7MVUs6aPDB4UR4FuETOhW8A@mail.gmail.com \
--to=weiyang.kernel@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).