mirror of https://github.com/buggins/dlangide.git
debugger - step / thread fixes
This commit is contained in:
parent
4aac13c19f
commit
ec3a1abac0
|
@ -112,6 +112,10 @@ class DebugThread {
|
||||||
}
|
}
|
||||||
DebugThread clone() { return new DebugThread(this); }
|
DebugThread clone() { return new DebugThread(this); }
|
||||||
|
|
||||||
|
@property string displayName() {
|
||||||
|
return "%u: %s".format(id, name);
|
||||||
|
}
|
||||||
|
|
||||||
@property int length() {
|
@property int length() {
|
||||||
if (stack && stack.length > 0)
|
if (stack && stack.length > 0)
|
||||||
return stack.length;
|
return stack.length;
|
||||||
|
@ -217,11 +221,11 @@ interface Debugger : ProgramExecution {
|
||||||
/// interrupt execution
|
/// interrupt execution
|
||||||
void execPause();
|
void execPause();
|
||||||
/// step over
|
/// step over
|
||||||
void execStepOver();
|
void execStepOver(ulong threadId);
|
||||||
/// step in
|
/// step in
|
||||||
void execStepIn();
|
void execStepIn(ulong threadId);
|
||||||
/// step out
|
/// step out
|
||||||
void execStepOut();
|
void execStepOut(ulong threadId);
|
||||||
/// restart
|
/// restart
|
||||||
void execRestart();
|
void execRestart();
|
||||||
|
|
||||||
|
@ -370,16 +374,16 @@ class DebuggerProxy : Debugger, DebuggerCallback {
|
||||||
_debugger.postRequest(delegate() { _debugger.execPause(); });
|
_debugger.postRequest(delegate() { _debugger.execPause(); });
|
||||||
}
|
}
|
||||||
/// step over
|
/// step over
|
||||||
void execStepOver() {
|
void execStepOver(ulong threadId) {
|
||||||
_debugger.postRequest(delegate() { _debugger.execStepOver(); });
|
_debugger.postRequest(delegate() { _debugger.execStepOver(threadId); });
|
||||||
}
|
}
|
||||||
/// step in
|
/// step in
|
||||||
void execStepIn() {
|
void execStepIn(ulong threadId) {
|
||||||
_debugger.postRequest(delegate() { _debugger.execStepIn(); });
|
_debugger.postRequest(delegate() { _debugger.execStepIn(threadId); });
|
||||||
}
|
}
|
||||||
/// step out
|
/// step out
|
||||||
void execStepOut() {
|
void execStepOut(ulong threadId) {
|
||||||
_debugger.postRequest(delegate() { _debugger.execStepOut(); });
|
_debugger.postRequest(delegate() { _debugger.execStepOut(threadId); });
|
||||||
}
|
}
|
||||||
/// restart
|
/// restart
|
||||||
void execRestart() {
|
void execRestart() {
|
||||||
|
|
|
@ -296,20 +296,21 @@ class GDBInterface : ConsoleDebuggerInterface, TextCommandTarget {
|
||||||
void execPause() {
|
void execPause() {
|
||||||
_pauseRequestId = sendCommand("-exec-interrupt");
|
_pauseRequestId = sendCommand("-exec-interrupt");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// step over
|
/// step over
|
||||||
int _stepOverRequestId;
|
int _stepOverRequestId;
|
||||||
void execStepOver() {
|
void execStepOver(ulong threadId) {
|
||||||
_stepOverRequestId = sendCommand("-exec-next");
|
_stepOverRequestId = sendCommand("-exec-next".appendThreadParam(threadId));
|
||||||
}
|
}
|
||||||
/// step in
|
/// step in
|
||||||
int _stepInRequestId;
|
int _stepInRequestId;
|
||||||
void execStepIn() {
|
void execStepIn(ulong threadId) {
|
||||||
_stepInRequestId = sendCommand("-exec-step");
|
_stepInRequestId = sendCommand("-exec-step".appendThreadParam(threadId));
|
||||||
}
|
}
|
||||||
/// step out
|
/// step out
|
||||||
int _stepOutRequestId;
|
int _stepOutRequestId;
|
||||||
void execStepOut() {
|
void execStepOut(ulong threadId) {
|
||||||
_stepOutRequestId = sendCommand("-exec-finish");
|
_stepOutRequestId = sendCommand("-exec-finish".appendThreadParam(threadId));
|
||||||
}
|
}
|
||||||
/// restart
|
/// restart
|
||||||
int _restartRequestId;
|
int _restartRequestId;
|
||||||
|
@ -739,3 +740,10 @@ struct GDBRequestList {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// appends --thread parameter to command text if threadId != 0
|
||||||
|
string appendThreadParam(string src, ulong threadId) {
|
||||||
|
if (!threadId)
|
||||||
|
return src;
|
||||||
|
return src ~= " --thread " ~ to!string(threadId);
|
||||||
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ class DebuggerUIHandler : DebuggerCallback, StackFrameSelectedHandler {
|
||||||
private WatchPanel _watchPanel;
|
private WatchPanel _watchPanel;
|
||||||
private StackPanel _stackPanel;
|
private StackPanel _stackPanel;
|
||||||
private DebugThreadList _debugInfo;
|
private DebugThreadList _debugInfo;
|
||||||
|
private ulong _currentThreadId;
|
||||||
|
|
||||||
this(IDEFrame ide, Debugger debugger) {
|
this(IDEFrame ide, Debugger debugger) {
|
||||||
_ide = ide;
|
_ide = ide;
|
||||||
|
@ -42,6 +43,7 @@ class DebuggerUIHandler : DebuggerCallback, StackFrameSelectedHandler {
|
||||||
void onDebugContextInfo(DebugThreadList info, ulong threadId, int frameId) {
|
void onDebugContextInfo(DebugThreadList info, ulong threadId, int frameId) {
|
||||||
Log.d("Debugger context received threadId=", threadId, " frameId=", frameId);
|
Log.d("Debugger context received threadId=", threadId, " frameId=", frameId);
|
||||||
_debugInfo = info;
|
_debugInfo = info;
|
||||||
|
_currentThreadId = threadId;
|
||||||
_stackPanel.updateDebugInfo(info, threadId, frameId);
|
_stackPanel.updateDebugInfo(info, threadId, frameId);
|
||||||
_watchPanel.updateDebugInfo(info, threadId, frameId);
|
_watchPanel.updateDebugInfo(info, threadId, frameId);
|
||||||
}
|
}
|
||||||
|
@ -132,34 +134,51 @@ class DebuggerUIHandler : DebuggerCallback, StackFrameSelectedHandler {
|
||||||
_debugger.run();
|
_debugger.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@property ulong currentThreadId() {
|
||||||
|
if (_currentThreadId)
|
||||||
|
return _currentThreadId;
|
||||||
|
return _debugInfo ? _debugInfo.currentThreadId : 0;
|
||||||
|
}
|
||||||
bool handleAction(const Action a) {
|
bool handleAction(const Action a) {
|
||||||
switch(a.id) {
|
switch(a.id) {
|
||||||
case IDEActions.DebugPause:
|
case IDEActions.DebugPause:
|
||||||
if (_state == DebuggingState.running)
|
if (_state == DebuggingState.running) {
|
||||||
|
_currentThreadId = 0;
|
||||||
_debugger.execPause();
|
_debugger.execPause();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
case IDEActions.DebugContinue:
|
case IDEActions.DebugContinue:
|
||||||
if (_state == DebuggingState.paused)
|
if (_state == DebuggingState.paused) {
|
||||||
|
_currentThreadId = 0;
|
||||||
_debugger.execContinue();
|
_debugger.execContinue();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
case IDEActions.DebugStop:
|
case IDEActions.DebugStop:
|
||||||
//_debugger.execStop();
|
//_debugger.execStop();
|
||||||
Log.d("Trying to stop debugger");
|
Log.d("Trying to stop debugger");
|
||||||
|
_currentThreadId = 0;
|
||||||
_debugger.stop();
|
_debugger.stop();
|
||||||
return true;
|
return true;
|
||||||
case IDEActions.DebugStepInto:
|
case IDEActions.DebugStepInto:
|
||||||
if (_state == DebuggingState.paused)
|
if (_state == DebuggingState.paused) {
|
||||||
_debugger.execStepIn();
|
Log.d("DebugStepInto threadId=", currentThreadId);
|
||||||
|
_debugger.execStepIn(currentThreadId);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
case IDEActions.DebugStepOver:
|
case IDEActions.DebugStepOver:
|
||||||
if (_state == DebuggingState.paused)
|
if (_state == DebuggingState.paused) {
|
||||||
_debugger.execStepOver();
|
Log.d("DebugStepOver threadId=", currentThreadId);
|
||||||
|
_debugger.execStepOver(currentThreadId);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
case IDEActions.DebugStepOut:
|
case IDEActions.DebugStepOut:
|
||||||
if (_state == DebuggingState.paused)
|
if (_state == DebuggingState.paused) {
|
||||||
_debugger.execStepOut();
|
Log.d("DebugStepOut threadId=", currentThreadId);
|
||||||
|
_debugger.execStepOut(currentThreadId);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
case IDEActions.DebugRestart:
|
case IDEActions.DebugRestart:
|
||||||
|
_currentThreadId = 0;
|
||||||
_debugger.execRestart();
|
_debugger.execRestart();
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -63,7 +63,7 @@ class StackPanel : DockWindow, OnItemSelectedHandler, CellActivatedHandler {
|
||||||
_comboBox.enabled = true;
|
_comboBox.enabled = true;
|
||||||
dstring[] threadNames;
|
dstring[] threadNames;
|
||||||
for (int i = 0; i < _debugInfo.length; i++) {
|
for (int i = 0; i < _debugInfo.length; i++) {
|
||||||
threadNames ~= _debugInfo[i].name.toUTF32;
|
threadNames ~= _debugInfo[i].displayName.toUTF32;
|
||||||
if (_debugInfo[i].id == _currentThreadId) {
|
if (_debugInfo[i].id == _currentThreadId) {
|
||||||
_currentThreadIndex = i;
|
_currentThreadIndex = i;
|
||||||
_selectedThread = _debugInfo[i];
|
_selectedThread = _debugInfo[i];
|
||||||
|
|
Loading…
Reference in New Issue