/* * Copyright (c) 2020, Itamar S. * * SPDX-License-Identifier: BSD-2-Clause */ #include "StackFrameUtils.h" namespace Debug::StackFrameUtils { Optional get_info(ProcessInspector const& inspector, FlatPtr current_ebp) { auto return_address = inspector.peek(reinterpret_cast(current_ebp + sizeof(FlatPtr))); auto next_ebp = inspector.peek(reinterpret_cast(current_ebp)); if (!return_address.has_value() || !next_ebp.has_value()) return {}; StackFrameInfo info = { return_address.value(), next_ebp.value() }; return info; } }