diff --git a/Userland/Applications/Debugger/main.cpp b/Userland/Applications/Debugger/main.cpp index c03f7da5f1..31186ccf74 100644 --- a/Userland/Applications/Debugger/main.cpp +++ b/Userland/Applications/Debugger/main.cpp @@ -243,7 +243,7 @@ int main(int argc, char** argv) VERIFY(optional_regs.has_value()); const PtraceRegisters& regs = optional_regs.value(); -#if ARCH(I686) +#if ARCH(I386) const FlatPtr ip = regs.eip; #else const FlatPtr ip = regs.rip; diff --git a/Userland/Utilities/functrace.cpp b/Userland/Utilities/functrace.cpp index daca7c00b9..f94a7e2018 100644 --- a/Userland/Utilities/functrace.cpp +++ b/Userland/Utilities/functrace.cpp @@ -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> 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) diff --git a/Userland/Utilities/test_io.cpp b/Userland/Utilities/test_io.cpp index 6c09d09400..703a7e18fb 100644 --- a/Userland/Utilities/test_io.cpp +++ b/Userland/Utilities/test_io.cpp @@ -15,20 +15,20 @@ #include #include -#define EXPECT_ERROR_2(err, syscall, arg1, arg2) \ - do { \ - rc = syscall(arg1, arg2); \ - if (rc >= 0 || errno != err) { \ - warnln(__FILE__ ":{}: Expected " #err ": " #syscall "({:p}, {:p}), got rc={}, errno={}", __LINE__, (const void*)(arg1), (const void*)arg2, rc, errno); \ - } \ +#define EXPECT_ERROR_2(err, syscall, arg1, arg2) \ + do { \ + rc = syscall(arg1, arg2); \ + if (rc >= 0 || errno != err) { \ + warnln(__FILE__ ":{}: Expected " #err ": " #syscall "({}, {}), got rc={}, errno={}", __LINE__, arg1, arg2, rc, errno); \ + } \ } while (0) -#define EXPECT_ERROR_3(err, syscall, arg1, arg2, arg3) \ - do { \ - rc = syscall(arg1, arg2, arg3); \ - if (rc >= 0 || errno != err) { \ - warnln(__FILE__ ":{}: Expected " #err ": " #syscall "({:p}, {:p}, {:p}), got rc={}, errno={}", __LINE__, (const void*)(arg1), (const void*)(arg2), (const void*)(arg3), rc, errno); \ - } \ +#define EXPECT_ERROR_3(err, syscall, arg1, arg2, arg3) \ + do { \ + rc = syscall(arg1, arg2, arg3); \ + if (rc >= 0 || errno != err) { \ + warnln(__FILE__ ":{}: Expected " #err ": " #syscall "({}, {}, {}), got rc={}, errno={}", __LINE__, arg1, arg2, arg3, rc, errno); \ + } \ } while (0) static void test_read_from_directory()