From bd7212a411489d5e3be165a34d1ce692078d7690 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 1 Apr 2020 00:03:53 +0900 Subject: [PATCH] [qwaq] Pass debug target into the def views Needed for any views that have to fetch additional data (strings, fields, etc). --- ruamoko/qwaq/debugger/defview.h | 7 ++++++- ruamoko/qwaq/debugger/defview.r | 17 +++++++++++++++-- ruamoko/qwaq/debugger/localsdata.r | 2 +- ruamoko/qwaq/debugger/stringview.h | 2 +- ruamoko/qwaq/debugger/stringview.r | 4 ++-- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/ruamoko/qwaq/debugger/defview.h b/ruamoko/qwaq/debugger/defview.h index 69553620b..4760abcad 100644 --- a/ruamoko/qwaq/debugger/defview.h +++ b/ruamoko/qwaq/debugger/defview.h @@ -3,12 +3,17 @@ #include #include "ui/view.h" +#include "debugger/debug.h" @interface DefView : View { qfot_type_t *type; + qdb_target_t target; } -+(DefView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data; ++(DefView *)withType:(qfot_type_t *)type + at:(unsigned)offset + in:(void *)data + target:(qdb_target_t)target; -initWithType:(qfot_type_t *)type; @end diff --git a/ruamoko/qwaq/debugger/defview.r b/ruamoko/qwaq/debugger/defview.r index 5768a14f5..f115c8e61 100644 --- a/ruamoko/qwaq/debugger/defview.r +++ b/ruamoko/qwaq/debugger/defview.r @@ -31,10 +31,23 @@ static string meta_views[] = { return self; } +-setTarget:(qdb_target_t)target +{ + self.target = target; + return self; +} + +(DefView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data +{ + return [self withType:type at:offset in:data target:nil]; +} + ++(DefView *)withType:(qfot_type_t *)type + at:(unsigned)offset + in:(void *)data + target:(qdb_target_t)target { string metaname = nil; - //printf("%d %d %d %d\n", type.meta, type.size, type.encoding, type.type); if (type.meta == ty_alias) { type = type.alias.aux_type; } @@ -44,7 +57,7 @@ static string meta_views[] = { } id class = obj_lookup_class (metaname); if (class) { - return [class withType:type at:offset in:data]; + return [[class withType:type at:offset in:data] setTarget:target]; } return [NameView withName:"Invalid Meta"]; } diff --git a/ruamoko/qwaq/debugger/localsdata.r b/ruamoko/qwaq/debugger/localsdata.r index bdaa3dd79..7e6472191 100644 --- a/ruamoko/qwaq/debugger/localsdata.r +++ b/ruamoko/qwaq/debugger/localsdata.r @@ -92,7 +92,7 @@ qfot_type_t *type = [TypeEncodings getType:defs[row].type_encoding fromTarget:target]; unsigned offset = defs[row].offset; - view = [DefView withType:type at:offset in:data]; + view = [DefView withType:type at:offset in:data target:target]; } [view resizeTo:{[column width], 1}]; return view; diff --git a/ruamoko/qwaq/debugger/stringview.h b/ruamoko/qwaq/debugger/stringview.h index 708ef72ca..62b009e5d 100644 --- a/ruamoko/qwaq/debugger/stringview.h +++ b/ruamoko/qwaq/debugger/stringview.h @@ -5,7 +5,7 @@ @interface StringView : DefView { - string *data; + int *data; } +(StringView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data; @end diff --git a/ruamoko/qwaq/debugger/stringview.r b/ruamoko/qwaq/debugger/stringview.r index 81dc7cb78..445ccfdbf 100644 --- a/ruamoko/qwaq/debugger/stringview.r +++ b/ruamoko/qwaq/debugger/stringview.r @@ -8,7 +8,7 @@ if (!(self = [super initWithType:type])) { return nil; } - self.data = (string *)(data + offset); + self.data = (int *)(data + offset); return self; } @@ -20,7 +20,7 @@ -draw { [super draw]; - string val = sprintf ("FIXME %s", data[0]);// quote string + string val = sprintf ("FIXME %s", qdb_get_string (target, data[0]));// quote string [self mvaddstr:{0, 0}, str_mid (val, 0, xlen)]; return self; }