mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-30 18:12:45 +00:00 
			
		
		
		
	 6d64b13a1b
			
		
	
	
		6d64b13a1b
		
	
	
	
	
		
			
			And limit the `void*` to the functions that interface the system (i.e. ptrace wrappers). This generally makes the code less riddled with casts.
		
			
				
	
	
		
			22 lines
		
	
	
	
		
			564 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
	
		
			564 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include "StackFrameUtils.h"
 | |
| 
 | |
| namespace Debug::StackFrameUtils {
 | |
| 
 | |
| Optional<StackFrameInfo> get_info(ProcessInspector const& inspector, FlatPtr current_ebp)
 | |
| {
 | |
|     auto return_address = inspector.peek(current_ebp + sizeof(FlatPtr));
 | |
|     auto next_ebp = inspector.peek(current_ebp);
 | |
|     if (!return_address.has_value() || !next_ebp.has_value())
 | |
|         return {};
 | |
| 
 | |
|     StackFrameInfo info = { return_address.value(), next_ebp.value() };
 | |
|     return info;
 | |
| }
 | |
| 
 | |
| }
 |