当前位置:网站首页>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
选上
边栏推荐
- Introduction to several common functions of fiddler packet capturing (stop packet capturing, clear session window contents, filter requests, decode, set breakpoints...)
- Extract the new Chinese cross modal benchmark zero from 5billion pictures and texts, and Qihoo 360's new pre training framework surpasses many SOTAS
- 5-5 configuring MySQL replication log point based replication
- Information outline recording tool: omnioutliner 5 Pro Chinese version
- How to view, modify, and delete SSH
- The R language uses the tablestack function of epidisplay package to generate statistical analysis tables based on grouped variables (including descriptive statistical analysis, hypothesis test, diffe
- redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
- 叶子分享站PHP源码下载
- The safety of link 01 was questioned, and "ultra high strength" became "high strength"_ Publicity_ Steel_ problem
- pytorch和torchvision官方文档使用方法
猜你喜欢
Nebula's practice of intelligent risk control in akulaku: training and deployment of graph model
Su directly switches to super administrator mode, so that many error reports can be avoided
Installation and use of rolabelimg
Selenium element positioning
Introduction to several common functions of fiddler packet capturing (stop packet capturing, clear session window contents, filter requests, decode, set breakpoints...)
D. master router setting and 401 networking
MySQL事务简介、事务隔离级别
pytorch和torchvision官方文档使用方法
Volcano engine held a video cloud technology force summit and released a new experience oriented video cloud product matrix
Memory control of node
随机推荐
Google浏览器调试技巧
Gerrit+2 triggers Jenkins task
How to change Golan back to the English version when it becomes the Chinese version
R语言使用ggplot2可视化dataframe数据中特定数据列的密度图(曲线)、并使用xlim参数指定X轴的范围
Schrodinger's Japanese learning applet source code
初识GO语言
Doctor application | National University of Singapore, Xinchao Wang, teacher recruitment, doctor / postdoctoral candidate in the direction of graph neural network
Feedback compilation
The safety of link 01 was questioned, and "ultra high strength" became "high strength"_ Publicity_ Steel_ problem
借助SpotBugs将程序错误扼杀在摇篮中
Kill program errors in the cradle with spotbugs
redis.clients.jedis.exceptions.JedisDataException: NOAUTH Authentication required
The R language uses the tablestack function of epidisplay package to generate statistical analysis tables based on grouped variables (including descriptive statistical analysis, hypothesis test, diffe
[BSP video tutorial] stm32h7 video tutorial Issue 8: the last issue of the MDK theme, the new generation of debugging technologies event recorder and RTT, and using stm32cubemx to generate project tem
R语言使用epiDisplay包的tabpct函数生成二维列联表并使用马赛克图可视化列联表(二维列联表、边际频数、以及按行、按列的比例)、自定义设置ylab参数设置Y轴的轴标签文本(y axis)
The R language uses the pyramid function of epidisplay package to visualize the pyramid graph and the pyramid graph based on the existing summary data (table data)
Extract the new Chinese cross modal benchmark zero from 5billion pictures and texts, and Qihoo 360's new pre training framework surpasses many SOTAS
(七)循环语句for
Go的变量
Compilation optimization of performance optimization