2020-03-29 17:34:08 +00:00
|
|
|
#ifndef __qwaq_debugger_debug_h
|
|
|
|
#define __qwaq_debugger_debug_h
|
2020-03-24 10:52:35 +00:00
|
|
|
|
2020-03-29 17:34:08 +00:00
|
|
|
#include "ui/event.h"
|
2020-03-24 10:52:35 +00:00
|
|
|
|
2020-03-24 11:15:35 +00:00
|
|
|
typedef enum {
|
2020-03-24 10:52:35 +00:00
|
|
|
qe_debug_event = 0x0100,
|
|
|
|
} qwaq_debug_messages;
|
|
|
|
|
|
|
|
#ifdef __QFCC__
|
|
|
|
|
2020-04-02 01:44:16 +00:00
|
|
|
#include <QF/pr_debug.h>
|
|
|
|
|
2020-03-25 13:37:38 +00:00
|
|
|
//FIXME finish unsigned in qfcc
|
|
|
|
#ifndef umax
|
2020-03-24 10:52:35 +00:00
|
|
|
#define umax 0x7fffffff
|
|
|
|
#endif
|
|
|
|
|
2020-03-24 16:07:58 +00:00
|
|
|
typedef string string_t;
|
|
|
|
|
2020-03-24 10:52:35 +00:00
|
|
|
#endif
|
|
|
|
|
2020-04-02 01:44:16 +00:00
|
|
|
typedef struct qdb_event_s {
|
|
|
|
prdebug_t what;
|
|
|
|
union {
|
|
|
|
string_t message;
|
2020-04-02 08:44:53 +00:00
|
|
|
unsigned function;
|
2020-04-02 01:44:16 +00:00
|
|
|
int exit_code;
|
|
|
|
};
|
|
|
|
} qdb_event_t;
|
|
|
|
|
2020-03-24 10:52:35 +00:00
|
|
|
typedef struct qdb_state_s {
|
|
|
|
unsigned staddr;
|
|
|
|
unsigned func;
|
2020-03-24 16:07:58 +00:00
|
|
|
string_t file;
|
2020-03-24 10:52:35 +00:00
|
|
|
unsigned line;
|
|
|
|
} qdb_state_t;
|
|
|
|
|
2020-04-02 08:44:53 +00:00
|
|
|
typedef struct qdb_stack_s {
|
|
|
|
unsigned staddr; // return address
|
|
|
|
unsigned func; // calling function
|
|
|
|
// FIXME temp strings
|
|
|
|
} qdb_stack_t;
|
|
|
|
|
2020-03-25 13:39:17 +00:00
|
|
|
typedef struct qdb_def_s {
|
|
|
|
unsigned type_size; // type in lower 16, size in upper 16
|
|
|
|
unsigned offset;
|
2020-03-26 09:14:20 +00:00
|
|
|
unsigned name; // string
|
2020-03-25 13:39:17 +00:00
|
|
|
unsigned type_encoding;
|
|
|
|
} qdb_def_t;
|
|
|
|
|
|
|
|
typedef struct qdb_function_s {
|
|
|
|
int staddr;
|
|
|
|
unsigned local_data;
|
|
|
|
unsigned local_size;
|
|
|
|
unsigned profile;
|
2020-03-26 09:14:20 +00:00
|
|
|
unsigned name; // string
|
|
|
|
unsigned file; // string
|
2020-03-25 13:39:17 +00:00
|
|
|
unsigned num_params;
|
|
|
|
} qdb_function_t;
|
|
|
|
|
|
|
|
typedef struct qdb_auxfunction_s {
|
|
|
|
unsigned function;
|
|
|
|
unsigned source_line;
|
|
|
|
unsigned line_info;
|
|
|
|
unsigned local_defs;
|
|
|
|
unsigned num_locals;
|
|
|
|
unsigned return_type;
|
|
|
|
} qdb_auxfunction_t;
|
|
|
|
|
2020-03-24 16:07:58 +00:00
|
|
|
#ifdef __QFCC__
|
|
|
|
|
|
|
|
typedef struct qdb_target_s { int handle; } qdb_target_t;
|
|
|
|
|
2020-03-27 09:17:24 +00:00
|
|
|
void qdb_set_trace (qdb_target_t target, int state);
|
|
|
|
int qdb_set_breakpoint (qdb_target_t target, unsigned staddr);
|
|
|
|
int qdb_clear_breakpoint (qdb_target_t target, unsigned staddr);
|
|
|
|
int qdb_set_watchpoint (qdb_target_t target, unsigned offset);
|
|
|
|
int qdb_clear_watchpoint (qdb_target_t target);
|
|
|
|
int qdb_continue (qdb_target_t target);
|
|
|
|
qdb_state_t qdb_get_state (qdb_target_t target);
|
2020-04-02 08:44:53 +00:00
|
|
|
int qdb_get_stack_depth (qdb_target_t target);
|
|
|
|
qdb_stack_t *qdb_get_stack (qdb_target_t target);
|
2020-04-02 01:44:16 +00:00
|
|
|
int qdb_get_event (qdb_target_t target, qdb_event_t *event);
|
2020-03-27 09:17:24 +00:00
|
|
|
int qdb_get_data (qdb_target_t target, unsigned src, unsigned len, void *dst);
|
2020-03-30 03:43:02 +00:00
|
|
|
@overload string qdb_get_string (qdb_target_t target, unsigned str);
|
|
|
|
// note: str is likely not valid in the host progs, it's just a convinience to
|
|
|
|
// avoid cast shenanigans when getting type encoding strings
|
|
|
|
@overload string qdb_get_string (qdb_target_t target, string str);
|
2020-03-27 09:17:24 +00:00
|
|
|
qdb_def_t qdb_find_global (qdb_target_t target, string name);
|
|
|
|
qdb_def_t qdb_find_field (qdb_target_t target, string name);
|
|
|
|
qdb_function_t *qdb_find_function (qdb_target_t target, string name);
|
|
|
|
qdb_function_t *qdb_get_function (qdb_target_t target, unsigned fnum);
|
|
|
|
qdb_auxfunction_t *qdb_find_auxfunction (qdb_target_t target, string name);
|
|
|
|
qdb_auxfunction_t *qdb_get_auxfunction (qdb_target_t target, unsigned fnum);
|
|
|
|
qdb_def_t *qdb_get_local_defs (qdb_target_t target, unsigned fnum);
|
|
|
|
|
|
|
|
void traceon();
|
|
|
|
void traceoff();
|
2020-03-26 04:27:53 +00:00
|
|
|
|
2020-03-24 16:07:58 +00:00
|
|
|
#else//GCC
|
|
|
|
|
2020-03-24 10:52:35 +00:00
|
|
|
void QWAQ_Debug_Init (progs_t *pr);
|
|
|
|
void QWAQ_DebugTarget_Init (progs_t *pr);
|
|
|
|
|
2020-03-24 16:07:58 +00:00
|
|
|
#endif
|
|
|
|
|
2020-03-29 17:34:08 +00:00
|
|
|
#endif//__qwaq_debugger_debug_h
|