debugger: error in try/catch and errcatch fixed
[scilab.git] / scilab / modules / ast / src / cpp / ast / debuggervisitor.cpp
index fffeef8..762d9b6 100644 (file)
@@ -69,7 +69,8 @@ void DebuggerVisitor::visit(const SeqExp  &e)
 
         //debugger check !
         int iBreakPoint = -1;
-        if (ConfigVariable::getEnableDebug())
+        if (ConfigVariable::getEnableDebug() &&
+            manager->isInterrupted() == false) // avoid stopping execution if an execution is already paused
         {
             bool stopExecution = false;
             if (manager->isStepIn())
@@ -224,8 +225,9 @@ void DebuggerVisitor::visit(const SeqExp  &e)
                 }
             }
 
-            if(stopExecution)
+            if(stopExecution || manager->isPauseRequested())
             {
+                manager->resetPauseRequest();
                 manager->stop(exp, iBreakPoint);
                 if (manager->isAborted())
                 {
@@ -379,6 +381,13 @@ void DebuggerVisitor::visit(const SeqExp  &e)
         }
         catch (const InternalError& ie)
         {
+            // dont manage an error with the debugger
+            // in cases of try catch and errcatch
+            if(ConfigVariable::isSilentError())
+            {
+                throw ie;
+            }
+
             ConfigVariable::fillWhereError(ie.GetErrorLocation().first_line);
 
             const std::vector<ConfigVariable::WhereEntry>& lWhereAmI = ConfigVariable::getWhere();
@@ -477,6 +486,11 @@ bool getMacroSourceFile(std::string* filename)
         return false;
     }
 
+    if(lWhereAmI.back().m_file_name == nullptr)
+    {
+        return false;
+    }
+
     std::string file = scilab::UTF8::toUTF8(*lWhereAmI.back().m_file_name);
     if (file.rfind(".bin") != std::string::npos)
     {
@@ -494,4 +508,4 @@ bool getMacroSourceFile(std::string* filename)
     }
 
     return true;
-}
\ No newline at end of file
+}