mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge 7c10b8639e
into 8b4707a284
This commit is contained in:
commit
77d0d66a0c
4 changed files with 18 additions and 7 deletions
|
@ -821,6 +821,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.
|
||||||
|
|
|
@ -339,6 +339,7 @@ ValPtr ScriptFunc::Invoke(zeek::Args* args, Frame* parent) const {
|
||||||
f->SetTriggerAssoc(parent->GetTriggerAssoc());
|
f->SetTriggerAssoc(parent->GetTriggerAssoc());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! g_policy_debug )
|
||||||
g_frame_stack.push_back(f.get()); // used for backtracing
|
g_frame_stack.push_back(f.get()); // used for backtracing
|
||||||
const CallExpr* call_expr = parent ? parent->GetCall() : nullptr;
|
const CallExpr* call_expr = parent ? parent->GetCall() : nullptr;
|
||||||
call_stack.emplace_back(CallInfo{call_expr, this, *args});
|
call_stack.emplace_back(CallInfo{call_expr, this, *args});
|
||||||
|
@ -391,6 +392,7 @@ ValPtr ScriptFunc::Invoke(zeek::Args* args, Frame* parent) const {
|
||||||
catch ( InterpreterException& e ) {
|
catch ( InterpreterException& e ) {
|
||||||
// Already reported, but now determine whether to unwind further.
|
// Already reported, but now determine whether to unwind further.
|
||||||
if ( Flavor() == FUNC_FLAVOR_FUNCTION ) {
|
if ( Flavor() == FUNC_FLAVOR_FUNCTION ) {
|
||||||
|
if ( ! g_policy_debug )
|
||||||
g_frame_stack.pop_back();
|
g_frame_stack.pop_back();
|
||||||
call_stack.pop_back();
|
call_stack.pop_back();
|
||||||
// Result not set b/c exception was thrown
|
// Result not set b/c exception was thrown
|
||||||
|
@ -448,6 +450,7 @@ ValPtr ScriptFunc::Invoke(zeek::Args* args, Frame* parent) const {
|
||||||
g_trace_state.LogTrace("Function return: %s\n", d.Description());
|
g_trace_state.LogTrace("Function return: %s\n", d.Description());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! g_policy_debug )
|
||||||
g_frame_stack.pop_back();
|
g_frame_stack.pop_back();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -147,8 +147,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 ( ! Obj::SetLocationInfo(start, end) )
|
// Skip the rest of this code if the debugger isn't active or if the initial set
|
||||||
return false;
|
// failed.
|
||||||
|
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).
|
||||||
|
|
|
@ -1052,6 +1052,7 @@ SetupResult setup(int argc, char** argv, Options* zopts) {
|
||||||
auto [body, scope] = get_global_stmts();
|
auto [body, scope] = get_global_stmts();
|
||||||
StmtFlowType flow;
|
StmtFlowType flow;
|
||||||
Frame f(scope->Length(), nullptr, nullptr);
|
Frame f(scope->Length(), nullptr, nullptr);
|
||||||
|
if ( ! g_policy_debug )
|
||||||
g_frame_stack.push_back(&f);
|
g_frame_stack.push_back(&f);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -1060,6 +1061,7 @@ SetupResult setup(int argc, char** argv, Options* zopts) {
|
||||||
reporter->FatalError("failed to execute script statements at top-level scope");
|
reporter->FatalError("failed to execute script statements at top-level scope");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! g_policy_debug )
|
||||||
g_frame_stack.pop_back();
|
g_frame_stack.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue