Turnstone Operating System
Loading...
Searching...
No Matches
debug.64.c File Reference

debug implementation More...

#include <debug.h>
#include <hashmap.h>
#include <memory.h>
#include <logging.h>
#include <systeminfo.h>
#include <linker.h>
#include <memory/paging.h>

Classes

struct  debug_breakpoint_t
 

Typedefs

typedef enum debug_breakpoint_type_t debug_breakpoint_type_t
 
typedef struct debug_breakpoint_t debug_breakpoint_t
 

Enumerations

enum  debug_breakpoint_type_t { DEBUG_BREAKPOINT_TYPE_SINGLE_TIME }
 

Functions

 MODULE ("turnstone.lib")
 
static const char_tdebug_get_symbol_name_by_symbol_name_offset (uint64_t symbol_name_offset)
 
int8_t debug_init (void)
 initializes debug More...
 
uint64_t debug_get_symbol_address (const char_t *symbol_name)
 gets function address by function name More...
 
void debug_put_single_time_breakpoint_at_address (uint64_t address)
 puts 0xcc (int3) instruction to address More...
 
void debug_remove_single_time_breakpoint_from_address (uint64_t address)
 removes 0xcc (int3) instruction from address More...
 
void debug_put_breakpoint_at_symbol (const char_t *symbol_name)
 puts 0xcc (int3) instruction to function More...
 
void debug_remove_breakpoint_from_symbol (const char_t *symbol_name)
 removes 0xcc (int3) instruction from function More...
 
uint8_t debug_get_original_byte (uint64_t address)
 gets original byte from address More...
 
void debug_revert_original_byte_at_address (uint64_t address)
 sets original byte to address More...
 
void debug_put_debug_for_address (uint64_t address)
 sets dr0 to address and enables dr0 More...
 
void debug_put_debug_for_symbol (const char_t *symbol_name)
 sets dr0 to function and enables dr0 More...
 
void debug_remove_debug_for_address (uint64_t address)
 disables dr0 More...
 

Variables

hashmap_tdebug_location_map = NULL
 
hashmap_tdebug_symbol_map = NULL
 

Detailed Description

debug implementation

This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.

Function Documentation

◆ debug_get_original_byte()

uint8_t debug_get_original_byte ( uint64_t  address)

gets original byte from address

Parameters
addressaddress to get original byte

◆ debug_get_symbol_address()

uint64_t debug_get_symbol_address ( const char_t function_name)

gets function address by function name

Parameters
function_namefunction name
Returns
function address

◆ debug_init()

int8_t debug_init ( void  )

initializes debug

Returns
0 if success, -1 if error

◆ debug_put_breakpoint_at_symbol()

void debug_put_breakpoint_at_symbol ( const char_t function_name)

puts 0xcc (int3) instruction to function

Parameters
function_namefunction name to put breakpoint

◆ debug_put_debug_for_address()

void debug_put_debug_for_address ( uint64_t  address)

sets dr0 to address and enables dr0

Parameters
addressaddress to set dr0

◆ debug_put_debug_for_symbol()

void debug_put_debug_for_symbol ( const char_t function_name)

sets dr0 to function and enables dr0

Parameters
function_namefunction name to set dr0

◆ debug_put_single_time_breakpoint_at_address()

void debug_put_single_time_breakpoint_at_address ( uint64_t  address)

puts 0xcc (int3) instruction to address

Parameters
addressaddress to put breakpoint

◆ debug_remove_breakpoint_from_symbol()

void debug_remove_breakpoint_from_symbol ( const char_t function_name)

removes 0xcc (int3) instruction from function

Parameters
function_namefunction name to remove breakpoint

◆ debug_remove_debug_for_address()

void debug_remove_debug_for_address ( uint64_t  address)

disables dr0

Parameters
addressaddress to disable dr0

◆ debug_remove_single_time_breakpoint_from_address()

void debug_remove_single_time_breakpoint_from_address ( uint64_t  address)

removes 0xcc (int3) instruction from address

Parameters
addressaddress to remove breakpoint

◆ debug_revert_original_byte_at_address()

void debug_revert_original_byte_at_address ( uint64_t  address)

sets original byte to address

Parameters
addressaddress to set original byte