mirror of
https://github.com/adelphes/android-dev-ext.git
synced 2025-12-22 17:39:19 +00:00
added callStackDisplaySize config setting
This commit is contained in:
@@ -71,6 +71,11 @@
|
|||||||
"description": "Automatically launch 'adb start-server' if not already started. Default: true",
|
"description": "Automatically launch 'adb start-server' if not already started. Default: true",
|
||||||
"default": true
|
"default": true
|
||||||
},
|
},
|
||||||
|
"callStackDisplaySize": {
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Number of entries to display in call stack views (for locations outside of the project source). 0 shows the entire call stack. Default: 1",
|
||||||
|
"default": 1
|
||||||
|
},
|
||||||
"logcatPort": {
|
"logcatPort": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"description": "Port number to use for the internal logcat websocket link. Changes to this value only apply when the extension is restarted. Default: 7038",
|
"description": "Port number to use for the internal logcat websocket link. Changes to this value only apply when the extension is restarted. Default: 7038",
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ class AndroidDebugSession extends DebugSession {
|
|||||||
// path to the the ANDROID_HOME/sources/<api> (only set if it's a valid path)
|
// path to the the ANDROID_HOME/sources/<api> (only set if it's a valid path)
|
||||||
this._android_sources_path = '';
|
this._android_sources_path = '';
|
||||||
|
|
||||||
|
// number of call stack entries to display above the project source
|
||||||
|
this.callStackDisplaySize = 1;
|
||||||
|
|
||||||
// the set of variables used for evalution outside of any thread/frame context
|
// the set of variables used for evalution outside of any thread/frame context
|
||||||
this._globals = new AndroidVariables(this, 10000);
|
this._globals = new AndroidVariables(this, 10000);
|
||||||
|
|
||||||
@@ -64,7 +67,6 @@ class AndroidDebugSession extends DebugSession {
|
|||||||
// so that the frontend can match events with breakpoints.
|
// so that the frontend can match events with breakpoints.
|
||||||
this._breakpointId = 1000;
|
this._breakpointId = 1000;
|
||||||
|
|
||||||
//this._frameBaseId = 0x00010000; // high, so we don't clash with thread id's
|
|
||||||
this._sourceRefs = { all:[null] }; // hashmap + array of (non-zero) source references
|
this._sourceRefs = { all:[null] }; // hashmap + array of (non-zero) source references
|
||||||
this._nextVSCodeThreadId = 0; // vscode doesn't like thread id reuse (the Android runtime is OK with it)
|
this._nextVSCodeThreadId = 0; // vscode doesn't like thread id reuse (the Android runtime is OK with it)
|
||||||
|
|
||||||
@@ -147,9 +149,7 @@ class AndroidDebugSession extends DebugSession {
|
|||||||
reportStoppedEvent(reason, location, last_exception) {
|
reportStoppedEvent(reason, location, last_exception) {
|
||||||
var thread = this.getThread(location.threadid);
|
var thread = this.getThread(location.threadid);
|
||||||
if (thread.stepTimeout) {
|
if (thread.stepTimeout) {
|
||||||
var now = process.hrtime(), then = thread.stepTimeout._begun;
|
|
||||||
clearTimeout(thread.stepTimeout);
|
clearTimeout(thread.stepTimeout);
|
||||||
console.log('step took: ' + ((now[0]*1e9+now[1]) -(then[0]*1e9+then[1]))/1e9);
|
|
||||||
thread.stepTimeout = null;
|
thread.stepTimeout = null;
|
||||||
}
|
}
|
||||||
if (thread.paused) {
|
if (thread.paused) {
|
||||||
@@ -211,6 +211,8 @@ class AndroidDebugSession extends DebugSession {
|
|||||||
// app_src_root must end in a path-separator for correct validation of sub-paths
|
// app_src_root must end in a path-separator for correct validation of sub-paths
|
||||||
this.app_src_root = ensure_path_end_slash(args.appSrcRoot);
|
this.app_src_root = ensure_path_end_slash(args.appSrcRoot);
|
||||||
this.apk_fpn = args.apkFile;
|
this.apk_fpn = args.apkFile;
|
||||||
|
if (typeof args.callStackDisplaySize === 'number' && args.callStackDisplaySize >= 0)
|
||||||
|
this.callStackDisplaySize = args.callStackDisplaySize|0;
|
||||||
|
|
||||||
// configure the ADB port - if it's undefined, it will set the default value.
|
// configure the ADB port - if it's undefined, it will set the default value.
|
||||||
// if it's not a valid port number, any connection request should neatly fail.
|
// if it's not a valid port number, any connection request should neatly fail.
|
||||||
@@ -767,9 +769,11 @@ class AndroidDebugSession extends DebugSession {
|
|||||||
pkginfo && (highest_known_source=i);
|
pkginfo && (highest_known_source=i);
|
||||||
stack.push(new StackFrame(stack_frame_id, name, src, linenum, 0));
|
stack.push(new StackFrame(stack_frame_id, name, src, linenum, 0));
|
||||||
}
|
}
|
||||||
// FIX: trim the stack to exclude anything above the known sources - otherwise an error occurs in the editor when the user tries to view it
|
// trim the stack to exclude calls above the known sources
|
||||||
stack = stack.slice(0,highest_known_source+1);
|
if (this.callStackDisplaySize > 0) {
|
||||||
|
stack = stack.slice(0,highest_known_source+this.callStackDisplaySize);
|
||||||
totalFrames = stack.length;
|
totalFrames = stack.length;
|
||||||
|
}
|
||||||
// return the frames
|
// return the frames
|
||||||
response.body = {
|
response.body = {
|
||||||
stackFrames: stack,
|
stackFrames: stack,
|
||||||
@@ -913,8 +917,6 @@ class AndroidDebugSession extends DebugSession {
|
|||||||
doStep(which, response, args) {
|
doStep(which, response, args) {
|
||||||
D('step '+which);
|
D('step '+which);
|
||||||
|
|
||||||
// when we step, manually resume the (single) thread we are stepping and remove it from the list of paused threads
|
|
||||||
// - any other paused threads should remain suspended during the step
|
|
||||||
var t = this.getThread(args.threadId);
|
var t = this.getThread(args.threadId);
|
||||||
if (!t) return this.failRequestNoThread('Step', args.threadId, response);
|
if (!t) return this.failRequestNoThread('Step', args.threadId, response);
|
||||||
if (!t.paused) return this.failRequestThreadNotSuspended('Step', args.threadId, response);
|
if (!t.paused) return this.failRequestThreadNotSuspended('Step', args.threadId, response);
|
||||||
@@ -922,7 +924,7 @@ class AndroidDebugSession extends DebugSession {
|
|||||||
t.paused = null;
|
t.paused = null;
|
||||||
|
|
||||||
this.sendResponse(response);
|
this.sendResponse(response);
|
||||||
// we time the step - if it takes more than 1 second, we switch to any other threads that are waiting
|
// we time the step - if it takes more than 2 seconds, we switch to any other threads that are waiting
|
||||||
t.stepTimeout = setTimeout(t => {
|
t.stepTimeout = setTimeout(t => {
|
||||||
console.log('Step timeout on thread:'+t.threadid);
|
console.log('Step timeout on thread:'+t.threadid);
|
||||||
t.stepTimeout = null;
|
t.stepTimeout = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user