mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:48:12 +00:00
LibDebug: Assert that we can read the executable of the debugee
This commit is contained in:
parent
3b422564f3
commit
b5f6a1a9e8
2 changed files with 13 additions and 4 deletions
|
@ -30,12 +30,19 @@
|
|||
|
||||
DebugSession::DebugSession(int pid)
|
||||
: m_debugee_pid(pid)
|
||||
, m_executable(String::format("/proc/%d/exe", pid))
|
||||
, m_elf(ELF::Loader::create(reinterpret_cast<u8*>(m_executable.data()), m_executable.size()))
|
||||
, m_executable(initialize_executable_mapped_file(pid))
|
||||
, m_elf(ELF::Loader::create(reinterpret_cast<const u8*>(m_executable->data()), m_executable->size()))
|
||||
, m_debug_info(m_elf)
|
||||
{
|
||||
}
|
||||
|
||||
NonnullOwnPtr<const MappedFile> DebugSession::initialize_executable_mapped_file(int pid)
|
||||
{
|
||||
auto executable = adopt_own(*new MappedFile(String::format("/proc/%d/exe", pid)));
|
||||
ASSERT(executable->is_valid());
|
||||
return executable;
|
||||
}
|
||||
|
||||
DebugSession::~DebugSession()
|
||||
{
|
||||
for (const auto& bp : m_breakpoints) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue