mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 17:42:43 +00:00 
			
		
		
		
	 08428aadad
			
		
	
	
		08428aadad
		
	
	
	
	
		
			
			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.
		
			
				
	
	
		
			32 lines
		
	
	
	
		
			754 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			32 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);
 | |
| 
 | |
| }
 |