diff --git a/uppsrc/ide/Debuggers/Gdb_MI2.cpp b/uppsrc/ide/Debuggers/Gdb_MI2.cpp index 75a75abac..599bc6684 100644 --- a/uppsrc/ide/Debuggers/Gdb_MI2.cpp +++ b/uppsrc/ide/Debuggers/Gdb_MI2.cpp @@ -217,6 +217,35 @@ void Gdb_MI2::SetStopThread(bool b) stopThread = b; } } + +// shut down threads and wait till done +void Gdb_MI2::ShutDownThreads(void) +{ + // signal all other threads to stop + SetStopThread(true); + + // interrupt any active GDB command + InterruptCommand(); + + // ugly hack, otherwise service thread can deadlock + // MUST CHECK THIS ONE.... + int n = LeaveGuiMutexAll(); + + // give some time to recover + do + { + Sleep(20); + } + while(IsThreadRunning()); + + // RE-ENTER GUI MUTEX -- SEE ABOVE... + EnterGuiMutex(n); + + // remove thread stopping flag + SetStopThread(false); +} + + #endif #ifdef flagMT @@ -876,6 +905,13 @@ void Gdb_MI2::DropFrames() MIValue &fArgs = frameArgs[iFrame]["args"]; frame.Add(iFrame, FormatFrame(fInfo, fArgs)); } + + // data must be synced on frame change + localSynced = false; + thisSynced = false; + watchesSynced = false; + explorerSynced = false; + frame <<= q; } @@ -913,6 +949,13 @@ void Gdb_MI2::dropThreads() String threadStr = Format("#%03x%s", id, (id == currentId ? "(*)" : "")); threadSelector.Add(id, threadStr); } + + // data must be resynced on threads drop + localSynced = false; + thisSynced = false; + watchesSynced = false; + explorerSynced = false; + threadSelector <<= q; } diff --git a/uppsrc/ide/Debuggers/Gdb_MI2.h b/uppsrc/ide/Debuggers/Gdb_MI2.h index 3ee3fca92..79cb589b6 100644 --- a/uppsrc/ide/Debuggers/Gdb_MI2.h +++ b/uppsrc/ide/Debuggers/Gdb_MI2.h @@ -59,6 +59,9 @@ class Gdb_MI2 : public Debugger, public ParentCtrl bool IsStopThread(void); private: void SetStopThread(bool b); + + // shut down threads and wait till done + void ShutDownThreads(void); #endif @@ -236,7 +239,7 @@ class Gdb_MI2 : public Debugger, public ParentCtrl bool watchesSynced; bool explorerSynced; void SyncData(); - + // sync ide display with breakpoint position void SyncIde(bool frame = false); diff --git a/uppsrc/ide/Debuggers/Gdb_MI2Gdb.cpp b/uppsrc/ide/Debuggers/Gdb_MI2Gdb.cpp index bf3fac298..b8b0f9bf6 100644 --- a/uppsrc/ide/Debuggers/Gdb_MI2Gdb.cpp +++ b/uppsrc/ide/Debuggers/Gdb_MI2Gdb.cpp @@ -261,30 +261,7 @@ MIValue Gdb_MI2::MICmd(const char *cmdLine) // issued GDB commands (which normally can lag several seconds...) // before issuing the command if(IsMainThread() && IsThreadRunning()) - { - // signal all other threads to stop - SetStopThread(true); - - // interrupt any active GDB command - InterruptCommand(); - - // ugly hack, otherwise service thread can deadlock - // MUST CHECK THIS ONE.... - int n = LeaveGuiMutexAll(); - - // give some time to recover - do - { - Sleep(20); - } - while(IsThreadRunning()); - - // RE-ENTER GUI MUTEX -- SEE ABOVE... - EnterGuiMutex(n); - - // remove thread stopping flag - SetStopThread(false); - } + ShutDownThreads(); // quick exit for service thread if(!IsMainThread() && IsStopThread()) diff --git a/uppsrc/ide/Debuggers/UppSimplifiers.icpp b/uppsrc/ide/Debuggers/UppSimplifiers.icpp index bb742b1be..efb70a265 100644 --- a/uppsrc/ide/Debuggers/UppSimplifiers.icpp +++ b/uppsrc/ide/Debuggers/UppSimplifiers.icpp @@ -470,15 +470,6 @@ static int UppOneSimplify(VarItem &varItem, int step) } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -static String TrimChar(String const &s) -{ - int pos = s.Find(" "); - if(pos >= 0) - return s.Left(pos - 1); - else - return s; -} - static int UppTimeSimplify(VarItem &varItem, int step) { MIValue val = varItem.EvaluateExpression(varItem.evaluableExpression);