mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:27:45 +00:00
Debugger: Add DebugSession
The DebugSession class wraps the usage of Ptrace. It is intended to be used by cli & gui debugger programs. Also, call objdump for disassemly
This commit is contained in:
parent
50fd2cabff
commit
3e9a7175d1
10 changed files with 473 additions and 166 deletions
|
@ -4935,6 +4935,7 @@ bool Process::has_tracee_thread(int tracer_pid) const
|
|||
KResultOr<u32> Process::peek_user_data(u32* address)
|
||||
{
|
||||
if (!MM.validate_user_read(*this, VirtualAddress(address), sizeof(u32))) {
|
||||
dbg() << "Invalid address for peek_user_data: " << address;
|
||||
return KResult(-EFAULT);
|
||||
}
|
||||
uint32_t result;
|
||||
|
@ -4951,8 +4952,9 @@ KResultOr<u32> Process::peek_user_data(u32* address)
|
|||
KResult Process::poke_user_data(u32* address, u32 data)
|
||||
{
|
||||
// We validate for read (rather than write) because PT_POKE can write to readonly pages.
|
||||
// So we wffectively only care that the poke operation only writes to user pages
|
||||
// So we effectively only care that the poke operation is trying to write to user pages.
|
||||
if (!MM.validate_user_read(*this, VirtualAddress(address), sizeof(u32))) {
|
||||
dbg() << "Invalid address for poke_user_data: " << address;
|
||||
return KResult(-EFAULT);
|
||||
}
|
||||
ProcessPagingScope scope(*this);
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <Kernel/Thread.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
#include <Kernel/VM/RangeAllocator.h>
|
||||
#include <LibBareMetal/StdLib.h>
|
||||
#include <LibC/signal_numbers.h>
|
||||
|
||||
namespace ELF {
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
void set_trace_syscalls(bool val) { m_trace_syscalls = val; }
|
||||
|
||||
void set_regs(const RegisterState& regs);
|
||||
void set_regs(const PtraceRegisters& regs) { m_regs = regs; }
|
||||
bool has_regs() const { return m_regs.has_value(); }
|
||||
const PtraceRegisters& regs() const
|
||||
{
|
||||
|
|
|
@ -146,7 +146,6 @@ cp ../Applications/Browser/Browser mnt/bin/Browser
|
|||
cp ../Applications/Debugger/Debugger mnt/bin/sdb
|
||||
cp ../Games/Solitaire/Solitaire mnt/bin/Solitaire
|
||||
cp ../Demos/HelloWorld/HelloWorld mnt/bin/HelloWorld
|
||||
cp ../Demos/Debugee/Debugee mnt/bin/Debugee
|
||||
cp ../Demos/WidgetGallery/WidgetGallery mnt/bin/WidgetGallery
|
||||
cp ../Demos/Fire/Fire mnt/bin/Fire
|
||||
cp ../Demos/DynamicLink/LinkDemo/LinkDemo mnt/bin/LinkDemo
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue