gpt4 book ai didi

debugging - DOS DEBUG 跟踪命令无法按我的预期工作

转载 作者:行者123 更新时间:2023-12-01 22:19:21 24 4
gpt4 key购买 nike

我有 ASM 代码,它使用循环语法打印 abc 。这是我的代码

;abc.com
.model small
.code
org 100h
start:
mov ah, 02h
mov dl, 'a'
mov cx, 3h

ulang:
int 21h
inc dl
loop ulang

int 20h
end start

COM程序正常运行 enter image description here

debug abc.com 后跟 -t 的结果看起来像 NOP after int 21

问题是为什么INT 21之后是NOP,而不是INC dl?据我所知,应该INC dl然后LOOP xxxx三次,然后INT 20

当我连续按-t时,它会去某个我不知道的地方直到崩溃,意味着找不到INT 20h

debug abc.com 后跟 -u 不同 red arr indicate loop

显示 INC dlLOOP 0107 表示循环。

仅供引用:

  • Win 7 Ultimate SP 1 32 位
  • GUI Turbo ASM x86 3.0
  • 赛扬双核 n2840

最佳答案

调试中的Trace 命令相当于现代调试器的STEP INTO 功能。 int 指令(如call)执行一系列指令,然后返回给调用者。 Trace 将进入软件中断处理程序或函数并一次执行一条指令。 MSDN调试文档这样描述了 Trace:

Executes one instruction and displays the contents of all registers, the status of all flags, and the decoded form of the instruction executed.

在您的情况下,您点击了 int 21h 并跳转到 CS:IP 00A7:107C 处的软件中断处理程序代码。如果跟踪所有中断处理程序代码,您最终会到达 1400:0109 的 CS:IP,其中 INC DL 指令所在的位置。

为了执行函数或中断而不单步执行与其关联的每条指令,您可以使用 proceed 命令。继续类似于现代调试器的STEP OVER功能。中断处理程序或函数/子例程的代码将执行,然后在 INTCALL 指令之后的指令上中断。

文档中这样描述PROCEED:

When the p command transfers control from Debug to the program being tested, that program runs without interruption until the loop, repeated string instruction, software interrupt, or subroutine at the specified address is completed, or until the specified number of machine instructions have been executed. Control then returns to Debug.

关于debugging - DOS DEBUG 跟踪命令无法按我的预期工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35946330/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com