6

It's clear that GDB can generate a core dump of process for example via its wrapper - gcore, however it's not clear what exactly it includes and it's really hard to find an answear because different sources say totally different things.

Because of that I've got following questions:

  1. Does it contain a whole virtual memory of process? If not, what part of it? All writable regions or stack only or just (as its name suggests) some essential part or what?

  2. Is it possible to generate a core file with complete memory of process via GDB? If so, how?

  3. What would be the difference between a "dump" generated by saving and concatenating memory from all regions according to process' memory map and automatically generated file with gcore command?

  4. A process wrote some data somewhere into RAM. Can I be sure that the data will be (always) accessed and saved in a core file generated with gcore command? If not, why? What does it depend on?

  • core means memory. The term comes from those half-forgotten times when RAM was made using one small magnetic core for each bit. See magnetic-core memory on Wikipedia. – AlexP Jan 26 '17 at 14:02
  • The questioner uses the word "memory" five times, and "RAM" once. Xe is probably muttering that xe already knew that much. (-: – JdeBP Jan 26 '17 at 20:00
  • @JdeBP He knows it's related to memory, but when he wrote "as its name suggests", it seems like he was understanding the word's normal meaning as an adjective, which means "central" or "primary". – Barmar Jan 26 '17 at 23:30
6

The core file contains all the parts of the process's virtual memory that are specific to that process, which is generally the data and stack segments. It doesn't include the text segment, which contains the executable code -- when you want to debug a core file, you have to tell the debugger what program was being run.

You can find a detailed explanation of the contents at Anatomy of an ELF core file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.