如何在VC++ 6.0中实现拖动指令改变执行路径?
前文提要:
在VC6.0之后出现的VS系列开发工具都具有的调试功能:移动指针更改执行流,VC6不支持这个UI操作。
调试程序暂停时,源代码或“反汇编”窗口边距处的黄色箭头标记要运行的下一条语句的位置。 你可以通过移动此箭头来更改要运行的下一条语句。 你可以跳过代码,或者返回上一行。 在某些情况下移动指针很有用,例如,跳过包含已知 bug 的代码。
突发在奇想之后,想到了改变寄存器EIP的值来实现,文尾给出VC6环境下如何实现。
Move the pointer to change the execution flow
When the debugger is paused, a yellow arrow in the margin of the source code or Disassembly window marks the location of the statement that will run next. You can change the next statement that will run by moving this arrow. You can skip over code or return to a previous line. Moving the pointer is useful for situations like skipping code that contains a known bug.

If you want to change the next statement that will run, the debugger must be in break mode. In the source code or Disassembly window, drag the yellow arrow to a different line, or right-click the line you want to run next and select Set Next Statement.
The program counter jumps directly to the new location. Instructions between the old and new execution points aren't run. But if you move the execution point backwards, the intervening instructions aren't undone.
Caution
- Moving the next statement to another function or scope usually causes call-stack corruption, which causes a runtime error or exception. If you try to move the next statement to another scope, the debugger gives you a warning and a chance to cancel the operation.
- In Visual Basic, you can't move the next statement to another scope or function.
- In native C++, if you have runtime checks enabled, setting the next statement can cause an exception when execution reaches the end of the method.
- When Edit and Continue is enabled, Set Next Statement fails if you've made edits that Edit and Continue can't remap immediately. This situation can occur, for example, if you've edited code in a catch block. When this happens, an error message tells you that the operation isn't supported.
- In managed code, you can't move the next statement if:
- The next statement is in a different method than the current statement.
- Debugging was started by Just-In-Time debugging.
- A call stack unwind is in progress.
- A System.StackOverflowException or System.Threading.ThreadAbortException exception has been thrown.
熟悉Visual Studio开发工具的朋友们都已经习惯在调试代码时,通过拖动指令光标位置实现代码指令跳转(跳过某些不想要的条件判断),此功能比单步执行要灵活许多。
碰到手里还有VC6的老C++项目时,突然没有这个功能,非常不适应,在Google还未退出中国时就想过这个问题,水平有限也没有搜到解决办法。
就在昨天,想到了一招直接手动修改EIP指令来实现,简单介绍一下 VC6环境修改CPU寄存器的两种方法,也许对一部分朋友还是有些帮助的。
下面是VC6的环境示意图:

图中分别列出了源代码与反汇编代码窗体,同时也列出了寄存器窗口与右下角的变量观察辅助对话框
我们可以直接点击寄存器窗体中的 EIP 寄存器变量值的位置(不要双击,在要修改的位置前面单击即可)或是在变量观察对话框中双击value部分
需要注意:变量观察输入的是 EIP ,实际情况是需要输入@EIP的,这样不会与本地同名同量起冲突的
我们看到源码中当前指令执行到0X00A70B5E,同时EIP的值也是这个,我可改变它为:00A70B77,这样代码再次运行时,将直接实现跳转,略过前面的指令。
曲线实现了【移动指针更改执行流】,前面有英文注解, 需要注意的条件 :)
如何在VC++ 6.0中实现拖动指令改变执行路径?的更多相关文章
- 如何在Cocos2D 1.0 中掩饰一个精灵(一)
大熊猫猪·侯佩原创或翻译作品.欢迎转载,转载请注明出处. 如果觉得写的不好请告诉我,如果觉得不错请多多支持点赞.谢谢! hopy ;) 原帖来自Ray Wunderlich写的精彩的文章 How To ...
- VC++6.0中ClassView中类消失 解决方案[转自网络]
有时候在VC++6.0中编程会出现这样一个问题,由于对C...View类的操作后,在窗口左边ClassView框中的C...View类会消失,这种操作通常是在C...View类中右击点“Add Win ...
- VC++ 6.0中实现三叉切分窗口与多视图 [转]
一.引用 当用户需要同时对文当的不同部分进行编辑时,常常会用到切分窗口;这些窗口可以都是相同的视,或者一个窗口为列表视,而另一个为树型视图.应用程序框架有多种方式来表示多视图,切分窗口是其中的方式之一 ...
- VC++ 6.0 中使用 MSComm.ocx
很多人喜欢单独安装VC++6.0,而不是完整安装VS,这样占用空间比较少,启动也快.但是要使用某些ActiveX控件的时候却会出现许可证问题(requires a design-time licenc ...
- wxWidgets编译和在VC 6.0中的配置
1. 安装 运行wxMSW-2.8.3-Setup1.exe,将之安装到不带空格符号的目录中,本例为C:/wxWidgets-2.8.3: 2. 编译和配置 (1) 用VC6.0编译 进入C: ...
- vc++6.0中查看函数栈的结构
栈:一种后进先出的数据结构 比如:弹夹 函数调用的约定 传参顺序 传参媒介 如何传递返回值 平衡参数(堆栈平衡):有且只有被调方(callee)和调用方(caller)一方执行 _cdell (c ...
- VC++6.0中不兼容问题
记得上次用VC++6.0已经是很长一段时间之前的事情了.这次由于需要学习计算机图形学,要开始学这写一些算法之类的,我又开始了VC++之旅. 重新安装一个vc++,我用的是Visual C++ 6.0( ...
- VC++ 6.0中添加库文件和头文件
附加头文件包含 VC6.0中: VC6.0默认include包含路径:Tools>Options>Directories>Include files. 对于特定项目的头文件包含,在& ...
- 如何在Cocos2D 1.0 中掩饰一个精灵(六)
大熊猫猪·侯佩原创或翻译作品.欢迎转载,转载请注明出处. 如果觉得写的不好请告诉我,如果觉得不错请多多支持点赞.谢谢! hopy ;) 掩饰一个精灵:实现代码 打开HelloWorldLayer.m并 ...
- VC 6.0中添加库文件和头文件 【转】
本文转载自:http://blog.sina.com.cn/s/blog_9d3971af0102wxjq.html 加头文件包含 VC6.0中: VC6.0默认include包含路径:Tools&g ...
随机推荐
- 关于CSDN微信登录接口的研究
代码 import requests import re from threading import Thread import time import requests from io import ...
- jsp 页面返回、本页面刷新
返回上一页面: window.history.go(-1); //返回上一页window.history.back(); //返回上一页 返回上一页面并对上一页面刷新: history.go(-1 ...
- day17 MySQL的安装 & 数据库基本语法——增删改查
day17 MySQL 登录数据库 mysql -h localhost -P 3307 -u root -p 查看所有数据库 show databases; 退出数据库 exit; //现有表格 u ...
- 5V升压12.6V
产品概述 PW4053 是一款 5V 输入,最大 1.2A 充电电流,支持三节锂离子电池的升压充电管理 IC.PW4053 集成功率 MOS,采用异步开关架构,使其在应用时仅需极少的外围器件,可有效减 ...
- 全都会!预测蛋白质标注!创建讲义!解释数学公式!最懂科学的智能NLP模型Galactica尝鲜 ⛵
作者:韩信子@ShowMeAI 机器学习实战系列:https://www.showmeai.tech/tutorials/41 深度学习实战系列:https://www.showmeai.tech/t ...
- C/C++标准输入输出函数终极最全解析(不全捶我)
C/C++的一众输入输出函数的区别常常搞得人晕头转向,二者之中又以输入函数更加令人头疼.本文尝试整理C/C++的各种输入输出函数. 由于输入涉及空格.换行符的读取.忽略等问题,因此输入比输出更麻烦.所 ...
- Gradle 使用maven本地仓库 带来的思考
Gradle 使用maven本地仓库 带来的思考 本篇主要探究一下 在使用Gradle 的时候一般会配置 maven 的本地仓库的,那是不是Gradle 可以直接使用 maven本地仓库的jar呢 ? ...
- Mybatis-9.28
Mybatis-9.28 环境: JDK1.8 Mysql 5.7 maven 3.6.1 IDEA 回顾: JDBC Mysql Java基础 Maven Junit SSM框架:配置文件的. 最好 ...
- vscode下无法使用fresh的问题
使用了go get github.com/pilu/fresh ,需要 go install github.com/pilu/fresh. 在带用go.mod的版本中,go get只是下载代码和帮助修 ...
- 如何自定义调整bootstrap的模态框大小
背景 项目遇到一个需求,一个大表格放到模态框中,总是会出现撑开的效果,换了文档最大的modal-lg样式还不能解决,原因就是官方不支持更大号的模态框,需要自定义. 经过尝试理解,总结出调整模态框大小通 ...