diff options
author | Daniel Bertalan <dani@danielbertalan.dev> | 2021-07-28 17:30:20 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-08 10:55:36 +0200 |
commit | e9dd9d1f2c2ba9a117671bd93c046451a8e7bcb6 (patch) | |
tree | d6a0d6d4cd7e712e41899fd71e17a6915bfeaadf /Userland/DevTools/UserspaceEmulator | |
parent | c1d6637dc786be76721c31fb7712efb4735b8fce (diff) | |
download | serenity-e9dd9d1f2c2ba9a117671bd93c046451a8e7bcb6.zip |
UserspaceEmulator: Use `for_each_region_of_type` in `find_text_region`
Since we now have this helper template, we can make our code cleaner.
Diffstat (limited to 'Userland/DevTools/UserspaceEmulator')
-rw-r--r-- | Userland/DevTools/UserspaceEmulator/Emulator.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.cpp b/Userland/DevTools/UserspaceEmulator/Emulator.cpp index 76ba17fabe..85b0d84234 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator.cpp @@ -378,13 +378,10 @@ Vector<FlatPtr> Emulator::raw_backtrace() MmapRegion const* Emulator::find_text_region(FlatPtr address) { MmapRegion const* matching_region = nullptr; - mmu().for_each_region([&](auto& region) { - if (!is<MmapRegion>(region)) - return IterationDecision::Continue; - auto const& mmap_region = static_cast<MmapRegion const&>(region); - if (!(mmap_region.is_executable() && address >= mmap_region.base() && address < mmap_region.base() + mmap_region.size())) + mmu().for_each_region_of_type<MmapRegion>([&](auto& region) { + if (!(region.is_executable() && address >= region.base() && address < region.base() + region.size())) return IterationDecision::Continue; - matching_region = &mmap_region; + matching_region = ®ion; return IterationDecision::Break; }); return matching_region; |