mirror of
https://github.com/adelphes/android-dev-ext.git
synced 2025-12-22 17:39:19 +00:00
Add support for array element updating
This commit is contained in:
@@ -1149,10 +1149,15 @@ class AndroidDebugSession extends DebugSession {
|
|||||||
switch(destvar.vtype) {
|
switch(destvar.vtype) {
|
||||||
case 'field': return this.dbgr.setfieldvalue(destvar, data);
|
case 'field': return this.dbgr.setfieldvalue(destvar, data);
|
||||||
case 'local': return this.dbgr.setlocalvalue(destvar, data);
|
case 'local': return this.dbgr.setlocalvalue(destvar, data);
|
||||||
|
case 'arrelem':
|
||||||
|
var idx = parseInt(args.name, 10), count=1;
|
||||||
|
if (idx < 0 || idx >= destvar.data.arrobj.arraylen) throw new Error('Array index out of bounds');
|
||||||
|
return this.dbgr.setarrayvalues(destvar.data.arrobj, idx, count, data);
|
||||||
default: throw new Error('Unsupported variable type');
|
default: throw new Error('Unsupported variable type');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(newlocalvar => {
|
.then(newlocalvar => {
|
||||||
|
if (destvar.vtype === 'arrelem') newlocalvar = newlocalvar[0];
|
||||||
Object.assign(destvar, newlocalvar);
|
Object.assign(destvar, newlocalvar);
|
||||||
var vsvar = this._local_to_variable(destvar);
|
var vsvar = this._local_to_variable(destvar);
|
||||||
response.body = {
|
response.body = {
|
||||||
@@ -1163,7 +1168,7 @@ class AndroidDebugSession extends DebugSession {
|
|||||||
this.sendResponse(response);
|
this.sendResponse(response);
|
||||||
})
|
})
|
||||||
.fail(e => {
|
.fail(e => {
|
||||||
failSetVariableRequest(response, 'Variable update failed.');
|
failSetVariableRequest(response, 'Variable update failed. '+(e.message||''));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user