mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 07:36:50 +00:00
ptrace: Add PT_SETREGS
PT_SETTREGS sets the regsiters of the traced thread. It can only be used when the tracee is stopped. Also, refactor ptrace. The implementation was getting long and cluttered the alraedy large Process.cpp file. This commit moves the bulk of the implementation to Kernel/Ptrace.cpp, and factors out peek & poke to separate methods of the Process class.
This commit is contained in:
@@ -26,6 +26,8 @@
|
||||
|
||||
#include <AK/Memory.h>
|
||||
#include <AK/kmalloc.h>
|
||||
#include <Kernel/Arch/i386/CPU.h>
|
||||
#include <Kernel/Ptrace.h>
|
||||
#include <Kernel/ThreadTracer.h>
|
||||
|
||||
namespace Kernel {
|
||||
@@ -37,24 +39,9 @@ ThreadTracer::ThreadTracer(pid_t tracer_pid)
|
||||
|
||||
void ThreadTracer::set_regs(const RegisterState& regs)
|
||||
{
|
||||
PtraceRegisters r = {
|
||||
regs.eax,
|
||||
regs.ecx,
|
||||
regs.edx,
|
||||
regs.ebx,
|
||||
regs.esp,
|
||||
regs.ebp,
|
||||
regs.esi,
|
||||
regs.edi,
|
||||
regs.eip,
|
||||
regs.eflags,
|
||||
regs.cs,
|
||||
regs.ss,
|
||||
regs.ds,
|
||||
regs.es,
|
||||
regs.fs,
|
||||
regs.gs,
|
||||
};
|
||||
PtraceRegisters r;
|
||||
Ptrace::copy_kernel_registers_into_ptrace_registers(r, regs);
|
||||
m_regs = r;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user