1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 16:47:45 +00:00

LibDebug: Clean up DebugSession construction a little bit

No need to wrap MappedFile in a NonnullOwnPtr. Also make the session
constructor private and use adopt_own().
This commit is contained in:
Andreas Kling 2020-12-11 19:11:25 +01:00
parent 03fcd02dfd
commit aec54af04f
2 changed files with 13 additions and 13 deletions

View file

@ -48,8 +48,6 @@ class DebugSession {
public:
static OwnPtr<DebugSession> exec_and_attach(const String& command);
// Has to be public for OwnPtr::make
DebugSession(int pid);
~DebugSession();
int pid() const { return m_debuggee_pid; }
@ -103,7 +101,7 @@ public:
const ELF::Loader& elf() const { return *m_elf; }
NonnullRefPtr<const ELF::Loader> elf_ref() const { return m_elf; }
const MappedFile& executable() const { return *m_executable; }
const MappedFile& executable() const { return m_executable; }
const DebugInfo& debug_info() const { return m_debug_info; }
enum DebugDecision {
@ -121,15 +119,17 @@ public:
};
private:
explicit DebugSession(pid_t);
// x86 breakpoint instruction "int3"
static constexpr u8 BREAKPOINT_INSTRUCTION = 0xcc;
static NonnullOwnPtr<const MappedFile> initialize_executable_mapped_file(int pid);
static MappedFile map_executable_for_process(pid_t);
int m_debuggee_pid { -1 };
bool m_is_debuggee_dead { false };
NonnullOwnPtr<const MappedFile> m_executable;
MappedFile m_executable;
NonnullRefPtr<const ELF::Loader> m_elf;
DebugInfo m_debug_info;