f=figure("closerequestfcn","disp(""closing""); close(gcf()); disp(""close done !"")");
debug
click on the close button of the figure
the EDT is waiting for the execution of the closerequestfcn
because storing a command in debug mode pause the thread.
When the main thread of Scilab execute close, the close function
wants to add something in the EDT which is paused.
Change-Id: I0996465dd9f9965e3ef05c845260c533aded6348
return 1;
}
- return debuggerManagerExecute(command);
+ // 0 : don't pause the thread
+ return debuggerManagerExecute(command, 0);
}
else
{
return 1;
}
- return debuggerManagerExecute(command);
+ // 0 : don't pause the thread
+ return debuggerManagerExecute(command, 0);
}
else
{
DebugAction action;
int level;
- void internal_execution_released();
void internal_stop();
bool callstackAddFile(StackRow* _row, const std::wstring& _fileName);
}
}
- char* execute(const std::string& command); //execute a command
+ char* execute(const std::string& command, int iWaitForIt = 1); //execute a command
void print(const std::string& variable); //print a variable
void show(int bp); //print the breakpoint bp or all breakpoints (bp = -1)
void resume(); //resume execution
EXTERN_AST int isEnableDebug();
EXTERN_AST int isDebugInterrupted();
-EXTERN_AST int debuggerManagerExecute(const char* command);
+EXTERN_AST int debuggerManagerExecute(const char* command, int iWaitForIt);
EXTERN_AST int isExecutionBreak();
EXTERN_AST void setExecutionBreak();
void ConsoleDebugger::onPrint(const std::string& variable)
{
// sciprint("ConsoleDebugger::onPrint.\n");
- StoreDebuggerCommand(std::string("disp("+variable+")").data());
+ StoreDebuggerCommand(std::string("disp("+variable+")").data(), 1);
}
void ConsoleDebugger::onShow(int bp)
sendShow(bp);
}
-char* DebuggerManager::execute(const std::string& command)
+char* DebuggerManager::execute(const std::string& command, int iWaitForIt)
{
char* error = checkCommand(command.data());
if(error)
// inform debuggers
sendExecution();
// execute command and wait
- StoreDebuggerCommand(command.data());
- // send execution finished and update debugger informations
- internal_execution_released();
+ StoreDebuggerCommand(command.data(), iWaitForIt);
return nullptr;
}
// send "SendRunMeSignal" to unlock execution then wait
ThreadManagement::WaitForDebuggerExecDoneSignal(true);
-
- // send execution finished and update debugger informations
- internal_execution_released();
}
}
clearCallStack();
ThreadManagement::WaitForDebuggerExecDoneSignal(true);
-
- internal_execution_released();
}
}
-void DebuggerManager::internal_execution_released()
-{
- // send execution finished
- sendExecutionReleased();
-}
-
void DebuggerManager::internal_stop()
{
interrupted = true;
generateCallStack();
// release the debugger thread
ThreadManagement::SendDebuggerExecDoneSignal();
+ sendExecutionReleased();
// wait inside pause
try
{
return debugger::DebuggerManager::getInstance()->isInterrupted() ? 1 : 0;
}
-int debuggerManagerExecute(const char* command)
+int debuggerManagerExecute(const char* command, int iWaitForIt)
{
- return debugger::DebuggerManager::getInstance()->execute(command) ? 1 : 0;
+ return debugger::DebuggerManager::getInstance()->execute(command, iWaitForIt) ? 1 : 0;
}
int isExecutionBreak()
* @param command : the command
* @return <ReturnValue>
*/
-int StoreDebuggerCommand(const char *command);
+int StoreDebuggerCommand(const char *command, int iWaitFor);
/**
* Store a prioritary and non-interruptible command
// send the good signal about the end of execution
sendExecDoneSignal();
+ // send information about execution done to debuggers
+ manager->sendExecutionReleased();
+
// set back the runner wich have been overwritten in StaticRunner::getRunner
m_CurrentRunner.store(pRunSave);
throw ia;
// send the good signal about the end of execution
sendExecDoneSignal();
+ // send information about execution done to debuggers
+ manager->sendExecutionReleased();
+
//clean debugger step flag if debugger is not interrupted ( end of debug )
manager->resetStep();
return 0;
}
-int StoreDebuggerCommand(const char *command)
+int StoreDebuggerCommand(const char *command, int iWaitFor)
{
ThreadManagement::LockStoreCommand();
commandQueuePrioritary.emplace_back(os_strdup(command),
// Awake Runner to execute this prioritary command
ThreadManagement::SendAwakeRunnerSignal();
- // make this wait before unlock the Store Command will prevent
- // dead lock in case where another thread get this command
- // and execute it before this thread is waiting for.
- ThreadManagement::WaitForDebuggerExecDoneSignal(false);
+ if (iWaitFor)
+ {
+ // make this wait before unlock the Store Command will prevent
+ // dead lock in case where another thread get this command
+ // and execute it before this thread is waiting for.
+ ThreadManagement::WaitForDebuggerExecDoneSignal(false);
+ }
+ else
+ {
+ ThreadManagement::UnlockStoreCommand();
+ }
return 0;
}