diff options
author | Andreas Kling <kling@serenityos.org> | 2021-03-09 14:44:54 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-09 14:44:54 +0100 |
commit | 54bd2ee73805a3a6dd3991fa24043a9187138908 (patch) | |
tree | 00104435e6519de80f15157c1e35dec0b6d33c1b /Userland/DevTools/UserspaceEmulator | |
parent | 397f564144f0f954c86c8bcfdef89d2d7cc9d1f8 (diff) | |
download | serenity-54bd2ee73805a3a6dd3991fa24043a9187138908.zip |
UserspaceEmulator: Add Emulator::dump_regions() helper function
Diffstat (limited to 'Userland/DevTools/UserspaceEmulator')
-rw-r--r-- | Userland/DevTools/UserspaceEmulator/Emulator.cpp | 17 | ||||
-rw-r--r-- | Userland/DevTools/UserspaceEmulator/Emulator.h | 2 |
2 files changed, 19 insertions, 0 deletions
diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.cpp b/Userland/DevTools/UserspaceEmulator/Emulator.cpp index 439eb4f130..0afe309bc6 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator.cpp @@ -1846,4 +1846,21 @@ int Emulator::virt$msyscall(FlatPtr) return 0; } +void Emulator::dump_regions() const +{ + const_cast<SoftMMU&>(m_mmu).for_each_region([&](const Region& region) { + reportln("{:p}-{:p} {:c}{:c}{:c} {} {}{}{} ", + region.base(), + region.end() - 1, + region.is_readable() ? 'R' : '-', + region.is_writable() ? 'W' : '-', + region.is_executable() ? 'X' : '-', + is<MmapRegion>(region) ? static_cast<const MmapRegion&>(region).name() : "", + is<MmapRegion>(region) ? "(mmap) " : "", + region.is_stack() ? "(stack) " : "", + region.is_text() ? "(text) " : ""); + return IterationDecision::Continue; + }); +} + } diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.h b/Userland/DevTools/UserspaceEmulator/Emulator.h index 1faafa9052..d4fc71d5ea 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator.h +++ b/Userland/DevTools/UserspaceEmulator/Emulator.h @@ -68,6 +68,8 @@ public: void did_receive_signal(int signum) { m_pending_signals |= (1 << signum); } + void dump_regions() const; + private: const String m_executable_path; const Vector<String> m_arguments; |