ladybird/Userland/Libraries/LibSymbolication/Symbolication.h
Rodrigo Tobar 08428aadad LibSymbolication: Skip source position calculation if requested
Calculating source code positions can be expensive, and some
applications (like SystemMonitor's Stack tab) don't even show this
information, making these calculations wasteful.

This commit adds a new enumerated flag to the `symbolicate` functions
for callers to specify whether source positions should be included in
the results; it defaults to "Yes" to preserve old behavior for existing
applications.
2021-10-17 22:07:10 -07:00

33 lines
754 B
C++

/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/String.h>
#include <LibDebug/DebugInfo.h>
namespace Symbolication {
struct Symbol {
FlatPtr address { 0 };
String name {};
String object {};
u32 offset { 0 };
Vector<Debug::DebugInfo::SourcePosition> source_positions;
bool operator==(Symbol const&) const = default;
};
enum class IncludeSourcePosition {
Yes,
No
};
Optional<FlatPtr> kernel_base();
Vector<Symbol> symbolicate_thread(pid_t pid, pid_t tid, IncludeSourcePosition = IncludeSourcePosition::Yes);
Optional<Symbol> symbolicate(String const& path, FlatPtr address, IncludeSourcePosition = IncludeSourcePosition::Yes);
}