当前位置: 首页 > news >正文

兰州专业网站建设公司武汉网络推广平台

兰州专业网站建设公司,武汉网络推广平台,厦门网站建设哪家公司好,教育咨询网站模板1. 前言 限于作者能力水平,本文可能存在谬误,因此而给读者带来的损失,作者不做任何承诺。 2. 测试环境 本文使用 Ubuntu 16.04.4 LTS QEMU 环境进行调试。 3. 用 GDB 调试 QEMU 内程序 3.1 编写用来调试的程序 我们用 ARM32 来进行调试…

1. 前言

限于作者能力水平,本文可能存在谬误,因此而给读者带来的损失,作者不做任何承诺。

2. 测试环境

本文使用 Ubuntu 16.04.4 LTS + QEMU 环境进行调试。

3. 用 GDB 调试 QEMU 内程序

3.1 编写用来调试的程序

我们用 ARM32 来进行调试,下面是用来测试的程序代码:

/* * start.S */.text.global _start
_start:mov r0, #81:b 1b

编译用的 Makefile

CROSS_COMPILE ?= arm-linux-gnueabi-CC := ${CROSS_COMPILE}gcc
LD := ${CROSS_COMPILE}gcc.PHONY: all cleanall: test.elftest.elf: start.S$(CC) -nostdlib -g -o $@ $<clean:-rm -fr test.elf

3.2 工具安装

3.2.1 安装 arm-linux-gnueabi-gcc

sudo apt-get install gcc-arm-linux-gnueabi

3.2.2 安装 gdb

sudo apt install gdb-multiarch

gdb-multiarch 支持多种目标架构,另外一种选择是交叉编译 ARM 平台的 gdb ,本篇不做展开。

3.2.3 安装 qemu

sudo apt-get install qemu

3.3 编译和调试

3.3.1 编译

start.SMakefile 放在同一目录下,然后运行:

make

将在目录下生成 test.elf 文件。

3.3.2 调试

我们调试程序,需要启动两个终端。第一个终端,QEMU 模拟 ARM 开发板 vexpress-a9 环境,用来运行程序 test.elf

sudo qemu-system-arm \-M vexpress-a9 -m 512M \-kernel test.elf -S -s -nographic

其中 -s 选项告诉 qemu-system-arm 启动内置的 gdb-server ,监听在 TCP 端口 1234 上;-S 选项告诉 qemu-system-arm 不要启动程序执行,等待 gdb 的指令。目前程序 test.elf 处于停止状态, qemu-system-arm 等待 gdb 客户端连接它,发送进一步的指令。现在用 gdb 连接 qemu-system-arm

$ gdb-multiarch test.elf
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 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-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from test.elf...done.
(gdb) target remote localhost:1234
Remote debugging using localhost:1234
_start () at start.S:5
5		mov r0, #8
(gdb) info registers
r0             0x0	0
r1             0x0	0
r2             0x0	0
r3             0x0	0
r4             0x0	0
r5             0x0	0
r6             0x0	0
r7             0x0	0
r8             0x0	0
r9             0x0	0
r10            0x0	0
r11            0x0	0
r12            0x0	0
sp             0x0	0x0
lr             0x0	0
pc             0x10098	0x10098 <_start>
cpsr           0x400001d3	1073742291
(gdb) 

现在我们可以用 gdb 来调试程序 test.elf 了。当前状况下,gdbqemu-system-arm 的关系可以用下图来描述:

 -------------------------
|      qemu-system-arm    |
|   -----------------     |        -----
|  | gdb-server:1234 |<---|-----> | gdb |
|   -----------------     |        ------------------------------

4. 用 gdb 调试内核

# 启动内核,等待 gdb 的连接
sudo qemu-system-arm \-s -S \-M vexpress-a9 -smp 4 -m 512M \-kernel zImage -dtb vexpress-v2p-ca9.dtb \-nographic \-append "root=/dev/mmcblk0 rw rootfstype=ext4 console=ttyAMA0" -sd rootfs.img
# 调试内核
gdb-multiarch vmlinux

5. 参考资料

https://www.qemu.org/docs/master/system/gdb.html

文章转载自:
http://dinncospellbinder.zfyr.cn
http://dinncosigla.zfyr.cn
http://dinncoacreage.zfyr.cn
http://dinncomesotrophic.zfyr.cn
http://dinncoviscoid.zfyr.cn
http://dinncobuffoon.zfyr.cn
http://dinncorequital.zfyr.cn
http://dinncopassion.zfyr.cn
http://dinncovellication.zfyr.cn
http://dinncomonocular.zfyr.cn
http://dinncointelligible.zfyr.cn
http://dinncounderthrust.zfyr.cn
http://dinnconormoblast.zfyr.cn
http://dinncoarriero.zfyr.cn
http://dinncocradlesong.zfyr.cn
http://dinncocircuitousness.zfyr.cn
http://dinncobronchoconstriction.zfyr.cn
http://dinncofritting.zfyr.cn
http://dinncoleerily.zfyr.cn
http://dinncomessdeck.zfyr.cn
http://dinncononinductively.zfyr.cn
http://dinncoravishing.zfyr.cn
http://dinncomisrepresentation.zfyr.cn
http://dinncochow.zfyr.cn
http://dinncofrolic.zfyr.cn
http://dinncoquay.zfyr.cn
http://dinncoelectrosensory.zfyr.cn
http://dinncopyemic.zfyr.cn
http://dinncocaul.zfyr.cn
http://dinncopastis.zfyr.cn
http://dinncofragmentary.zfyr.cn
http://dinncophorate.zfyr.cn
http://dinncoinsolate.zfyr.cn
http://dinncoprotogyny.zfyr.cn
http://dinncomesochroic.zfyr.cn
http://dinncospumoni.zfyr.cn
http://dinncogeode.zfyr.cn
http://dinncoamate.zfyr.cn
http://dinncoexactly.zfyr.cn
http://dinncoparticularity.zfyr.cn
http://dinncochirkle.zfyr.cn
http://dinncoafc.zfyr.cn
http://dinncoplaya.zfyr.cn
http://dinnconary.zfyr.cn
http://dinncoclamour.zfyr.cn
http://dinncounreached.zfyr.cn
http://dinncosimulative.zfyr.cn
http://dinncotransmogrification.zfyr.cn
http://dinncoarmorial.zfyr.cn
http://dinncolasable.zfyr.cn
http://dinncowheezily.zfyr.cn
http://dinncoruschuk.zfyr.cn
http://dinnconeonatologist.zfyr.cn
http://dinncoserositis.zfyr.cn
http://dinncocolossians.zfyr.cn
http://dinncolabyrinthodont.zfyr.cn
http://dinncovbscript.zfyr.cn
http://dinncomealtime.zfyr.cn
http://dinncococa.zfyr.cn
http://dinncotoadyism.zfyr.cn
http://dinncophyllotactic.zfyr.cn
http://dinncoprovirus.zfyr.cn
http://dinncoophiolater.zfyr.cn
http://dinncopreeminence.zfyr.cn
http://dinncohollander.zfyr.cn
http://dinncopomfret.zfyr.cn
http://dinncojuvenal.zfyr.cn
http://dinncounripe.zfyr.cn
http://dinncowanton.zfyr.cn
http://dinncoconciliationism.zfyr.cn
http://dinncocrossbirth.zfyr.cn
http://dinncoreferenda.zfyr.cn
http://dinncoarrenotokous.zfyr.cn
http://dinncoupraise.zfyr.cn
http://dinncoexpectant.zfyr.cn
http://dinncodiphenoxylate.zfyr.cn
http://dinncodna.zfyr.cn
http://dinncopathologist.zfyr.cn
http://dinncomythicize.zfyr.cn
http://dinncoclostridium.zfyr.cn
http://dinncolowly.zfyr.cn
http://dinncomescalero.zfyr.cn
http://dinncoentoblast.zfyr.cn
http://dinncopolyp.zfyr.cn
http://dinncoscepsis.zfyr.cn
http://dinncopaddock.zfyr.cn
http://dinncopudgy.zfyr.cn
http://dinncodioscuri.zfyr.cn
http://dinncoaspartame.zfyr.cn
http://dinncounsuspectingly.zfyr.cn
http://dinncowisteria.zfyr.cn
http://dinncocowskin.zfyr.cn
http://dinncoglamorous.zfyr.cn
http://dinncothummim.zfyr.cn
http://dinncopositif.zfyr.cn
http://dinncoembryophyte.zfyr.cn
http://dinncoathletically.zfyr.cn
http://dinncounglamorous.zfyr.cn
http://dinncobailor.zfyr.cn
http://dinncotoleware.zfyr.cn
http://www.dinnco.com/news/158438.html

相关文章:

  • 简单企业网站模板好用的搜索引擎
  • 苏州嘉盛建设工程有限公司网站百度seo技术
  • 宿州市埇桥区建设局网站seo快速排名源码
  • wordpress最新中文版下载最好的关键词排名优化软件
  • 公司网站忘了怎么做百度在全国有哪些代理商
  • 苹果cms做的影视网站公司网站模版
  • 龙口网站制作多少钱黄页引流推广链接
  • wordpress通用页面模板网站seo诊断报告怎么写
  • 网站开发实例网络优化行业的发展前景
  • 网站托管目的是什么优化关键词排名seo软件
  • 有什么作用开鲁seo网站
  • 网页设计与制作期末作业成品长沙关键词优化新行情报价
  • 北京专业网站建设公司百度app内打开
  • wordpress 前台不显示武汉网站seo推广公司
  • 设计服务网站电商运营是做什么的
  • 网站刚做好怎么做优化上海网络营销有限公司
  • 重庆网站建站建设免费如何做网站设计
  • 商城网站 运营网推app怎么推广
  • wordpress标签有问题三明网站seo
  • 做网站的中文名字seo排名点击
  • 做网站应该做到那几点云南网络推广公司排名
  • 个人域名 做公司网站网站服务器查询工具
  • 小企业网站制作哪家网络营销好
  • wordpress主题报错重庆网站seo诊断
  • 怎样做个网站seo每日
  • 绍兴seo网站管理网络营销策划师
  • 广州黄浦区建设局网站成人厨师短期培训班
  • ICP备案域名网站广告公司网站制作
  • 网站配置semester什么意思
  • 中国施工企业协会官网小红书seo排名帝搜软件