PSPSDK 1.0+beta2
Loading...
Searching...
No Matches
pspdebug.h
Go to the documentation of this file.
1/*
2 * PSP Software Development Kit - https://github.com/pspdev
3 * -----------------------------------------------------------------------
4 * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
5 *
6 * pspdebug.h - Prototypes for the pspDebug library
7 *
8 * Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
9 * Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
10 * Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
11 *
12 */
13#ifndef __DEBUG_H__
14#define __DEBUG_H__
15
16#include <psptypes.h>
17#include <pspmoduleinfo.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
32
40void pspDebugScreenInitEx(void *vram_base, int mode, int setup);
41
48void pspDebugScreenPrintf(const char *fmt, ...) __attribute__((format(printf,1,2)));
49
59void pspDebugScreenKprintf(const char *format, ...) __attribute__((format(printf,1,2)));
60
67
75
82
89
98void pspDebugScreenPutChar(int x, int y, u32 color, u8 ch);
99
103void pspDebugScreenSetXY(int x, int y);
104
110void pspDebugScreenSetOffset(int offset);
111
118
125
132
137
146int pspDebugScreenPrintData(const char *buff, int size);
147
155int pspDebugScreenPuts(const char *str);
156
165int pspDebugGetStackTrace(unsigned int* results, int max);
166
171
176
216
219
228
238
240typedef int (*PspDebugKprintfHandler)(const char *format, u32 *args);
241
249
258
272
275{
276 volatile u32 enable;
277 volatile u32 systemck;
278 volatile u32 cpuck;
279 volatile u32 internal;
280 volatile u32 memory;
281 volatile u32 copz;
282 volatile u32 vfpu;
283 volatile u32 sleep;
284 volatile u32 bus_access;
287 volatile u32 cached_load;
289 volatile u32 i_miss;
290 volatile u32 d_miss;
291 volatile u32 d_writeback;
292 volatile u32 cop0_inst;
293 volatile u32 fpu_inst;
294 volatile u32 vfpu_inst;
295 volatile u32 local_bus;
297
299void pspDebugProfilerEnable(void);
300
302void pspDebugProfilerDisable(void);
303
305void pspDebugProfilerClear(void);
306
312
314void pspDebugProfilerPrint(void);
315
317typedef int (*PspDebugPrintHandler)(const char *data, int len);
318
320typedef int (*PspDebugInputHandler)(char *data, int len);
321
330
339
348
354void pspDebugSioPutchar(int ch);
355
361int pspDebugSioGetchar(void);
362
368void pspDebugSioPuts(const char *str);
369
378int pspDebugSioPutData(const char *data, int len);
379
389int pspDebugSioPutText(const char *data, int len);
390
395void pspDebugSioInit(void);
396
401void pspDebugSioSetBaud(int baud);
402
407void pspDebugEnablePutchar(void);
408
415
419void pspDebugGdbStubInit(void);
420
425
429void pspDebugSioEnableKprintf(void);
430
435
438#ifdef __cplusplus
439}
440#endif
441
442#endif
int(* PspDebugInputHandler)(char *data, int len)
Type for the debug input handler.
Definition pspdebug.h:320
void pspDebugSioEnableKprintf(void)
Enable the kprintf handler (once installed)
Definition sio.c:169
void pspDebugScreenSetColorMode(int mode)
Set the color mode (you must have switched the frame buffer appropriately)
void pspDebugSioSetBaud(int baud)
Set the baud rate of the SIO, e.g.
Definition sio.c:100
int pspDebugInstallKprintfHandler(PspDebugKprintfHandler handler)
Install a Kprintf handler into the system.
Definition kprintf.c:40
void pspDebugScreenInitEx(void *vram_base, int mode, int setup)
Extended debug screen init.
void pspDebugSioDisableKprintf(void)
Disable the kprintf handler (once installed)
Definition sio.c:174
void pspDebugScreenPutChar(int x, int y, u32 color, u8 ch)
Draw a single character to the screen.
int pspDebugInstallStdoutHandler(PspDebugPrintHandler handler)
Install a print handler for stdout (so you can use normal print functions)
Definition stdio.c:257
int pspDebugSioPutData(const char *data, int len)
Write a set of data to the sio port.
Definition sio.c:61
int pspDebugSioGetchar(void)
Get a character from the remote sio.
Definition sio.c:39
void pspDebugGdbStubInit(void)
Install the gdb stub handler.
Definition gdb-stub.c:285
void(* PspDebugErrorHandler)(PspDebugRegBlock *regs)
Defines a debug error handler.
Definition pspdebug.h:218
struct _PspDebugProfilerRegs PspDebugProfilerRegs
Structure to hold the psp profiler register values.
void pspDebugSioPutchar(int ch)
Put a character to the remote sio.
Definition sio.c:33
int pspDebugSioPutText(const char *data, int len)
Write a set of data to the sio port converting single line feeds to CRLF and single CR to CRLF.
Definition sio.c:74
void pspDebugProfilerClear(void)
Clear the profiler registers.
Definition profiler.c:30
int pspDebugScreenPrintData(const char *buff, int size)
Print non-nul terminated strings.
void pspDebugScreenSetOffset(int offset)
Set the video ram offset used for the screen.
int pspDebugInstallErrorHandler(PspDebugErrorHandler handler)
Install an error handler to catch unhandled exceptions.
Definition exception.c:24
void pspDebugScreenSetXY(int x, int y)
Set the current X and Y co-ordinate for the screen (in character units)
int pspDebugInstallStderrHandler(PspDebugPrintHandler handler)
Install a print handler for stderr (so you can use normal print functions)
Definition stdio.c:274
void pspDebugProfilerDisable(void)
Disables the profiler hardware.
Definition profiler.c:24
int pspDebugInstallStdinHandler(PspDebugInputHandler handler)
Install a handler for stdin (so you can use normal stdio functions)
Definition stdio.c:240
void pspDebugProfilerPrint(void)
Print the profiler registers to screen.
Definition profiler.c:65
void pspDebugEnablePutchar(void)
Enable debug character output.
Definition sio.c:141
int(* PspDebugPrintHandler)(const char *data, int len)
Type for the debug print handlers.
Definition pspdebug.h:317
struct _PspDebugStackTrace PspDebugStackTrace
Structure to hold a single stack trace entry.
void pspDebugSioInit(void)
Initialise the remote SIO port (defaults to 4800 8N1).
Definition sio.c:118
void pspDebugBreakpoint(void)
Generate a breakpoint exception.
void pspDebugScreenPrintf(const char *fmt,...) __attribute__((format(printf
Do a printf to the debug screen.
void void void pspDebugScreenEnableBackColor(int enable)
Enable or disable background colour writing (defaults to enabled)
int pspDebugScreenPuts(const char *str)
Print a string.
int(* PspDebugKprintfHandler)(const char *format, u32 *args)
Type for Kprintf handler.
Definition pspdebug.h:240
void pspDebugProfilerGetRegs(PspDebugProfilerRegs *regs)
Get the profiler register state.
Definition profiler.c:44
int pspDebugScreenGetY(void)
Get the current Y co-ordinate (in character units)
int pspDebugScreenGetX(void)
Get the current X co-ordinate (in character units)
void pspDebugDumpException(PspDebugRegBlock *regs)
Dump an exception to screen using the pspDebugScreen functions.
Definition exception.c:59
void pspDebugScreenClear(void)
Clear the debug screen.
void pspDebugSioInstallKprintf(void)
Install a kprintf debug putchar handler.
Definition sio.c:162
void void pspDebugScreenKprintf(const char *format,...) __attribute__((format(printf
Do a printf to the debug screen.
void pspDebugScreenSetBackColor(u32 color)
Set the background color for the text.
void pspDebugScreenSetTextColor(u32 color)
Set the text color.
void pspDebugScreenInit(void)
Initialise the debug screen.
void pspDebugScreenSetBase(u32 *base)
Set the video ram base used for the screen.
void pspDebugSioPuts(const char *str)
Write a string to the sio port.
Definition sio.c:49
void pspDebugScreenClearLineEnable(void)
Enable the clear line function that allows debug to clear the screen.
void pspDebugProfilerEnable(void)
Enables the profiler hardware.
Definition profiler.c:19
void pspDebugScreenClearLineDisable(void)
Disable the clear line function that causes flicker on constant refreshes.
struct _PspDebugRegBlock PspDebugRegBlock
Structure to hold the register data associated with an exception.
int pspDebugGetStackTrace(unsigned int *results, int max)
Get a MIPS stack trace (might work :P)
Definition callstack.c:139
int pspDebugGetStackTrace2(PspDebugRegBlock *regs, PspDebugStackTrace *trace, int max)
Do a stack trace from the current exception.
Definition stacktrace.c:77
struct sockaddr_in __attribute__
unsigned char size
Definition pspsysmem_kernel.h:6
float r
Definition psptypes.h:0
uint8_t u8
Definition psptypes.h:38
float y
Definition psptypes.h:1
float x
Definition psptypes.h:0
uint32_t u32
Definition psptypes.h:41
Structure to hold the psp profiler register values.
Definition pspdebug.h:275
volatile u32 uncached_store
Definition pspdebug.h:286
volatile u32 cop0_inst
Definition pspdebug.h:292
volatile u32 vfpu
Definition pspdebug.h:282
volatile u32 memory
Definition pspdebug.h:280
volatile u32 sleep
Definition pspdebug.h:283
volatile u32 enable
Definition pspdebug.h:276
volatile u32 cpuck
Definition pspdebug.h:278
volatile u32 d_miss
Definition pspdebug.h:290
volatile u32 systemck
Definition pspdebug.h:277
volatile u32 internal
Definition pspdebug.h:279
volatile u32 cached_store
Definition pspdebug.h:288
volatile u32 local_bus
Definition pspdebug.h:295
volatile u32 uncached_load
Definition pspdebug.h:285
volatile u32 d_writeback
Definition pspdebug.h:291
volatile u32 vfpu_inst
Definition pspdebug.h:294
volatile u32 copz
Definition pspdebug.h:281
volatile u32 cached_load
Definition pspdebug.h:287
volatile u32 bus_access
Definition pspdebug.h:284
volatile u32 fpu_inst
Definition pspdebug.h:293
volatile u32 i_miss
Definition pspdebug.h:289
Structure to hold the register data associated with an exception.
Definition pspdebug.h:179
u32 context
Definition pspdebug.h:201
u32 entryhi
Definition pspdebug.h:207
u32 status
The status register.
Definition pspdebug.h:184
u32 entrylo1
Definition pspdebug.h:200
u32 frame_ptr
Definition pspdebug.h:194
u32 pagemask
Definition pspdebug.h:202
u32 unused
Definition pspdebug.h:195
u32 cop0_13
Definition pspdebug.h:210
u32 cop0_9
Definition pspdebug.h:206
u32 hi
Definition pspdebug.h:187
u32 epc
Definition pspdebug.h:190
u32 cop0_8
Definition pspdebug.h:205
u32 fsr
Definition pspdebug.h:192
u32 fir
Definition pspdebug.h:193
u32 index
Definition pspdebug.h:197
u32 cause
Definition pspdebug.h:189
u32 entrylo0
Definition pspdebug.h:199
u32 prid
Definition pspdebug.h:213
u32 wired
Definition pspdebug.h:203
u32 cop0_11
Definition pspdebug.h:208
u32 badvaddr
Definition pspdebug.h:188
u32 lo
lo
Definition pspdebug.h:186
u32 random
Definition pspdebug.h:198
u32 cop0_7
Definition pspdebug.h:204
u32 cop0_12
Definition pspdebug.h:209
u32 cop0_14
Definition pspdebug.h:211
Structure to hold a single stack trace entry.
Definition pspdebug.h:252
u32 func_addr
The address of the function called.
Definition pspdebug.h:256
u32 call_addr
The address which called the function.
Definition pspdebug.h:254