RetroArch
Classes | Macros | Functions | Variables
debug.c File Reference
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <signal.h>
#include "asm.h"
#include "processor.h"
#include "spinlock.h"
#include "lwp.h"
#include "lwp_threads.h"
#include "sys_state.h"
#include "context.h"
#include "cache.h"
#include "video.h"
#include "ogcsys.h"
#include "lwp_config.h"
#include "tcpip.h"
#include "geckousb.h"
#include "debug_if.h"
#include "debug_supp.h"
Include dependency graph for debug.c:

Classes

struct  hard_trap_info
 
struct  bp_entry
 

Macros

#define GEKKO_MAX_BP   256
 
#define SP_REGNUM   1
 
#define PC_REGNUM   64
 
#define BUFMAX   2048
 
#define BPCODE   0x7d821008
 
#define highhex(x)   hexchars [((x)>>4)&0xf]
 
#define lowhex(x)   hexchars [(x)&0xf]
 
#define UIP_LOG(m)
 

Functions

void __breakinst ()
 
void c_debug_handler (frame_context *ctx)
 
void dbg_exceptionhandler ()
 
void __exception_sethandler (u32 nExcept, void(*pHndl)(frame_context *))
 
void __clr_iabr ()
 
void __enable_iabr ()
 
void __disable_iabr ()
 
void __set_iabr (void *)
 
static __inline__ void bp_init ()
 
static s32 hex (char ch)
 
static s32 hexToInt (char **ptr, s32 *ival)
 
static s32 computeSignal (s32 excpt)
 
static u32 insert_bp (void *mem)
 
static u32 remove_bp (void *mem)
 
static char getdbgchar ()
 
static void putdbgchar (char ch)
 
static void putdbgstr (const char *str)
 
static void putpacket (const char *buffer)
 
static void getpacket (char *buffer)
 
static void process_query (const char *inp, char *outp, s32 thread)
 
static s32 gdbstub_setthreadregs (s32 thread, frame_context *frame)
 
static s32 gdbstub_getthreadregs (s32 thread, frame_context *frame)
 
static void gdbstub_report_exception (frame_context *frame, s32 thread)
 
void _break (void)
 Stub function to insert the hardware break instruction. This function is used to enter the debug stub and to connect with the host. The developer is free to insert this function at any position in project's source code. More...
 
void DEBUG_Init (s32 device_type, s32 channel_port)
 Performs the initialization of the debug stub. More...
 

Variables

static s32 dbg_active = 0
 
static s32 dbg_instep = 0
 
static s32 dbg_initialized = 0
 
static struct dbginterfacecurrent_device = NULL
 
static char remcomInBuffer [BUFMAX]
 
static char remcomOutBuffer [BUFMAX]
 
const char hexchars [] ="0123456789abcdef"
 
static struct hard_trap_info hard_trap_info []
 
static struct bp_entry bp_entries [GEKKO_MAX_BP]
 
static struct bp_entryp_bpentries = NULL
 
static frame_context current_thread_registers
 
const char * tcp_localip
 
const char * tcp_netmask
 
const char * tcp_gateway
 
u8 __text_start []
 
u8 __data_start []
 
u8 __bss_start []
 
u8 __text_fstart []
 
u8 __data_fstart []
 
u8 __bss_fstart []
 

Macro Definition Documentation

◆ BPCODE

#define BPCODE   0x7d821008

◆ BUFMAX

#define BUFMAX   2048

◆ GEKKO_MAX_BP

#define GEKKO_MAX_BP   256

◆ highhex

#define highhex (   x)    hexchars [((x)>>4)&0xf]

◆ lowhex

#define lowhex (   x)    hexchars [(x)&0xf]

◆ PC_REGNUM

#define PC_REGNUM   64

◆ SP_REGNUM

#define SP_REGNUM   1

◆ UIP_LOG

#define UIP_LOG (   m)

Function Documentation

◆ __breakinst()

void __breakinst ( )
Here is the caller graph for this function:

◆ __clr_iabr()

void __clr_iabr ( )

◆ __disable_iabr()

void __disable_iabr ( )

◆ __enable_iabr()

void __enable_iabr ( )

◆ __exception_sethandler()

void __exception_sethandler ( u32  nExcept,
void(*)(frame_context *)  pHndl 
)
Here is the caller graph for this function:

◆ __set_iabr()

void __set_iabr ( void )

◆ _break()

void _break ( void  )

