当前位置:网站首页>qemu+gdb小节
qemu+gdb小节
2022-06-12 17:08:00 【_kerneler】
gdb+qemu真是个好东西,为了练习这个,以后调试内核,打死也不加打印了。
qemu
首先:qemu要写个脚本:
名字叫runqemu
#!/bin/bash
#SIMPLEVGA=1024x768-16:0x0df00000 /home/andy/loongson/qemu/qemu/mips64el-softmmu/qemu-system-mips64el -M ls2k -kernel vmlinux -m 2048 -smp 1 -append 'console=ttyS0, 115200 initcall_debug=1 loglevel=20 maxcpus=1 nomsix=1 nomsi=0 [email protected]' -dtb /home/andy/loongson/code/2k/pmon-loongson3/zloader.ls2k/LS2K.dtb -s -nographic -net nic -net user "[email protected]" # -initrd ./rootfs.cpio.gz
#SIMPLEVGA=1024x768-16:0x0df00000 /home/andy/loongson/qemu/qemu/mips64el-softmmu/qemu-system-mips64el -M ls2k -kernel vmlinux -m 2048 -smp 1 -append 'console=ttyS0, 115200 initcall_debug=1 loglevel=20 maxcpus=1 nomsix=1 nomsi=0 [email protected]' -dtb /home/andy/loongson/code/2k/pmon-loongson3/zloader.ls2k/LS2K.dtb -s -nographic -net nic -net user "[email protected]" # -initrd ./rootfs-pai2.cpio.gz
#SIMPLEVGA=1024x768-16:0x0df00000 /home/andy/loongson/qemu/qemu/mips64el-softmmu/qemu-system-mips64el -M ls2k -kernel vmlinux -m 2048 -smp 1 -append 'console=ttyS0, 115200 initcall_debug=1 loglevel=20 maxcpus=1 nomsix=1 nomsi=0 [email protected]' -dtb /home/andy/loongson/code/2k/pmon-loongson3/zloader.ls2k/LS2K.dtb -s -nographic -net nic -net user "[email protected]" #
SIMPLEVGA=1024x768-16:0x0df00000 /home/andy/loongson/qemu/qemu/mips64el-softmmu/qemu-system-mips64el -M ls2k -kernel vmlinux -m 2048 -smp 1 -append 'console=ttyS0, 115200 initcall_debug=1 loglevel=20 maxcpus=1 nomsix=1 nomsi=0 [email protected]' -dtb /home/andy/loongson/code/loongson_pai/linux-4.19-loongson_new/linux-4.19.167-loongson/arch/mips/boot/dts/loongson/ls2k1000_pai_udb_v1_5.dtb -s -nographic -net nic -net user "[email protected]" #
-M 对应的是调试的办卡名字。可用./qemu -d ? 来查看支持的板卡。
-m 内存大小
-smp 模拟几个核
-append 内核启动传参
-dtb dtb的路径
-s 调试(不明)
-nographic 不起图形
./runqemu -S 单步调试。运行后之后会卡在第一行
GDB
建议开个tmux,qemu那边执行完./runqemu -S
gdb这边 gdb-multiarch vmlinux
然后进入gdb ,target remote 127.0.0.1:1234 进入调试。//qemu创建了个
gdbserver,用命令和模拟器的应用程序建立连接
之后可以ctrl + x + o ,ctrl + x +2打开代码框
然后就可以正式调试了
b设置断点
c执行
n单步不进函数
s单步但是进函数
frame 1 查看 当前函数是谁调用的(当前函数父函数)
frame 2 查看当前函数的爷爷
。。。。。
等等 。。。。。
如果没有代码框没显示代码,list也没有代码显示
记得编译的时候加+g 同事menuconfig里把kernel hacking->config_debug_info
选上
边栏推荐
- Download PHP source code of leaf sharing station
- To understand Devops, you must read these ten books!
- Analysis of CA certificate with high value
- 借助SpotBugs将程序错误扼杀在摇篮中
- First acquaintance with go language
- Male god goddess voting source code v5.5.21 voting source code
- R语言使用epiDisplay包的aggregate.plot函数可视化每个子集的汇总统计信息(可视化基于单个分组下的阳性指标的概率值及其95%置信区间、基于折线图、仅仅适用于目标类别为二分类)
- selenium元素定位
- 修改自己电脑连接的路由器的配置网址192.168.1.1
- 记录使用yolov5进行旋转目标的检测
猜你喜欢

Introduction to several common functions of fiddler packet capturing (stop packet capturing, clear session window contents, filter requests, decode, set breakpoints...)

Microsoft Office MSDT Code Execution Vulnerability (cve-2022-30190) vulnerability recurrence

redis.clients.jedis.exceptions.JedisDataException: NOAUTH Authentication required

The safety of link 01 was questioned, and "ultra high strength" became "high strength"_ Publicity_ Steel_ problem

Gerrit+2触发Jenkins任务

How to use the official documents of pytorch and torchvision

How to win the "Olympic Games" in retail technology for jd.com, the learning tyrant of the "regular examination"?

Compilation optimization of performance optimization

云开发坤坤鸡乐盒微信小程序源码

1723. 完成所有工作的最短时间
随机推荐
Nebula's practice of intelligent risk control in akulaku: training and deployment of graph model
Kill program errors in the cradle with spotbugs
C#期末复习编程题(老师猜的)
D. master router setting and 401 networking
To understand Devops, you must read these ten books!
Recommend AI intelligent drawing repair software
Where is it safer to open an account for thermal coal futures? How much is the thermal coal futures deposit?
MySQL提权总结
云开发坤坤鸡乐盒微信小程序源码
(五)输出和输出
(八)goto关键字
rolabelImg的安装使用
Difference between big end mode and small end mode
Structural requirement analysis of software engineering student information management system
js 使用Rsa 加密 解密
5-5 configuring MySQL replication log point based replication
Pat class a 1139 first contact
(6) Control statement if/else switch
su直接切换到超级管理员模式,这样很多报错都可以避免了
如何查看、修改和删除SSH