c - 构建 Linux 调试器 C

标签 c linux debugging

尝试用 C 构建调试器以进行模糊测试。

基本上在linux中,我只是想通过fork启动一个进程,然后execve(),然后监控这个进程,看它是否在1秒后崩溃。

在 Linux 上,这是通过创建进程然后监视它为任何看起来像崩溃的东西生成的信号来完成的吗?或者是关于监控应用程序和?我不知道。

最佳答案

使用 ptrace(2)系统调用:

While being traced, the child will stop each time a signal is delivered, even if the signal is being ignored. (The exception is SIGKILL, which has its usual effect.) The parent will be notified at its next wait(2) and may inspect and modify the child process while it is stopped. The parent then causes the child to continue, optionally ignoring the delivered signal (or even delivering a different signal instead).

关于进程崩溃,您应该感兴趣的信号是 SIGSEGV(受限内存访问)、SIGBUS(未对齐数据访问)、SIGILL (非法指令)、SIGFPE(非法浮点运算)等

关于c - 构建 Linux 调试器 C,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7702492/

相关文章:

c - 如何确定 snprintf 目标缓冲区大小

c++ - C/C++ 函数指针的 UML 表示

c++ - 在运行时以编程方式检测 CPU 架构

c - 如何使用 Linux 系统调用在 C 中更改用户密码?

java - Android Studio 应用程序在真实设备上崩溃,但在模拟器上运行

c - “自动取款机”模拟器

sql-server - 适用于 Linux Docker 版本的 MSSQL Server

java - MPJ - 使用 mpjboot 时出现 Express 错误

google-chrome - 如何设置播放声音的断点

java - 为什么 Eclipse 的表达式 View 在某些类上会失败?