HH123_3
2022-01-23 23:53
采纳率: 92.3%
浏览 16

刚学Win32汇编语言,使用MASM32 sdk来进行汇编、链接和调试,这个自带的调试工具Vkdebug该如何使用

我看了vkdebug帮助文档之后,大概了解到以下信息

  1. 一些命令 ,如`PrintHex value [,text]" 以十六进制的形式输出value的值,value可以为寄存器或一个变量,可选输出text所表示的文本内容
  2. 在使用vkdebug之前,需要添加一些include...语句,如下所示
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
include \masm32\include\debug.inc 

includelib \masm32\lib\masm32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\debug.lib
  1. ;DBGWIN_DEBUG_ON = 1 ;turn it off if you don't want to include debug info into the program
    ;DBGWIN_EXT_INFO = 1 ;turn it off if you don't want to include extra debug info into the program 
    

写了一个汇编程序,来计算几个数的和,我想用vkdebug来查看最后的结果(PrintHex sum, "Sum value"), 程序如下

; AddVariables.asm
.386
.model flat, stdcall
.stack 4096
option casemap:none
ExitProcess PROTO, dwExitCode:DWORD


include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
include \masm32\include\debug.inc 

includelib \masm32\lib\masm32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\debug.lib

DBGWIN_DEBUG_ON = 1
DBGWIN_EXIT_INFO = 1

.data 
firstval DWORD 20002000h
secondval DWORD 11111111h
thirdval DWORD 22222222h
sum DWORD 0



.code
main PROC
    mov eax, firstval
    add eax, secondval
    add eax, thirdval
    mov sum, eax
    PrintHex sum, "Sum value"

    INVOKE ExitProcess,0
main ENDP
END main

然后我依次执行以下命令进行汇编、链接和执行,都没有报错,但是debug没看到起作用啊?我想要的最终结果没有看到,这个vkdebug该如何使用啊?

ml /c /coff AddVariable.asm
link /subsystem:windows AddVariable.obj
AddVariable.exe

1条回答 默认 最新

相关推荐 更多相似问题