mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Wrap handling of g_frame_stack in checks for DEBUG
This commit is contained in:
parent
83f05dde34
commit
d6795320f7
2 changed files with 10 additions and 0 deletions
|
@ -339,7 +339,9 @@ ValPtr ScriptFunc::Invoke(zeek::Args* args, Frame* parent) const {
|
|||
f->SetTriggerAssoc(parent->GetTriggerAssoc());
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
g_frame_stack.push_back(f.get()); // used for backtracing
|
||||
#endif
|
||||
const CallExpr* call_expr = parent ? parent->GetCall() : nullptr;
|
||||
call_stack.emplace_back(CallInfo{call_expr, this, *args});
|
||||
|
||||
|
@ -391,7 +393,9 @@ ValPtr ScriptFunc::Invoke(zeek::Args* args, Frame* parent) const {
|
|||
catch ( InterpreterException& e ) {
|
||||
// Already reported, but now determine whether to unwind further.
|
||||
if ( Flavor() == FUNC_FLAVOR_FUNCTION ) {
|
||||
#if DEBUG
|
||||
g_frame_stack.pop_back();
|
||||
#endif
|
||||
call_stack.pop_back();
|
||||
// Result not set b/c exception was thrown
|
||||
throw;
|
||||
|
@ -448,7 +452,9 @@ ValPtr ScriptFunc::Invoke(zeek::Args* args, Frame* parent) const {
|
|||
g_trace_state.LogTrace("Function return: %s\n", d.Description());
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
g_frame_stack.pop_back();
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1105,7 +1105,9 @@ SetupResult setup(int argc, char** argv, Options* zopts) {
|
|||
auto [body, scope] = get_global_stmts();
|
||||
StmtFlowType flow;
|
||||
Frame f(scope->Length(), nullptr, nullptr);
|
||||
#ifdef DEBUG
|
||||
g_frame_stack.push_back(&f);
|
||||
#endif
|
||||
|
||||
try {
|
||||
body->Exec(&f, flow);
|
||||
|
@ -1113,7 +1115,9 @@ SetupResult setup(int argc, char** argv, Options* zopts) {
|
|||
reporter->FatalError("failed to execute script statements at top-level scope");
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
g_frame_stack.pop_back();
|
||||
#endif
|
||||
}
|
||||
|
||||
clear_script_analysis();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue