include type info when reporting missing fields

Store character primitives as a uint16 integer with a separate char field.
This commit is contained in:
adelphes
2017-01-29 19:06:32 +00:00
parent 88c20d6470
commit ec38695bcc
2 changed files with 8 additions and 4 deletions

View File

@@ -855,8 +855,10 @@ Debugger.prototype = {
.then((fields, x) => { .then((fields, x) => {
var field = fields.find(f => f.name === x.fieldname); var field = fields.find(f => f.name === x.fieldname);
if (field) return $.Deferred().resolveWith(this,[field,x.extra]); if (field) return $.Deferred().resolveWith(this,[field,x.extra]);
if (!x.includeInherited || x.objvar.type.signature==='Ljava/lang/Object;') if (!x.includeInherited || x.objvar.type.signature==='Ljava/lang/Object;') {
return $.Deferred().rejectWith(this,[new Error('No such field: '+x.fieldname), x.extra]); var fqtname = [x.reqtype.package,x.reqtype.typename].join('.');
return $.Deferred().rejectWith(this,[new Error(`No such field '${x.fieldname}' in type ${fqtname}`), x.extra]);
}
// search supertype // search supertype
return this.getsuperinstance(x.objvar, x) return this.getsuperinstance(x.objvar, x)
.then((superobjvar,x) => { .then((superobjvar,x) => {
@@ -865,7 +867,7 @@ Debugger.prototype = {
}); });
}); });
} }
return findfield({findfield, objvar, fieldname, includeInherited, extra}); return findfield({findfield, objvar, fieldname, includeInherited, extra, reqtype:objvar.type});
}, },
getExceptionLocal: function (ex_ref_value, extra) { getExceptionLocal: function (ex_ref_value, extra) {
@@ -1060,6 +1062,8 @@ Debugger.prototype = {
arrayfields.push(info); arrayfields.push(info);
else if (keys[i].type.signature === 'Ljava/lang/String;') else if (keys[i].type.signature === 'Ljava/lang/String;')
stringfields.push(info); stringfields.push(info);
else if (keys[i].type.signature === 'C')
info.char = info.valid ? String.fromCodePoint(info.value) : '';
i++; i++;
} }
} }

View File

@@ -169,7 +169,7 @@ function _JDWP() {
return i<32768?i:i-65536; return i<32768?i:i-65536;
}, },
decodeChar: function(o) { decodeChar: function(o) {
return String.fromCharCode((o.data[o.idx++]<<8)+o.data[o.idx++]); return (o.data[o.idx++]<<8)+o.data[o.idx++]; // uint16
}, },
decodeBoolean: function(o) { decodeBoolean: function(o) {
return o.data[o.idx++] != 0; return o.data[o.idx++] != 0;