怎么写简单的Windows调试循环? [英] How write simple Windows debug loop?

查看:71
本文介绍了怎么写简单的Windows调试循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的要点:
https://gist.github.com/borneq/c780e34fbfeddc90ae1a224154502119

在EXCEPTION_DEBUG_EVENT我读取进程内存。有问题,如何进入新指令?

At EXCEPTION_DEBUG_EVENT I read process memory. There are problem, how step into new instruction?

基本问题:ctx.Eip下的指令读取是int3之后的指令。 ctx.Eip-1是int3,但我不知道原始指令。上 。 ,github我发现大型调试项目 ,通常是不可编译的,
但是哪里是简单的工作示例?

Base problem: instruction reading under ctx.Eip is one after int3. ctx.Eip-1 is int3, but I don't know original instruction. On . , github I find big debugger projects, often non-compilable, but where is simple working example ?

推荐答案

嗨Borneqa,

Hi Borneqa,

感谢您在这里发帖。

>>基本问题:ctx.Eip下的指令读取是int3之后的指令。 ctx.Eip-1是int3,但我不知道原始指令。上 。 ,github我找到了大的调试器项目,通常是不可编译的,但是哪里是简单的工作示例?

调试器经常读取正在调试的进程的内存并写入内存包含指令缓存的指令。写完说明后,调试器会调用 

FlushInstructionCache
用于执行缓存指令的函数。调试器使用 

ContinueDebugEvent
在主循环结束时运行。此函数允许正在调试的进程继续执行。以下示例使用 

WaitForDebugEvent
和 
ContinueDebugEvent
功能说明如何可能会组织一个简单的调试器。

Debuggers frequently read the memory of the process being debugged and write the memory that contains instructions to the instruction cache. After the instructions are written, the debugger calls the  FlushInstructionCache function to execute the cached instructions. The debugger uses the  ContinueDebugEvent function at the end of its main loop. This function allows the process being debugged to continue executing. The following example uses the  WaitForDebugEvent and  ContinueDebugEvent functions to illustrate how a simple debugger might be organized.

这是一个关于调试器主循环的示例代码,希望这可以帮到你。

Here is a sample code about Debugger's Main Loop, Hope this could be help of you.

https://msdn.microsoft.com/en-us/library/ windows / desktop / ms681675(v = vs.85).aspx

最好的问候,

Sera Yu


这篇关于怎么写简单的Windows调试循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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