All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] setting up breakpoints - kernel debugging help wit gdb in qemu-kvm
@ 2012-08-21 23:53 Onkar
  2012-08-22  9:50 ` Mulyadi Santosa
  2012-08-22 10:27 ` Jan Kiszka
  0 siblings, 2 replies; 3+ messages in thread
From: Onkar @ 2012-08-21 23:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi

I am running a linux guest like this - which I wish to debug - 
but the breakpoint gets set but I am not able to stop the guest 
execution at the set breakpoint - it just hangs after I do continue. 
Can you please provide me some clues - 

# ./qemu-system-x86_64 -m 2048 -smp 4 -vga std -vnc :5 -drive
file=/sda4/bin/disk/disk0.img,cache=writeback -S -s

# gdb
GNU gdb (GDB) Fedora (7.2-52.fc14)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show
copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
The target architecture is assumed to be i386:x86-64:intel
(gdb) symbol-file /sda4/kvm/vmlinux
Reading symbols from /sda4/kvm/vmlinux...done.
(gdb) target remote :1234
Remote debugging using :1234
0x0000000000000000 in ?? ()
(gdb) b kmem_cache_alloc
Breakpoint 1 at 0xffffffff81121adb: file mm/slub.c, line 2375. (2
locations)
(gdb) c
Continuing.


Thanks, 
Onkar

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] setting up breakpoints - kernel debugging help wit gdb in qemu-kvm
  2012-08-21 23:53 [Qemu-devel] setting up breakpoints - kernel debugging help wit gdb in qemu-kvm Onkar
@ 2012-08-22  9:50 ` Mulyadi Santosa
  2012-08-22 10:27 ` Jan Kiszka
  1 sibling, 0 replies; 3+ messages in thread
From: Mulyadi Santosa @ 2012-08-22  9:50 UTC (permalink / raw)
  To: qemu-devel

Hi...

On Wed, Aug 22, 2012 at 6:53 AM, Onkar <kernzap@gmail.com> wrote:
>
> # ./qemu-system-x86_64 -m 2048 -smp 4 -vga std -vnc :5 -drive
> file=/sda4/bin/disk/disk0.img,cache=writeback -S -s
>
> (gdb) symbol-file /sda4/kvm/vmlinux
> Reading symbols from /sda4/kvm/vmlinux...done.
> (gdb) target remote :1234
> Remote debugging using :1234
> 0x0000000000000000 in ?? ()
> (gdb) b kmem_cache_alloc
> Breakpoint 1 at 0xffffffff81121adb: file mm/slub.c, line 2375. (2
> locations)
> (gdb) c

can you re run with out using -smp (IOW, just use one CPU)?

Also, which qemu version do you use? is this with or without KVM?


-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] setting up breakpoints - kernel debugging help wit gdb in qemu-kvm
  2012-08-21 23:53 [Qemu-devel] setting up breakpoints - kernel debugging help wit gdb in qemu-kvm Onkar
  2012-08-22  9:50 ` Mulyadi Santosa
@ 2012-08-22 10:27 ` Jan Kiszka
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2012-08-22 10:27 UTC (permalink / raw)
  To: Onkar; +Cc: Stefan Hajnoczi, qemu-devel

On 2012-08-22 01:53, Onkar wrote:
> I am running a linux guest like this - which I wish to debug - 
> but the breakpoint gets set but I am not able to stop the guest 
> execution at the set breakpoint - it just hangs after I do continue. 
> Can you please provide me some clues - 
> 
> # ./qemu-system-x86_64 -m 2048 -smp 4 -vga std -vnc :5 -drive
> file=/sda4/bin/disk/disk0.img,cache=writeback -S -s
> 
> # gdb
> GNU gdb (GDB) Fedora (7.2-52.fc14)
> Copyright (C) 2010 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show
> copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-redhat-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> The target architecture is assumed to be i386:x86-64:intel
> (gdb) symbol-file /sda4/kvm/vmlinux
> Reading symbols from /sda4/kvm/vmlinux...done.
> (gdb) target remote :1234
> Remote debugging using :1234
> 0x0000000000000000 in ?? ()
> (gdb) b kmem_cache_alloc
> Breakpoint 1 at 0xffffffff81121adb: file mm/slub.c, line 2375. (2
> locations)
> (gdb) c
> Continuing.

In KVM mode, soft-breakpoints can only be set when the kernel is already
loaded. The reason is that it injects a trap instruction in the guest
code, and that instruction will be overwritten during boot.

Use a hardware breakpoint instead, or interrupt the guest before the
interesting code is executed but after the kernel is loaded.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-22 10:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-21 23:53 [Qemu-devel] setting up breakpoints - kernel debugging help wit gdb in qemu-kvm Onkar
2012-08-22  9:50 ` Mulyadi Santosa
2012-08-22 10:27 ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.