diff --git a/src/Debug.cc b/src/Debug.cc index 088913a941..1c756820b3 100644 --- a/src/Debug.cc +++ b/src/Debug.cc @@ -25,6 +25,7 @@ #include "zeek/IntrusivePtr.h" #include "zeek/PolicyFile.h" #include "zeek/Reporter.h" +#include "zeek/RunState.h" #include "zeek/Scope.h" #include "zeek/Stmt.h" #include "zeek/Val.h" @@ -821,6 +822,10 @@ bool pre_execute_stmt(Stmt* stmt, Frame* f) { } bool post_execute_stmt(Stmt* stmt, Frame* f, Val* result, StmtFlowType* flow) { + // If the debugger isn't currently active, return true so the caller continues. + if ( ! g_policy_debug ) + return true; + // Handle the case where someone issues a "next" debugger command, // but we're at a return statement, so the next statement is in // some other function. diff --git a/src/Stmt.cc b/src/Stmt.cc index 9efda21df1..5f210013a3 100644 --- a/src/Stmt.cc +++ b/src/Stmt.cc @@ -12,6 +12,7 @@ #include "zeek/Frame.h" #include "zeek/IntrusivePtr.h" #include "zeek/Reporter.h" +#include "zeek/RunState.h" #include "zeek/Scope.h" #include "zeek/Traverse.h" #include "zeek/Trigger.h" @@ -147,8 +148,10 @@ const AssertStmt* Stmt::AsAssertStmt() const { } bool Stmt::SetLocationInfo(const Location* start, const Location* end) { - if ( ! Obj::SetLocationInfo(start, end) ) - return false; + // Skip the rest of this code if the debugger isn't active or if the initial set + // failed. + if ( bool res = Obj::SetLocationInfo(start, end); ! res || ! detail::g_policy_debug ) + return res; // Update the Filemap of line number -> statement mapping for // breakpoints (Debug.h).