problem when debugging linux kernel with virtualbox

This is for discussing general topics about how to use VirtualBox.
Post Reply
wistoch
Posts: 1
Joined: 14. Dec 2009, 04:30
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu

problem when debugging linux kernel with virtualbox

Post by wistoch »

I want to use virtualbox to debug linux kernel, but it seems there are some problems for the connection between host and guest.

I have run into two solutions:

1. both dev machine and test machine are VMs of virtualbox and the both COM1 are host pipe with the same name.

2. COM1 of test machine is hot pipe and use socat to redirect the COM1 to pts or udp socket. and then use gdb in the Linux host machine.

The connection can be established and can set breakpoint. but both of them run into the same problem:

GNU gdb (GDB) 7.0-ubuntu
Copyright (C) 2009 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 "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/wistoch/linux-source-2.6.31/vmlinux...done.
(gdb) set debug remote 1
(gdb) target remote
Display all 64522 possibilities? (y or n)
(gdb) set remotebaud 115200
(gdb) target remote /dev/pts/2
Remote debugging using /dev/pts/2
Sending packet: $qSupported#37...Ack
Packet received:
Packet qSupported (supported-packets) is NOT supported
Sending packet: $Hg0#df...Ack
Packet received: OK
Sending packet: $?#3f...Ack
Packet received: S05
Sending packet: $Hc-1#09...Ack
Packet received: OK
Sending packet: $qC#b4...Ack
Packet received: QC0000000000000001
Sending packet: $qAttached#8f...Ack
Packet received:
Packet qAttached (query-attached) is NOT supported
Sending packet: $qOffsets#4b...Ack
Packet received:
Sending packet: $g#67...Ack
Packet received: 4500000037c5ffff0000000000000000703f82d7803f82d7b4b87ac000000000c9ac18c08202000060000000680000007b007ac07b000000ffff0000ffff0000
kgdb_breakpoint (new_kgdb_io_ops=0xc07ab8b4) at kernel/kgdb.c:1721
1721 wmb(); /* Sync point after breakpoint */
Sending packet: $qSymbol::#5b...Ack
Packet received:
Packet qSymbol (symbol-lookup) is NOT supported
(gdb) b fs/btrfs/super.c:128
Sending packet: $mc02a9f40,1#f3...Ack
Packet received: 55
Sending packet: $mc02a9f40,1#f3...Ack
Packet received: 55
Sending packet: $mc02a9f40,1#f3...Ack
Packet received: 55
Sending packet: $mc02a9f40,1#f3...Ack
Packet received: 55
Sending packet: $mc02a9f40,e#27...Ack
Packet received: 5589d189e583ec48895df489c389
Sending packet: $mc02a9f40,1#f3...Ack
Packet received: 55
Sending packet: $mc02a9f41,1#f4...Ack
Packet received: 89
Sending packet: $mc02a9f42,5#f9...Ack
Packet received: d189e583ec
Sending packet: $mc02a9f42,5#f9...Ack
Packet received: d189e583ec
Sending packet: $mc02a9f41,1#f4...Ack
Packet received: 89
Sending packet: $mc02a9f42,1#f5...Ack
Packet received: d1
Sending packet: $mc02a9f41,1#f4...Ack
Packet received: 89
Sending packet: $mc02a9f41,1#f4...Ack
Packet received: 89
Breakpoint 1 at 0xc02a9f41: file fs/btrfs/super.c, line 128.
(gdb) c
Continuing.
Sending packet: $Z0,c02a9f41,1#3d...Ack
Packet received: OK
Packet Z0 (software-breakpoint) is supported
Sending packet: $vCont?#49...Ack
Packet received:
Packet vCont (verbose-resume) is NOT supported
Sending packet: $Hc0#db...Ack
Packet received: OK
Sending packet: $c#63...Ack
Packet received: T05thread:000000000000061b;
[New Thread 1563]
Sending packet: $g#67...Ack
Packet received: 000860d6000000000000000000e09cd7cc9d19cc809e19cc0ce19cd710e09cd7429f2ac00602000060000000680000007b0000007b00eaffffff0000ffff0000
Sending packet: $P8=419f2ac0#ef...Ack
Packet received:
Packet P (set-register) is NOT supported
Sending packet: $G000860d6000000000000000000e09cd7cc9d19cc809e19cc0ce19cd710e09cd7419f2ac00602000060000000680000007b0000007b00eaffffff0000ffff0000#4b...Ack
Packet received: OK
Sending packet: $g#67...Ack
Packet received: 000860d6000000000000000000e09cd7cc9d19cc809e19cc0ce19cd710e09cd7419f2ac00602000060000000680000007b0000007b00eaffffff0000ffff0000
[Switching to Thread 1563]
Sending packet: $z0,c02a9f41,1#5d...Ack
Packet received: E02
Cannot remove breakpoints because program is no longer writable.
Further execution is probably impossible.

