mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-29 07:32:02 +00:00
[qwaq] Fetch Ruamoko progs locals from the stack frame
Now that the data is fetched from the correct location, the locals view is useful again :). However, there seems to be a problem with array views: not sure they're showing the correct data as I was getting unexpected values in the display but normal vars seem to be ok.
This commit is contained in:
parent
39583a959e
commit
c6aa061229
5 changed files with 50 additions and 2 deletions
|
@ -649,6 +649,35 @@ qdb_get_source_line_addr (progs_t *pr)
|
|||
R_UINT (pr) = PR_FindSourceLineAddr (tpr, file, line);
|
||||
}
|
||||
|
||||
static void
|
||||
qdb_has_data_stack (progs_t *pr)
|
||||
{
|
||||
__auto_type debug = PR_Resources_Find (pr, "qwaq-debug");
|
||||
pr_ptr_t handle = P_INT (pr, 0);
|
||||
qwaq_target_t *target = get_target (debug, __FUNCTION__, handle);
|
||||
progs_t *tpr = target->pr;
|
||||
|
||||
R_INT (pr) = tpr->progs->version == PROG_VERSION;
|
||||
}
|
||||
|
||||
static void
|
||||
qdb_get_frame_addr (progs_t *pr)
|
||||
{
|
||||
__auto_type debug = PR_Resources_Find (pr, "qwaq-debug");
|
||||
pr_ptr_t handle = P_INT (pr, 0);
|
||||
qwaq_target_t *target = get_target (debug, __FUNCTION__, handle);
|
||||
progs_t *tpr = target->pr;
|
||||
|
||||
R_UINT (pr) = 0;
|
||||
|
||||
if (tpr->progs->version == PROG_VERSION) {
|
||||
if (tpr->pr_depth) {
|
||||
prstack_t *frame = tpr->pr_stack + tpr->pr_depth - 1;
|
||||
R_UINT (pr) = frame->stack_ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define bi(x,np,params...) {#x, x, -1, np, {params}}
|
||||
#define p(type) PR_PARAM(type)
|
||||
static builtin_t builtins[] = {
|
||||
|
@ -675,6 +704,8 @@ static builtin_t builtins[] = {
|
|||
bi(qdb_get_auxfunction, 2, p(int), p(uint)),
|
||||
bi(qdb_get_local_defs, 2, p(int), p(uint)),
|
||||
bi(qdb_get_source_line_addr, 3, p(int), p(string), p(uint)),
|
||||
bi(qdb_has_data_stack, 1, p(int)),
|
||||
bi(qdb_get_frame_addr, 1, p(int)),
|
||||
{}
|
||||
};
|
||||
|
||||
|
|
|
@ -98,6 +98,8 @@ 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);
|
||||
unsigned qdb_get_source_line_addr(qdb_target_t target, string file,
|
||||
unsigned line);
|
||||
int qdb_has_data_stack (qdb_target_t target);
|
||||
unsigned qdb_get_frame_addr (qdb_target_t target);
|
||||
void traceon();
|
||||
void traceoff();
|
||||
|
||||
|
|
|
@ -30,3 +30,5 @@ qdb_auxfunction_t *qdb_get_auxfunction (qdb_target_t target,
|
|||
qdb_def_t *qdb_get_local_defs (qdb_target_t target, unsigned fnum) = #0;
|
||||
unsigned qdb_get_source_line_addr(qdb_target_t target, string file,
|
||||
unsigned line) = #0;
|
||||
int qdb_has_data_stack (qdb_target_t target) = #0;
|
||||
unsigned qdb_get_frame_addr (qdb_target_t target) = #0;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
{
|
||||
ListenerGroup *onRowCountChanged;
|
||||
qdb_target_t target;
|
||||
int has_stack;
|
||||
qfot_type_encodings_t target_encodings;
|
||||
unsigned current_fnum;
|
||||
qdb_function_t *func;
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
qdb_get_data (target, encodings_def.offset, sizeof(target_encodings),
|
||||
&target_encodings);
|
||||
|
||||
self.has_stack = qdb_has_data_stack (target);
|
||||
|
||||
self.onRowCountChanged = [[ListenerGroup listener] retain];
|
||||
return self;
|
||||
}
|
||||
|
@ -104,8 +106,18 @@ free_defs (LocalsData *self)
|
|||
|
||||
-fetchData
|
||||
{
|
||||
if (data && func.local_size && func.local_data) {
|
||||
qdb_get_data (target, func.local_data, func.local_size, data);
|
||||
if (data && func.local_size) {
|
||||
unsigned local_data = func.local_data;
|
||||
if (has_stack) {
|
||||
unsigned stack_ptr = qdb_get_frame_addr (target);
|
||||
local_data = 0;
|
||||
if (stack_ptr) {
|
||||
local_data = stack_ptr - func.local_data;
|
||||
}
|
||||
}
|
||||
if (local_data) {
|
||||
qdb_get_data (target, local_data, func.local_size, data);
|
||||
}
|
||||
}
|
||||
int rowCount = def_rows[num_user_defs];
|
||||
if (aux_func) {
|
||||
|
|
Loading…
Reference in a new issue