summaryrefslogtreecommitdiffstats
path: root/scilab
diff options
context:
space:
mode:
authorCedric Delamarre <cdl@esi-group.com>2020-12-07 14:34:21 +0100
committerCedric Delamarre <cdl@esi-group.com>2020-12-08 18:32:51 +0100
commit2b962febcc3937007cc71d5e4f38e8b012e5c8b1 (patch)
tree8111e95499dbd77426922959111e769af9ac4b5d /scilab
parentf57b04c14fa74471425ed96710d642132478f1c2 (diff)
downloadscilab-2b962febcc3937007cc71d5e4f38e8b012e5c8b1.zip
scilab-2b962febcc3937007cc71d5e4f38e8b012e5c8b1.tar.gz
debugger: manual pause added
Change-Id: I7a37610d260d1911abf4f4da6744d462a60d7f12
Diffstat (limited to 'scilab')
-rw-r--r--scilab/modules/ast/includes/ast/debugmanager.hxx4
-rw-r--r--scilab/modules/ast/src/cpp/ast/debuggervisitor.cpp6
-rw-r--r--scilab/modules/ast/src/cpp/ast/debugmanager.cpp18
-rw-r--r--scilab/modules/core/includes/runner.hxx1
-rw-r--r--scilab/modules/core/src/cpp/runner.cpp6
5 files changed, 33 insertions, 2 deletions
diff --git a/scilab/modules/ast/includes/ast/debugmanager.hxx b/scilab/modules/ast/includes/ast/debugmanager.hxx
index 869800b..ebef8aa 100644
--- a/scilab/modules/ast/includes/ast/debugmanager.hxx
+++ b/scilab/modules/ast/includes/ast/debugmanager.hxx
@@ -67,6 +67,7 @@ private:
67 67
68 ast::Exp* pExp; 68 ast::Exp* pExp;
69 bool interrupted; 69 bool interrupted;
70 bool request_pause;
70 int currentBreakPoint; 71 int currentBreakPoint;
71 DebugAction action; 72 DebugAction action;
72 int level; 73 int level;
@@ -276,6 +277,9 @@ public:
276 void show(int bp); //print the breakpoint bp or all breakpoints (bp = -1) 277 void show(int bp); //print the breakpoint bp or all breakpoints (bp = -1)
277 void resume(); //resume execution 278 void resume(); //resume execution
278 void abort(); //abort execution 279 void abort(); //abort execution
280 void requestPause(); //pause execution
281 bool isPauseRequested(); //get pause request status
282 void resetPauseRequest(); //reset pause request status
279}; 283};
280 284
281} 285}
diff --git a/scilab/modules/ast/src/cpp/ast/debuggervisitor.cpp b/scilab/modules/ast/src/cpp/ast/debuggervisitor.cpp
index 38d67da..ff1d6ec 100644
--- a/scilab/modules/ast/src/cpp/ast/debuggervisitor.cpp
+++ b/scilab/modules/ast/src/cpp/ast/debuggervisitor.cpp
@@ -69,7 +69,8 @@ void DebuggerVisitor::visit(const SeqExp &e)
69 69
70 //debugger check ! 70 //debugger check !
71 int iBreakPoint = -1; 71 int iBreakPoint = -1;
72 if (ConfigVariable::getEnableDebug()) 72 if (ConfigVariable::getEnableDebug() &&
73 manager->isInterrupted() == false) // avoid stopping execution if an execution is already paused
73 { 74 {
74 bool stopExecution = false; 75 bool stopExecution = false;
75 if (manager->isStepIn()) 76 if (manager->isStepIn())
@@ -224,8 +225,9 @@ void DebuggerVisitor::visit(const SeqExp &e)
224 } 225 }
225 } 226 }
226 227
227 if(stopExecution) 228 if(stopExecution || manager->isPauseRequested())
228 { 229 {
230 manager->resetPauseRequest();
229 manager->stop(exp, iBreakPoint); 231 manager->stop(exp, iBreakPoint);
230 if (manager->isAborted()) 232 if (manager->isAborted())
231 { 233 {
diff --git a/scilab/modules/ast/src/cpp/ast/debugmanager.cpp b/scilab/modules/ast/src/cpp/ast/debugmanager.cpp
index 60f4f82..26ea968 100644
--- a/scilab/modules/ast/src/cpp/ast/debugmanager.cpp
+++ b/scilab/modules/ast/src/cpp/ast/debugmanager.cpp
@@ -442,6 +442,24 @@ void DebuggerManager::resume() //resume execution
442 } 442 }
443} 443}
444 444
445void DebuggerManager::requestPause() //ask for pause
446{
447 // pause on execution only if a command is running
448 if(interrupted == false) {
449 request_pause = true;
450 }
451}
452
453bool DebuggerManager::isPauseRequested() //pause execution
454{
455 return request_pause;
456}
457
458void DebuggerManager::resetPauseRequest() //pause execution
459{
460 request_pause = false;
461}
462
445void DebuggerManager::abort() //abort execution 463void DebuggerManager::abort() //abort execution
446{ 464{
447 //inform debuggers 465 //inform debuggers
diff --git a/scilab/modules/core/includes/runner.hxx b/scilab/modules/core/includes/runner.hxx
index a319e20..bf8ec20 100644
--- a/scilab/modules/core/includes/runner.hxx
+++ b/scilab/modules/core/includes/runner.hxx
@@ -83,6 +83,7 @@ public:
83 static void setRunner(Runner* _RunMe); 83 static void setRunner(Runner* _RunMe);
84 static Runner* getRunner(void); 84 static Runner* getRunner(void);
85 static bool isRunnerAvailable(void); 85 static bool isRunnerAvailable(void);
86 static bool isRunning(void);
86 static bool isInterruptibleCommand(void); 87 static bool isInterruptibleCommand(void);
87 static command_origin_t getCommandOrigin(); 88 static command_origin_t getCommandOrigin();
88 static void execAndWait(ast::Exp* _theProgram, ast::RunVisitor *_visitor, 89 static void execAndWait(ast::Exp* _theProgram, ast::RunVisitor *_visitor,
diff --git a/scilab/modules/core/src/cpp/runner.cpp b/scilab/modules/core/src/cpp/runner.cpp
index 1e47105..dede1be 100644
--- a/scilab/modules/core/src/cpp/runner.cpp
+++ b/scilab/modules/core/src/cpp/runner.cpp
@@ -228,6 +228,12 @@ bool StaticRunner::isRunnerAvailable(void)
228 return m_RunMe.load() != nullptr; 228 return m_RunMe.load() != nullptr;
229} 229}
230 230
231// return true if a command is running or paused.
232bool StaticRunner::isRunning(void)
233{
234 return m_CurrentRunner.load() != nullptr;
235}
236
231bool StaticRunner::isInterruptibleCommand() 237bool StaticRunner::isInterruptibleCommand()
232{ 238{
233 return m_CurrentRunner.load()->isInterruptible(); 239 return m_CurrentRunner.load()->isInterruptible();