Sending packet: $mc02a9f41,1#f4...Ack
Packet received: cc
Breakpoint 1, btrfs_parse_options (root=0xd6600800, options=0x0) at fs/btrfs/super.c:130
130 if (!options)
(gdb) p options
$1 = 0x0
(gdb) n
(gdb) n
Sending packet: $z0,c02a9f41,1#5d...Ack
Packet received: E02
Sending packet: $Hc61b#74...Ack
Packet received: OK
Sending packet: $s#73...Ack
Packet received: T05thread:000000000000061b;
Sending packet: $g#67...Ack
Packet received: 000860d6000000000000000000e09cd7cc9d19cc809e19cc0ce19cd710e09cd7429f2ac00603000060000000680000007b0000007b00eaffffff0000ffff0000
Sending packet: $G000860d6000000000000000000e09cd7cc9d19cc809e19cc0ce19cd710e09cd7419f2ac00603000060000000680000007b0000007b00eaffffff0000ffff0000#4c...Ack
Packet received: OK
Sending packet: $z0,c02a9f41,1#5d...Ack
Packet received: E02
Cannot remove breakpoints because program is no longer writable.
Further execution is probably impossible.

Sending packet: $mc02a9f41,1#f4...Ack
Packet received: cc
Breakpoint 1, btrfs_parse_options (root=0xd6600800, options=0x0) at fs/btrfs/super.c:130
130 if (!options)
(gdb) n
Sending packet: $z0,c02a9f41,1#5d...Ack
Packet received: E02
Sending packet: $s#73...Ack
Packet received: T05thread:000000000000061b;
Sending packet: $g#67...Ack
Packet received: 000860d6000000000000000000e09cd7cc9d19cc809e19cc0ce19cd710e09cd7429f2ac00603000060000000680000007b0000007b00eaffffff0000ffff0000
Sending packet: $G000860d6000000000000000000e09cd7cc9d19cc809e19cc0ce19cd710e09cd7419f2ac00603000060000000680000007b0000007b00eaffffff0000ffff0000#4c...Ack
Packet received: OK
Sending packet: $z0,c02a9f41,1#5d...Ack
Packet received: E02
Cannot remove breakpoints because program is no longer writable.
Further execution is probably impossible.
Sending packet: $mc02a9f41,1#f4...Ack
Packet received: cc
Breakpoint 1, btrfs_parse_options (root=0xd6600800, options=0x0) at fs/btrfs/super.c:130
130 if (!options)
(gdb) n
Sending packet: $z0,c02a9f41,1#5d...Ack
Packet received: E02
Sending packet: $s#73...Ack
Packet received: T05thread:000000000000061b;
Sending packet: $g#67...putpkt: Junk: 00#06
Sending packet: $g#67...Nak
Sending packet: $g#67...putpkt: Junk: 00#06
Sending packet: $g#67...Nak
Timed out.
Timed out.
Timed out.
Ignoring packet error, continuing...
Bad register packet; fetching a new packet
Timed out.
Timed out.
Timed out.
Ignoring packet error, continuing...
Bad register packet; fetching a new packet
Timed out.
^C^C^C
Timed out.
Timed out.
Ignoring packet error, continuing...
Bad register packet; fetching a new packet
Post Reply