From: Nikolay Martyanov <nmartyanov@ptsecurity.com>
To: <gdb@sourceware.org>
Subject: Custom core file
Date: Wed, 28 Sep 2016 13:31:00 -0000 [thread overview]
Message-ID: <fb396495-657e-1429-d773-f302171ae3b7@ptsecurity.com> (raw)
Hello guys!
I have a self-written bare-metal hypervisor for x86 arch and I'd like to
perform postmortem debugging of it's core (not VM, hypervisor itself!).
So the idea is to save physical memory state and later use GDB to
interpret it.
As I understand, GDB can interpret only `core files`. But I didn't found
a lot of info about this file format.
Some sources say it should be a specific ELF file with several mandatory
".note" sections.
Others say `core file` can be in any format and adaptation should be
done on BFD-level of GDB.
I looked through the code in corelow.c. Now my undestanding is somthing
like:
1. Save data section of my hypervisor
2. Save current stack state of my hypervisor
3. Save current registers state (MSR?)
4. Define "sys/user.h"-like header with layout description of above
mentioned structures
5. Using this header, implement function analog to
`trad_unix_core_file_p()` in file analog to `trad-core.c` (It translates
my `struct user` to `struct trad_core_struct`)
6. Implement functions like `supply_*regset()` in file like
`i386-myhyper-nat.c`
7. ??? (magic I didn't realized yet)
8. Profit!
Note, steps 1-3 say nothing about ELF-format. It embarrasses me...
So my question is: am I looking in a right direction? Can you point me
in to the issues in the plan (or even my understanding)?
Or may be there are any other ways to feed a raw physical memory to GDB?
Thanks,
Nikolay
next reply other threads:[~2016-09-28 13:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-28 13:31 Nikolay Martyanov [this message]
2016-09-28 14:28 ` Duane Ellis
2016-09-28 14:58 ` Jan Kratochvil
2016-09-28 15:18 ` Nikolay Martyanov
2016-09-28 15:33 ` Jan Kratochvil
2016-09-28 16:27 ` Nikolay Martyanov
2016-09-28 15:02 ` Nikolay Martyanov
2016-09-28 15:31 duane
2016-09-28 16:37 ` Nikolay Martyanov
2016-09-28 19:22 ` Nikolay Martyanov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fb396495-657e-1429-d773-f302171ae3b7@ptsecurity.com \
--to=nmartyanov@ptsecurity.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox