- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在调试用汇编语言为 ARM7 微 Controller (AT91SAM7S64) 编写的简单程序时遇到问题。我使用 gcc、gdb 和 OpenOCD。
我的程序被加载到正确的目标并且工作正常(它闪烁一个 LED)。但是当我调用“next”命令时,gdb 会跳过某些源代码行。
下面是一段源代码:
Reset_Handler:
LDR R0, =0x0100
LDR R1, =PIOA_PER
STR R0, [R1]
LDR R1, =PIOA_OER
STR R0, [R1]
uuu:
bl wait;
LDR R1, =PIOA_SODR
STR R0, [R1]
uuu1:
bl wait;
LDR R2, =PIOA_CODR
STR R0, [R2]
b uuu;
@ one second delay
wait:
.............
.............
.end
(gdb) target sim
Connected to the simulator.
(gdb) load
Loading section .text, size 0xc8 vma 0x100000
Start address 0x100000
Transfer rate: 1600 bits in <1 sec.
(gdb) b Reset_Handler
Breakpoint 1 at 0x100064: file main.s, line 59.
(gdb) run
Starting program: C:\Arm\Projects\Asm/./main.elf
Breakpoint 1, Reset_Handler () at main.s:60
60 LDR R1, =PIOA_PER
(gdb) n
61 STR R0, [R1]
(gdb) n
63 LDR R1, =PIOA_OER
(gdb) n
64 STR R0, [R1]
(gdb) n
uuu () at main.s:66
66 bl wait;
(gdb) n
67 LDR R1, =PIOA_SODR
(gdb) n
68 STR R0, [R1]
(gdb) n <<<<<--------- Here the problem begins
67 LDR R1, =PIOA_SODR
(gdb) n
68 STR R0, [R1]
(gdb) n
67 LDR R1, =PIOA_SODR
(gdb) n
68 STR R0, [R1]
(gdb) stepi <<<<<------ Doing a 'stepi' command allows to pass below 'uuu1' label
uuu1 () at main.s:70
70 bl wait;
(gdb) n
71 LDR R2, =PIOA_CODR
(gdb) n
72 STR R0, [R2]
(gdb) n
73 b uuu;
(gdb) n <<<<<--------- Here the problem begins again
71 LDR R2, =PIOA_CODR
(gdb) n
72 STR R0, [R2]
(gdb) n
73 b uuu;
(gdb) n
71 LDR R2, =PIOA_CODR
(gdb) where
#0 uuu1 () at main.s:71
#1 0x00100084 in uuu1 () at main.s:70
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
arm-none-eabi-gdb --version
GNU gdb (GDB) 7.1
..........
This GDB was configured as "--host=i686-pc-mingw32 --target=arm-none-eabi".
arm-none-eabi-gcc --version
arm-none-eabi-gcc (GCC) 4.5.1
TRGT = arm-none-eabi-
CC = $(TRGT)gcc
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
#AS = $(TRGT)as
LD = $(TRGT)ld
OBJDUMP = $(TRGT)objdump
LD_SCRIPT = main.ld
MCU = arm7tdmi
#DEBUG = stabs
DEBUG = dwarf-2
ASFLAGS = -mcpu=$(MCU) -g$(DEBUG)
LDFLAGS = -T $(LD_SCRIPT)
all: main.elf main.lss
@echo Done!
main.elf : main.o
@echo Linking $<
$(CC) -nostartfiles $(LDFLAGS) $< -o $@
main.o : main.s
@echo Compiling $<
$(AS) -c $(ASFLAGS) $< -o $@
最佳答案
尝试在问题代码中使用“si”而不是 n。
“n”或多或少是下一条语句,“si”是下一条汇编指令。
如果一段 asm 的调试代码不正确,“si”可能仍然允许您单步执行,利用在这种情况下“语句”和“汇编程序”级别相同的事实。
关于gcc - Gdb 在调试 ARM7 微 Controller 的汇编程序时跳过源代码行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4308354/
我必须在操作后写入寄存器的目的地和值。 斜体字的字段是我写的。粗体字段(如说明)由我的教授编写。 我曾尝试填写所有字段,但不确定答案。 如果你能告诉我哪里出了问题,我会很高兴,谢谢! :) 最佳答案
bios 中断函数 21h (ah = 1h) 应该从标准输入中读取一个字符并回显它。 我的阅读功能: mov ah, 1h int 21h 所以,如果我按下一个键,它会意识到这一点,
是否有 actionscript 3 的汇编器?类似于 Flasm,但用于 AS3(flasm 是 AS2)。我想将 AS3 程序集编译为独立的 SWF,或将其注入(inject)现有的 SWF。 我
我的汇编代码在调用 xbegin 时引发非法指令。 有什么问题吗? 这是我的代码。 主.c if ( rtm_begin() == 0 ) { //do something. } rtm.S
有人可以用英语解释什么是汇编程序中的相对跳转吗? 最佳答案 它是一个 OP 代码,其操作数将导致执行跳转到相对于当前地址的地址。操作数的值是 偏移 . 假设相对跳转指令保存在地址 0x0005 中,操
这个问题不太可能对任何 future 的访客有帮助;它只与一个较小的地理区域、一个特定的时间点或一个非常狭窄的情况相关,通常不适用于全世界的互联网受众。如需帮助使此问题更广泛适用,visit the
我正在尝试学习 Assembly,并将其用于 64 位。我想用 C 语言编译内联汇编程序,但每次都会出错。 #include int main() { __asm__ ( "mov %rdx, 10
我编写了一个 SIC 汇编程序,除了 I/O 方面外,一切似乎都运行良好。 我已经将目标代码加载到内存中(将 char 格式转换为机器表示形式),但是当我调用 SICRun();执行代码时,我收到一条
我正在学习汇编程序(Nasm、Linux、Ubuntu 16.4、x86_64)并在使用 sys_time 调用时出现问题 (mov eax, 13)。 section .bss time:
在汇编器中: .globl _test _test: pushl %ebp movl %esp, %ebp movl 8(%ebp), %eax pushl %eax call printf popl
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,
我正在阅读杰夫的精彩著作 assembly step by step ,我在第 8 章中展示了一个汇编程序示例,该程序以这种方式从用户那里获取文件: SECTION .bss ;
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 1年前关闭。 锁定。这个问题及其答案是loc
我有一个简短的问题。我正在使用 MARS 汇编程序(在 MIPS 指令集中编程)并且我有两个 MIPS 文件。一个文件包含我要运行的主要方法,它调用另一个文件中的函数。我的函数前面有 .globl 指
我必须回答以下关于 6502 汇编语言的问题: “在堆栈上,有以下值(顶部元素在前):0x01, 0x02, 0x03, 0x04, 0x05, 0x06地址 0xc000 是指令 jsr 0xABC
我实际上是在学习汇编,我用的是 Gas,但问题是: 1) 我只知道 Intel 语法,我在一个页面上看到使用 intel 语法的 Gas 在某些情况下优化得不是很好。这是正确的还是我错了?我说的是这个
在汇编程序中,我可以使用 MUL 命令并获得 64 位结果 EAX:EDX,我怎样才能在 C 中做同样的事情? http://siyobik.info/index.php?module=x86&id=
作为编译器项目的一部分,我必须为 x86 编写 GNU 汇编程序代码来比较浮点值。我试图找到有关如何在线执行此操作的资源,据我所知,它是这样工作的: 假设我要比较的两个值是浮点堆栈上的唯一值,那么 f
我有一个用 2 个不同的编译器编译的程序: GCC 3.4.4 PowerPC 交叉编译器 GCC 4.8.1 MinGW 编译器 在程序中,我使用了汇编程序指令 .weak 。文档说: 使具有弱绑定
我写了一个简单的 ASM 程序,但 sys_write 没有给出任何输出。我想我对指向 %ecx 的指针犯了一个错误,并且 sys_write 无法访问该字符串 - 但到目前为止我还没有发现我的错误。
我是一名优秀的程序员,十分优秀!