Skip to content

Commit a3e3e4e

Browse files
committed
DEBUG: more info in panic
1 parent e16e1b1 commit a3e3e4e

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

profiling/src/profiling/stack_walking.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,17 @@ fn frameless_opline_or_prev(execute_data: &zend_execute_data) -> Option<&zend_op
176176
| ZEND_FRAMELESS_ICALL_2
177177
| ZEND_FRAMELESS_ICALL_3
178178
) {
179+
// Best-effort decode of the frameless function name for debugging.
180+
let flf_name = unsafe {
181+
let func = &**zend_flf_functions.offset(opline.extended_value as isize);
182+
extract_function_name(func).unwrap_or_else(|| Cow::Borrowed("<no name>"))
183+
};
179184
// Debug aid: crash hard when we observe a frameless icall as the current opline.
180185
// If this never triggers in CI, then allocation sampling is not observing the
181186
// frameless opcode as the current execute_data->opline at sample time.
182187
panic!(
183-
"Observed FRAMELESS_ICALL opcode ({}) as current opline at execute_data={:p} opline={:p} extended_value={}",
188+
"Observed FRAMELESS_ICALL opcode ({}) as current opline at execute_data={execute_data:p} opline={:p} extended_value={} flf_func={flf_name}",
184189
opline.opcode as u32,
185-
execute_data,
186190
execute_data.opline,
187191
opline.extended_value
188192
);
@@ -223,10 +227,8 @@ fn frameless_opline_or_prev(execute_data: &zend_execute_data) -> Option<&zend_op
223227
// This is intended to prove whether allocation sampling ever sees the OP_DATA
224228
// adjacency case in CI.
225229
panic!(
226-
"Observed OP_DATA ({}) with preceding FRAMELESS_ICALL opcode ({}) at execute_data={:p} opline={:p} prev_opline={:p}",
227-
ZEND_OP_DATA,
230+
"Observed OP_DATA ({ZEND_OP_DATA}) with preceding FRAMELESS_ICALL opcode ({}) at execute_data={execute_data:p} opline={:p} prev_opline={:p}",
228231
prev.opcode as u32,
229-
execute_data,
230232
execute_data.opline,
231233
prev_ptr
232234
);

0 commit comments

Comments
 (0)