Turnstone Operating System
Loading...
Searching...
No Matches
debug.h File Reference

debug functions More...

#include <types.h>

Classes

union  debug_register_dr6_t
 debug register dr6 More...
 
union  debug_register_dr7_t
 debug register dr7 More...
 

Macros

#define ___DEBUG_H   0
 
#define DEBUG_REGISTER_DR6_DEFAULT_VALUE   0xFFFF0FF0
 
#define DEBUG_REGISTER_DR7_DEFAULT_VALUE   0x00000400
 

Typedefs

typedef union debug_register_dr6_t debug_register_dr6_t
 debug register dr6
 
typedef union debug_register_dr7_t debug_register_dr7_t
 debug register dr7
 

Functions

int8_t debug_init (void)
 initializes debug
 
uint64_t debug_get_symbol_address (const char_t *function_name)
 gets function address by function name
 
void debug_put_single_time_breakpoint_at_address (uint64_t address)
 puts 0xcc (int3) instruction to address
 
void debug_remove_single_time_breakpoint_from_address (uint64_t address)
 removes 0xcc (int3) instruction from address
 
void debug_put_breakpoint_at_symbol (const char_t *function_name)
 puts 0xcc (int3) instruction to function
 
void debug_remove_breakpoint_from_symbol (const char_t *function_name)
 removes 0xcc (int3) instruction from function
 
uint8_t debug_get_original_byte (uint64_t address)
 gets original byte from address
 
void debug_revert_original_byte_at_address (uint64_t address)
 sets original byte to address
 
void debug_put_debug_for_address (uint64_t address)
 sets dr0 to address and enables dr0
 
void debug_remove_debug_for_address (uint64_t address)
 disables dr0
 
void debug_put_debug_for_symbol (const char_t *function_name)
 sets dr0 to function and enables dr0
 

Detailed Description

debug functions

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

Macro Definition Documentation

◆ ___DEBUG_H

#define ___DEBUG_H   0

Prevent multiple inclusion

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