diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2022-01-27 04:46:27 +0330 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-01-28 22:51:27 +0000 |
commit | 6d64b13a1baa8713a28b095ab860699c55fe4e67 (patch) | |
tree | 5f8bc67d4a7286128fc27891480973fe8a771c8c /Userland/Utilities | |
parent | b27b22a68c095daaa2a7f32a4b6cac3659cbb10e (diff) | |
download | serenity-6d64b13a1baa8713a28b095ab860699c55fe4e67.zip |
LibDebug+Everywhere: Avoid void* -> FlatPtr -> void* dance
And limit the `void*` to the functions that interface the system (i.e.
ptrace wrappers).
This generally makes the code less riddled with casts.
Diffstat (limited to 'Userland/Utilities')
-rw-r--r-- | Userland/Utilities/functrace.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Utilities/functrace.cpp b/Userland/Utilities/functrace.cpp index 25e02a7ddc..f082b866ad 100644 --- a/Userland/Utilities/functrace.cpp +++ b/Userland/Utilities/functrace.cpp @@ -68,9 +68,9 @@ static void print_syscall(PtraceRegisters& regs, size_t depth) #endif } -static NonnullOwnPtr<HashMap<void*, X86::Instruction>> instrument_code() +static NonnullOwnPtr<HashMap<FlatPtr, X86::Instruction>> instrument_code() { - auto instrumented = make<HashMap<void*, X86::Instruction>>(); + auto instrumented = make<HashMap<FlatPtr, X86::Instruction>>(); g_debug_session->for_each_loaded_library([&](const Debug::LoadedLibrary& lib) { lib.debug_info->elf().for_each_section_of_type(SHT_PROGBITS, [&](const ELF::Image::Section& section) { if (section.name() != ".text") @@ -80,7 +80,7 @@ static NonnullOwnPtr<HashMap<void*, X86::Instruction>> instrument_code() X86::Disassembler disassembler(stream); for (;;) { auto offset = stream.offset(); - void* instruction_address = (void*)(section.address() + offset + lib.base_address); + auto instruction_address = section.address() + offset + lib.base_address; auto insn = disassembler.next(); if (!insn.has_value()) break; @@ -150,7 +150,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) new_function = false; return Debug::DebugSession::ContinueBreakAtSyscall; } - auto instruction = instrumented->get((void*)ip).value(); + auto instruction = instrumented->get(ip).value(); if (instruction.mnemonic() == "RET") { if (depth != 0) |