我是一名 CS 学生,刚刚学习mips了课堂基础知识(Patterson & Hennessy + spim),我正在尝试找到一种mips调试解决方案,允许在调试过程中执行任意指令。
尝试使用 gdb(所以你知道为什么不建议这样做)
推荐的mips交叉编译工具链是qemuand gdb,参见mips.com 文档和相关问答。
gdb的compile code命令不支持mips-linux-gnu-gcc,据我所知,请参阅gdb 文档(“重定位目标文件”)和相关的Q/A。我得到的错误malloc,mmap和无效的内存错误(显示的东西是想错了与即席连接gdb尝试使用时执行)compile code用mips-linux-gnu-gcc,甚至过滤出硬编码的编译参数后mips-linux-gnu-gcc不承认。
实际问题
lldb有一个类似的命令expression,请参阅lldb 文档,我有兴趣lldb与qemu. 该expression命令也依赖于clang而不是gcc,但在 clang 中交叉编译相对简单(clang -target mips-linux-gnu“正常工作”)。唯一的问题是qemu-mips -g …
我正在尝试使用GNU汇编程序学习ARM汇编程序编程.我用QEmu设置了我的PC,并拥有Debian ARM-HF chroot环境.
如果我汇编并链接我的测试程序:
.text
.global _start
_start:
mov r0, #6
bx lr
Run Code Online (Sandbox Code Playgroud)
有:
as test.s -o test.o
ld test.o -o test
Run Code Online (Sandbox Code Playgroud)
然后将文件加载到gdb并在_start上设置断点:
root@Latitude-E6420:/root# gdb test GNU gdb (GDB) 7.6.1 (Debian 7.6.1-1) Copyright (C) 2013 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 …
该CopyMemory函数必须将部分内存复制到另一个位置。
CopyMemory
; The CopyMemory function receives the following parameters:
; R0: Address of the first 32-bit word to copy
; R1: Address of the last 32-bit word to copy
; R2: Destination address
ADD R4, R1, #4
Loop
CMP R4, R1
BEQ EndLoop
LDR R3, [R0]
STR R3, [R2]
ADD R0, R0, #4
ADD R2, R2, #4
B Loop
EndLoop
EndCopyMemory
BX LR
Run Code Online (Sandbox Code Playgroud)
我的代码有错误,但我看不出它是什么。我做错了什么吗?