Stub function to insert the hardware break instruction. This function is used to enter the debug stub and to connect with the host. The developer is free to insert this function at any position in project's source code.

Returns
none.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bp_init()

static __inline__ void bp_init ( )
static
Here is the caller graph for this function:

◆ c_debug_handler()

void c_debug_handler ( frame_context ctx)
Here is the call graph for this function:

◆ computeSignal()

static s32 computeSignal ( s32  excpt)
static
Here is the caller graph for this function:

◆ dbg_exceptionhandler()

void dbg_exceptionhandler ( )
Here is the caller graph for this function:

◆ DEBUG_Init()

void DEBUG_Init ( s32  device_type,
s32  channel_port 
)

Performs the initialization of the debug stub.

Parameters
[in]device_typetype of device to use. can be either USB or TCP.
[in]channel_portdepending on the used device this can be either the EXI channel or the TCP port.
Returns
none.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gdbstub_getthreadregs()

static s32 gdbstub_getthreadregs ( s32  thread,
frame_context frame 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gdbstub_report_exception()

static void gdbstub_report_exception ( frame_context frame,
s32  thread 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gdbstub_setthreadregs()

static s32 gdbstub_setthreadregs ( s32  thread,
frame_context frame 
)
static
Here is the caller graph for this function:

◆ getdbgchar()

static char getdbgchar ( )
static
Here is the caller graph for this function:

◆ getpacket()

static void getpacket ( char *  buffer)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hex()

static s32 hex ( char  ch)
static
Here is the caller graph for this function:

◆ hexToInt()

static s32 hexToInt ( char **  ptr,
s32 ival 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ insert_bp()

static u32 insert_bp ( void mem)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_query()

static void process_query ( const char *  inp,
char *  outp,
s32  thread 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ putdbgchar()

static void putdbgchar ( char  ch)
static
Here is the caller graph for this function:

◆ putdbgstr()

static void putdbgstr ( const char *  str)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ putpacket()

static void putpacket ( const char *  buffer)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove_bp()

static u32 remove_bp ( void mem)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ __bss_fstart

u8 __bss_fstart[]

◆ __bss_start

u8 __bss_start[]

◆ __data_fstart

u8 __data_fstart[]

◆ __data_start

u8 __data_start[]

◆ __text_fstart

u8 __text_fstart[]

◆ __text_start

u8 __text_start[]

◆ bp_entries

struct bp_entry bp_entries[GEKKO_MAX_BP]
static

◆ current_device

struct dbginterface* current_device = NULL
static

◆ current_thread_registers

frame_context current_thread_registers
static

◆ dbg_active

s32 dbg_active = 0
static

◆ dbg_initialized

s32 dbg_initialized = 0
static

◆ dbg_instep

s32 dbg_instep = 0
static

◆ hard_trap_info

struct hard_trap_info hard_trap_info[]
static
Initial value:
= {
{EX_MACH_CHECK,SIGSEGV},
{EX_DSI,SIGSEGV},
{EX_ISI,SIGBUS},
{EX_INT,SIGINT},
{EX_ALIGN,SIGBUS},
{EX_PRG,SIGTRAP},
{EX_FP,SIGFPE},
{EX_DEC,SIGALRM},
{EX_SYS_CALL,SIGSYS},
{EX_TRACE,SIGTRAP},
{0xB,SIGILL},
{EX_IABR,SIGTRAP},
{0xD,SIGFPE},
{0,0}
}
#define EX_FP
Definition: context.h:13
#define EX_SYS_CALL
Definition: context.h:15
#define EX_DSI
Definition: context.h:8
#define EX_IABR
Definition: context.h:18
#define EX_INT
Definition: context.h:10
#define EX_TRACE
Definition: context.h:16
#define EX_DEC
Definition: context.h:14
#define EX_MACH_CHECK
Definition: context.h:7
#define EX_ALIGN
Definition: context.h:11
#define EX_ISI
Definition: context.h:9
#define EX_PRG
Definition: context.h:12

◆ hexchars

const char hexchars[] ="0123456789abcdef"

◆ p_bpentries

struct bp_entry* p_bpentries = NULL
static

◆ remcomInBuffer

char remcomInBuffer[BUFMAX]
static

◆ remcomOutBuffer

char remcomOutBuffer[BUFMAX]
static

◆ tcp_gateway

const char* tcp_gateway

◆ tcp_localip

const char* tcp_localip

◆ tcp_netmask

const char* tcp_netmask