如何编写一个简单的调试器? [英] How to write a simple debugger?

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

问题描述

我想将编译的目标代码连接到c ++代码,然后检查是否执行了特定的代码行.怎么做这两件事?

I would like to connect my compiled object code to the c++ code, and then to check if a certain line of code was executed. How to do those two things?

如果解释不简单(我敢打赌不是这样),那么有人至少可以指向一些解释该操作方法的网页吗?

If the explanation is not simple (I bet it is not), can someone at least point to some web pages explaining how to do this?

我了解该解决方案对于不同的平台会有所不同,但是我对Windows和linux(首先是linux)上的实现方式感兴趣.

I understand that the solution is different for different platforms, but I am interested in how it is done on windows and linux (linux for the start)

推荐答案

如果您想知道它是如何完成的,

If you want to know how it is done,

  • gdb is open source
  • the ptrace syscall should get you started,
  • libunwind-ptrace

这是使用ptrace的不错的文章

这篇关于如何编写一个简单的调试器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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