使用Visual Studio调试ASM-注册内容将不会显示 [英] Debugging ASM with Visual Studio - Register content will not display

查看:109
本文介绍了使用Visual Studio调试ASM-注册内容将不会显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在为一个类编写汇编语言项目,尽管我终于能够解决这段代码中的所有问题(我相信),但现在似乎无法显示Register内容. /p>

这是我的代码...

include C:\Irvine\Irvine32.inc

.data
;Variables are listed in following order VAR DATATYPE DIGITS[RADIX] with 
comments showing binary version of listed digits
  left DWORD 321                                        ;101000001b
  right DWORD 4247                                  ;1000010010111b 
  total DWORD ?                                 ;uninitialized
  diff DWORD ?                                  ;uninitialized

;Define a string called message containing HELLO WORLD!
message BYTE '"Hello world!"'

;Calculate length of Array and move to var ArrayLength
  Array WORD 1,2,4,8,16,32,64                           ;Array 
  ArrayLength = ($ - Array) / 2

.code
main PROC

;Move left and right to respective registers
  MOV eax,left
  MOV ebx,right

;Add left var and right var and store in new var called total and move to 
ecx
  MOV total,eax
  ADD total,ebx
  MOV ecx,total

;Subtract left var and right var and store in new var called diff and move 
to edx  
  MOV diff,eax
  SUB diff,ebx
  MOV edx,diff

;Move Array to esi
  MOV esi,ArrayLength

  call  DumpRegs 

  exit
main ENDP
END main

当我调试时,没有收到任何错误消息,但是IDE不会显示我需要的寄存器或其内容.

我到处搜索以尝试找出问题所在并得到一些答案,并且能够找到一些有关在此网站上打开VS中的注册窗口的信息...

https://msdn.microsoft.com/en-us/library /62680774.aspx

但是,即使启用了地址级别的调试,但我仍然尝试在IDE中找到此窗口,但无济于事.我不知道我的安装方式是否有问题或VS2017中是否没有注册窗口...非常欢迎任何帮助

为了记录,我正在使用Visual Studio 2017


我尝试在call DumpRegs之后甚至是断点之后添加一个等待,但这只是使运行停顿并且什么都不显示寄存器.

添加断点后的外观

解决方案

感谢@Jester,我能够看到寄存器窗口. (请参见如何使用寄存器窗口在Visual Studio文档中.)

这可能是微不足道的,但我还是要声明.为了查看寄存器窗口,您需要在程序退出之前输入一个断点,或者使用Irvine的wait宏或call ReadChar或类似代码编写要暂停的程序.

暂停后,您可以通过调试窗口和windows子窗口到达注册器窗口,瞧,您可以看到注册器内容.

I have been working on an assembly language project for a class and though I have finally been able to work through all problems in this code ( I believe ), I now can't seem to get the Register contents to display.

Here is my code...

include C:\Irvine\Irvine32.inc

.data
;Variables are listed in following order VAR DATATYPE DIGITS[RADIX] with 
comments showing binary version of listed digits
  left DWORD 321                                        ;101000001b
  right DWORD 4247                                  ;1000010010111b 
  total DWORD ?                                 ;uninitialized
  diff DWORD ?                                  ;uninitialized

;Define a string called message containing HELLO WORLD!
message BYTE '"Hello world!"'

;Calculate length of Array and move to var ArrayLength
  Array WORD 1,2,4,8,16,32,64                           ;Array 
  ArrayLength = ($ - Array) / 2

.code
main PROC

;Move left and right to respective registers
  MOV eax,left
  MOV ebx,right

;Add left var and right var and store in new var called total and move to 
ecx
  MOV total,eax
  ADD total,ebx
  MOV ecx,total

;Subtract left var and right var and store in new var called diff and move 
to edx  
  MOV diff,eax
  SUB diff,ebx
  MOV edx,diff

;Move Array to esi
  MOV esi,ArrayLength

  call  DumpRegs 

  exit
main ENDP
END main

When I debug I get no error messages but the IDE does not display the registers or its contents which I need.

I searched everywhere to try and see what might be the problem and got some answers and was able to find some regarding opening the register window in VS on this website...

https://msdn.microsoft.com/en-us/library/62680774.aspx

But I tried to find this window in my IDE even after enabling address-level debugging but to no avail. I don't know if it is a problem with how I installed or is there no register window in VS2017 ... any help would be very welcome

For the record I am using Visual Studio 2017


I have tried adding a wait after call DumpRegs and even a breakpoint but that simply stalls the run and doesn't display the registers whatsoever..

What it looks like after I add a breakpoint

解决方案

Thanks to @Jester I was able to see the registers window. (See how to use the registers window in the Visual Studio docs.)

It may be trivial but I will state it nonetheless. In order to see the register window you need to input a breakpoint before the exit of the program or write your program to pause on it's own using the Irvine wait macro, or call ReadChar, or similar.

After it pauses, you can reach the register window by going to debug window and windows sub-window, and voila, you have the register contents visible.

这篇关于使用Visual Studio调试ASM-注册内容将不会显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