Skip to content

Commit

Permalink
Fix FLF backtrace
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Weinand <[email protected]>
  • Loading branch information
bwoebi committed Feb 19, 2025
1 parent bca372b commit e14ac37
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion ext/collect_backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static inline zend_bool skip_internal_handler(zend_execute_data *skip) /* {{{ */
/* Copy of zend_fetch_debug_backtrace with ability to gather local variables */
void ddtrace_fetch_debug_backtrace(zval *return_value, int skip_last, int options, int limit)
{
zend_execute_data *call;
zend_execute_data *call, *last_call = NULL;
zend_object *object;
bool fake_frame = 0;
int lineno, frameno = 0;
Expand Down Expand Up @@ -274,6 +274,7 @@ void ddtrace_fetch_debug_backtrace(zval *return_value, int skip_last, int option

if (skip_last) {
/* skip debug_backtrace() */
last_call = call;
call = call->prev_execute_data;
}

Expand Down Expand Up @@ -334,6 +335,9 @@ void ddtrace_fetch_debug_backtrace(zval *return_value, int skip_last, int option
stack_frame = zend_new_array(8);
zend_hash_real_init_mixed(stack_frame);
zend_function *func = ZEND_FLF_FUNC(opline);
if (last_call && last_call->func == func) {
goto not_frameless_call;
}
zend_string *name = func->common.function_name;
ZVAL_STRINGL(&tmp, ZSTR_VAL(name), ZSTR_LEN(name));
_zend_hash_append_ex(stack_frame, ZSTR_KNOWN(ZEND_STR_FUNCTION), &tmp, 1);
Expand Down Expand Up @@ -566,6 +570,7 @@ void ddtrace_fetch_debug_backtrace(zval *return_value, int skip_last, int option
} else {
fake_frame = 0;
include_filename = filename;
last_call = call;
call = prev;
}
}
Expand Down
2 changes: 1 addition & 1 deletion libdatadog
Submodule libdatadog updated 0 files

0 comments on commit e14ac37

Please sign in to comment.