手动生成精灵核心转储 [英] Manually generate elf core dump

查看:133
本文介绍了手动生成精灵核心转储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找手动生成一个ELF核心转储文件。

我的程序有一个RAM转储,也可以检索寄存器信息等等。 / p>

有了这些数据,我想要构建一个ELF核心转储文件,类似于当程序崩溃时由Linux内核生成的转储文件,目标是分析此核心转储我一直在寻找核心转储规格或详细格式,但没有找到我想要的:


$ b


  • 我的核心转储文件需要哪些部分?

  • 它们如何组织到ELF容器中?


  • $ b 如何从二进制RAM转储(+寄存器值)转到像文件这样的核心转储。这最好用C语言完成,我以为我可以使用 libelf 库来帮助我构建文件,但是我没有找到关于该文件内容的相关信息,以及h格式,因此欢迎提供任何线索,链接或建议。



    注意:这不是关于引发异常并让内核为我完成工作,我可以做但我真的需要把自己的内存集中起来,并手动将数据注册到一个精灵核心转储中。



    谢谢!



    $ b我想要手动生成一个ELF核心转储文件。 $ b

    只要使用Google elf userspace coredumper ,它确实无误


    我想构建我的核心转储,而不是直接将其实施到我的软件中。 b

    没有现有的程序(我知道)可以做到这一点。机会是,你必须从头开始编写一个程序,或者修改其他程序。

    有两个程序可以从用户空间写入核心转储 - 上述用户空间coredumper和GDB(通过 gcore 命令)。我希望调整Google coredumper将比调整GDB容易得多。



    如果您决定从头开始编写一个,您仍然可以阅读Google coredumper源代码,以弄清楚这是你必须写入核心。


    I am looking for manually generating an ELF Core Dump file.

    I have a RAM dump from my program, and can also retrieve register informations and so on.

    With this data, I would like to build an ELF core dump file, similar as those generated by Linux kernel when a program crashes, the goal would be to analyse this core dump with a GDB specifically made for my platform.

    I have been looking for core dumps specifications or detailed format, but did not find what I wanted :

    • What sections does my core dump file does require ?
    • How are they organized into the ELF container ?
    • How do I go from having a binary RAM dump (+ registers values) to a core dump like file.

    This must preferably be done in C, I thought I could use the libelf library to help me build the file, but I did not found relevant information about what to put in that file, and in which format, so any clue, link or advice is welcomed.

    Note : This is not about raising exceptions and have the job done by the kernel for me, I can do that, but I really need to gather myself the RAM and register data manually into an elf core dump.

    Thanks !

    解决方案

    I am looking for manually generating an ELF Core Dump file.

    Just use Google elf userspace coredumper, it does exactly that.

    I want to build my core dump, not implement it directly into my software

    There is no existing program (that I know of) that can do that. Chances are, you'll have to write one from scratch, or adapt some other program.

    There are two programs that can write a core dump from userspace -- the above userspace coredumper, and GDB (via gcore command). I expect that adapting Google coredumper would be much easier than adapting GDB.

    Should you decide to write one from scratch, you can still read the Google coredumper source to figure out what it is you must write to the core.

    这篇关于手动生成精灵核心转储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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