Serenity Operating System
1/*
2 * Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#include "StackFrameUtils.h"
8
9namespace Debug::StackFrameUtils {
10
11Optional<StackFrameInfo> get_info(ProcessInspector const& inspector, FlatPtr current_ebp)
12{
13 auto return_address = inspector.peek(current_ebp + sizeof(FlatPtr));
14 auto next_ebp = inspector.peek(current_ebp);
15 if (!return_address.has_value() || !next_ebp.has_value())
16 return {};
17
18 StackFrameInfo info = { return_address.value(), next_ebp.value() };
19 return info;
20}
21
22}