virtualbox调试linux内核,virtualbox(linux host) 调试linux guest 内核

windows host的vbox 串口可以选择namepipe,linux host同样可以选择这个配置。

在串口配置中选择host pipe,名称选择/tmp/vbox (这是local socket),选择为server(自动创建pipe文件)。

guest启动之后/tmp/vbox就建立起来了。

使用socat可以检查是否成功连接。

socat -d -d /home/fotisl/virtualbox/myvm/serial1 pty   (这里一定要是-d -d)

2009/01/01 00:00:00 socat[12345] N opening connection to AF=1 "/home/fotisl/virtualbox/myvm/serial1"

2009/01/01 00:00:00 socat[12345] N successfully connected from local address AF=1 "/x04/b/xAB"

2009/01/01 00:00:00 socat[12345] N successfully connected via /xD0/xA7/x10

2009/01/01 00:00:00 socat[12345] N PTY is /dev/pts/42009/01/01 00:00:00 socat[12345] N starting data transfer loop with FDs [3,3] and [4,4]

红字部分就是连接的目标

新开一个窗口打开gdb

gdb ~/vmlinux

GNU gdb (GDB) 6.8.50.20090628-cvs-debian

Copyright (C) 2009 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later

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:

...

(gdb)

set remotebaud 115200(gdb)

target remote /dev/pts/4Remote debugging using /dev/pts/4

guest linux一定要编译了KGDB

同时设置

# echo ttyS0,115200 > /sys/module/kgdboc/parameters/kgdboc

用# echo g > /proc/sysrq-trigger  出发调试

如果是需要启动时调试,则增加boot参数。

kgdboc=ttyS0,115200 kgdbwait

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值