mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
fixup! Disable Stmt hooks for the built-in debugger if not a debug build
This commit is contained in:
parent
3878353a7a
commit
54c26f768f
2 changed files with 10 additions and 14 deletions
|
@ -25,6 +25,7 @@
|
||||||
#include "zeek/IntrusivePtr.h"
|
#include "zeek/IntrusivePtr.h"
|
||||||
#include "zeek/PolicyFile.h"
|
#include "zeek/PolicyFile.h"
|
||||||
#include "zeek/Reporter.h"
|
#include "zeek/Reporter.h"
|
||||||
|
#include "zeek/RunState.h"
|
||||||
#include "zeek/Scope.h"
|
#include "zeek/Scope.h"
|
||||||
#include "zeek/Stmt.h"
|
#include "zeek/Stmt.h"
|
||||||
#include "zeek/Val.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) {
|
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,
|
// Handle the case where someone issues a "next" debugger command,
|
||||||
// but we're at a return statement, so the next statement is in
|
// but we're at a return statement, so the next statement is in
|
||||||
// some other function.
|
// some other function.
|
||||||
|
|
19
src/Stmt.cc
19
src/Stmt.cc
|
@ -12,6 +12,7 @@
|
||||||
#include "zeek/Frame.h"
|
#include "zeek/Frame.h"
|
||||||
#include "zeek/IntrusivePtr.h"
|
#include "zeek/IntrusivePtr.h"
|
||||||
#include "zeek/Reporter.h"
|
#include "zeek/Reporter.h"
|
||||||
|
#include "zeek/RunState.h"
|
||||||
#include "zeek/Scope.h"
|
#include "zeek/Scope.h"
|
||||||
#include "zeek/Traverse.h"
|
#include "zeek/Traverse.h"
|
||||||
#include "zeek/Trigger.h"
|
#include "zeek/Trigger.h"
|
||||||
|
@ -147,9 +148,10 @@ const AssertStmt* Stmt::AsAssertStmt() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Stmt::SetLocationInfo(const Location* start, const Location* end) {
|
bool Stmt::SetLocationInfo(const Location* start, const Location* end) {
|
||||||
#if DEBUG
|
// Skip the rest of this code if the debugger isn't active or if the initial set
|
||||||
if ( ! Obj::SetLocationInfo(start, end) )
|
// failed.
|
||||||
return false;
|
if ( bool res = Obj::SetLocationInfo(start, end); ! res || ! detail::g_policy_debug )
|
||||||
|
return res;
|
||||||
|
|
||||||
// Update the Filemap of line number -> statement mapping for
|
// Update the Filemap of line number -> statement mapping for
|
||||||
// breakpoints (Debug.h).
|
// breakpoints (Debug.h).
|
||||||
|
@ -178,9 +180,6 @@ bool Stmt::SetLocationInfo(const Location* start, const Location* end) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
#else
|
|
||||||
return Obj::SetLocationInfo(start, end);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Stmt::IsPure() const { return false; }
|
bool Stmt::IsPure() const { return false; }
|
||||||
|
@ -440,17 +439,13 @@ ValPtr IfStmt::DoExec(Frame* f, Val* v, StmtFlowType& flow) {
|
||||||
|
|
||||||
f->SetNextStmt(do_stmt);
|
f->SetNextStmt(do_stmt);
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
if ( ! pre_execute_stmt(do_stmt, f) ) { // ### Abort or something
|
if ( ! pre_execute_stmt(do_stmt, f) ) { // ### Abort or something
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
auto result = do_stmt->Exec(f, flow);
|
auto result = do_stmt->Exec(f, flow);
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
if ( ! post_execute_stmt(do_stmt, f, result.get(), &flow) ) { // ### Abort or something
|
if ( ! post_execute_stmt(do_stmt, f, result.get(), &flow) ) { // ### Abort or something
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1417,17 +1412,13 @@ ValPtr StmtList::Exec(Frame* f, StmtFlowType& flow) {
|
||||||
|
|
||||||
f->SetNextStmt(stmt);
|
f->SetNextStmt(stmt);
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
if ( ! pre_execute_stmt(stmt, f) ) { // ### Abort or something
|
if ( ! pre_execute_stmt(stmt, f) ) { // ### Abort or something
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
auto result = stmt->Exec(f, flow);
|
auto result = stmt->Exec(f, flow);
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
if ( ! post_execute_stmt(stmt, f, result.get(), &flow) ) { // ### Abort or something
|
if ( ! post_execute_stmt(stmt, f, result.get(), &flow) ) { // ### Abort or something
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( flow != FLOW_NEXT || result || f->HasDelayed() )
|
if ( flow != FLOW_NEXT || result || f->HasDelayed() )
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue