mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:07:36 +00:00
Utilities: Fix Build on x86_64
This commit is contained in:
parent
8e575d2f62
commit
2c2cf90661
3 changed files with 31 additions and 15 deletions
|
@ -51,6 +51,7 @@ static void print_syscall(PtraceRegisters& regs, size_t depth)
|
|||
}
|
||||
const char* begin_color = g_should_output_color ? "\033[34;1m" : "";
|
||||
const char* end_color = g_should_output_color ? "\033[0m" : "";
|
||||
#if ARCH(I386)
|
||||
outln("=> {}SC_{}(0x{:x}, 0x{:x}, 0x{:x}){}",
|
||||
begin_color,
|
||||
Syscall::to_string((Syscall::Function)regs.eax),
|
||||
|
@ -58,6 +59,15 @@ static void print_syscall(PtraceRegisters& regs, size_t depth)
|
|||
regs.ecx,
|
||||
regs.ebx,
|
||||
end_color);
|
||||
#else
|
||||
outln("=> {}SC_{}(0x{:x}, 0x{:x}, 0x{:x}){}",
|
||||
begin_color,
|
||||
Syscall::to_string((Syscall::Function)regs.rax),
|
||||
regs.rdx,
|
||||
regs.rcx,
|
||||
regs.rbx,
|
||||
end_color);
|
||||
#endif
|
||||
}
|
||||
|
||||
static NonnullOwnPtr<HashMap<void*, X86::Instruction>> instrument_code()
|
||||
|
@ -133,13 +143,19 @@ int main(int argc, char** argv)
|
|||
return Debug::DebugSession::DebugDecision::ContinueBreakAtSyscall;
|
||||
}
|
||||
|
||||
#if ARCH(I386)
|
||||
const FlatPtr ip = regs.value().eip;
|
||||
#else
|
||||
const FlatPtr ip = regs.value().rip;
|
||||
#endif
|
||||
|
||||
if (new_function) {
|
||||
auto function_name = g_debug_session->symbolicate(regs.value().eip);
|
||||
auto function_name = g_debug_session->symbolicate(ip);
|
||||
print_function_call(function_name.value().symbol, depth);
|
||||
new_function = false;
|
||||
return Debug::DebugSession::ContinueBreakAtSyscall;
|
||||
}
|
||||
auto instruction = instrumented->get((void*)regs.value().eip).value();
|
||||
auto instruction = instrumented->get((void*)ip).value();
|
||||
|
||||
if (instruction.mnemonic() == "RET") {
|
||||
if (depth != 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue