1

is it possible to write core files manually? lets assume I have a binary memory dump of stack, heap, code and all the processor registers.

is it possible to create a core file that would look to GDB as if a real process has crashed and generated this core file?

The main usage for this is that I am running a VM on assembley code. Lets assume the architecture is PPC. when I encounter a problem I want to be able to write a core file that is readable by GDB on Linux to help debug the problem.

I am not sure what is the diffrence between ELF format core file and other formats. but what I am trying to find out is if its possible to write a module that gets data segment, code segment, stack segment and registers and produces a readable core file for GDB and if so, how complicated it that.

Thanks, Itay

Itay Marom
  • 801
  • 6
  • 15
  • Short answer: sure you could. As a file is nothing more then 1 and 0 you can for sure generate anything by your self, as the informations will just get interpreted. You just would have to know what the data in such a file has to represent, to fake it. – dhein Nov 29 '13 at 12:21
  • But the question is if this information is enough? prehaps more is needed which is not acessible outside of those tools ? and what about the format type? is it well defined and known? – Itay Marom Nov 29 '13 at 12:33
  • I am so curoius, what the hell you need to do with that :-) – peterh Nov 29 '13 at 13:27
  • It might be more accurate to say that it's *not impossible*. – ams Nov 29 '13 at 15:16
  • have a look at the source code of gcore – steve Nov 29 '13 at 21:35

1 Answers1

0

is it possible to create a core file that would look to GDB as if a real process has crashed and generated this core file?

It sure is. The format of the core is somewhat compilcated, and is system dependent (and you didn't say which system you want the solution for).

This answer gives possible ELF solutions.

If you are on non-ELF system, you'll have to tell us which one.

Community
  • 1
  • 1
Employed Russian
  • 199,314
  • 34
  • 295
  • 362