mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 23:11:38 +00:00
[gamecode] Dump union contents
The output is messy, but better than <union>
This commit is contained in:
parent
6001abbfdb
commit
6dfe37635d
1 changed files with 14 additions and 0 deletions
|
@ -1139,8 +1139,22 @@ static void
|
|||
pr_debug_union_view (qfot_type_t *type, pr_type_t *value, void *_data)
|
||||
{
|
||||
__auto_type data = (pr_debug_data_t *) _data;
|
||||
progs_t *pr = data->pr;
|
||||
dstring_t *dstr = data->dstr;
|
||||
qfot_struct_t *strct = &type->t.strct;
|
||||
|
||||
dstring_appendstr (dstr, "{");
|
||||
for (int i = 0; i < strct->num_fields; i++) {
|
||||
qfot_var_t *field = strct->fields + i;
|
||||
qfot_type_t *val_type = &G_STRUCT (pr, qfot_type_t, field->type);
|
||||
pr_type_t *val = value + field->offset;
|
||||
dasprintf (dstr, "%s=", PR_GetString (pr, field->name));
|
||||
value_string (data, val_type, val);
|
||||
if (i < strct->num_fields) {
|
||||
dstring_appendstr (dstr, ", ");
|
||||
}
|
||||
}
|
||||
dstring_appendstr (dstr, "}");
|
||||
dstring_appendstr (dstr, "<union>");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue