diff --git a/support/ebpf/native_stack_trace.h b/support/ebpf/native_stack_trace.h index 4738ebe4b..4de45cbea 100644 --- a/support/ebpf/native_stack_trace.h +++ b/support/ebpf/native_stack_trace.h @@ -76,32 +76,24 @@ static EBPF_INLINE ErrorCode get_stack_delta(UnwindState *state, int *addrDiff, key.fileID = state->text_section_id; key.page = state->text_section_offset & ~STACK_DELTA_PAGE_MASK; DEBUG_PRINT( - "Look up stack delta for %lx:%lx", - (unsigned long)state->text_section_id, - (unsigned long)state->text_section_offset); + "sd %lx:%lx", (unsigned long)state->text_section_id, (unsigned long)state->text_section_offset); StackDeltaPageInfo *info = bpf_map_lookup_elem(&stack_delta_page_to_info, &key); if (!info) { - DEBUG_PRINT( - "Failure to look up stack delta page fileID %lx, page %lx", - (unsigned long)key.fileID, - (unsigned long)key.page); + DEBUG_PRINT("ERR sdp %lx p=%lx", (unsigned long)key.fileID, (unsigned long)key.page); state->error_metric = metricID_UnwindNativeErrLookupTextSection; return ERR_NATIVE_LOOKUP_TEXT_SECTION; } void *outer_map = get_stack_delta_map(info->mapID); if (!outer_map) { - DEBUG_PRINT( - "Failure to look up outer map for text section %lx in mapID %d", - (unsigned long)exe_id, - (int)info->mapID); + DEBUG_PRINT("ERR omap %lx m=%d", (unsigned long)exe_id, (int)info->mapID); state->error_metric = metricID_UnwindNativeErrLookupStackDeltaOuterMap; return ERR_NATIVE_LOOKUP_STACK_DELTA_OUTER_MAP; } void *inner_map = bpf_map_lookup_elem(outer_map, &exe_id); if (!inner_map) { - DEBUG_PRINT("Failure to look up inner map for text section %lx", (unsigned long)exe_id); + DEBUG_PRINT("ERR imap %lx", (unsigned long)exe_id); state->error_metric = metricID_UnwindNativeErrLookupStackDeltaInnerMap; return ERR_NATIVE_LOOKUP_STACK_DELTA_INNER_MAP; } @@ -114,11 +106,7 @@ static EBPF_INLINE ErrorCode get_stack_delta(UnwindState *state, int *addrDiff, u32 lo = info->firstDelta; u32 hi = lo + info->numDeltas; - DEBUG_PRINT( - "Intervals should be from %lu to %lu (mapID %d)", - (unsigned long)lo, - (unsigned long)hi, - (int)info->mapID); + DEBUG_PRINT("bs %lu-%lu m=%d", (unsigned long)lo, (unsigned long)hi, (int)info->mapID); // Do the binary search, up to 16 iterations. Deltas are paged to 64kB pages. // They can contain at most 64kB deltas even if everything is single byte opcodes. @@ -129,7 +117,7 @@ static EBPF_INLINE ErrorCode get_stack_delta(UnwindState *state, int *addrDiff, } } if (i >= 16 || hi == 0) { - DEBUG_PRINT("Failed bsearch in 16 steps. Corrupt data?"); + DEBUG_PRINT("ERR bs16"); state->error_metric = metricID_UnwindNativeErrLookupIterations; return ERR_NATIVE_EXCEEDED_DELTA_LOOKUP_ITERATIONS; } @@ -149,8 +137,7 @@ static EBPF_INLINE ErrorCode get_stack_delta(UnwindState *state, int *addrDiff, return ERR_NATIVE_LOOKUP_RANGE; } - DEBUG_PRINT( - "delta index %d, addrLow 0x%x, unwindInfo %d", idx, delta->addrLow, delta->unwindInfo); + DEBUG_PRINT("d %d a=%x u=%d", idx, delta->addrLow, delta->unwindInfo); // Calculate PC delta from stack delta for merged delta comparison int deltaOffset = (int)page_offset - (int)delta->addrLow; @@ -168,10 +155,6 @@ static EBPF_INLINE ErrorCode get_stack_delta(UnwindState *state, int *addrDiff, state->error_metric = metricID_UnwindNativeErrStackDeltaInvalid; return ERR_NATIVE_STACK_DELTA_INVALID; } - if (delta->unwindInfo == STACK_DELTA_STOP) { - increment_metric(metricID_UnwindNativeStackDeltaStop); - } - return ERR_OK; } @@ -209,7 +192,7 @@ unwind_calc_register_with_deref(UnwindState *state, u8 baseReg, s32 param, bool // Dereference, and add the postDereference adder. unsigned long val; if (bpf_probe_read_user(&val, sizeof(val), (void *)addr)) { - DEBUG_PRINT("unwind failed to dereference address 0x%lx", (unsigned long)addr); + DEBUG_PRINT("ERR deref %lx", (unsigned long)addr); return 0; } // Return: "*(BASE + preDeref) + postDeref" @@ -257,7 +240,7 @@ static EBPF_INLINE ErrorCode unwind_one_frame(PerCPURecord *record, bool *stop) // This is the hard coded implementation of this expression. For further details, // see https://hal.inria.fr/hal-02297690/document, page 4. (DOI: 10.1145/3360572) cfa = state->sp + 8 + ((((state->pc & 15) >= 11) ? 1 : 0) << 3); - // DEBUG_PRINT("PLT, cfa=0x%lx", (unsigned long)cfa); + DEBUG_PRINT("PLT %lx", (unsigned long)cfa); break; case UNWIND_COMMAND_SIGNAL: { // Use the PerCPURecord scratch union instead of a stack-local buffer to avoid @@ -280,10 +263,13 @@ static EBPF_INLINE ErrorCode unwind_one_frame(PerCPURecord *record, bool *stop) state->pc = rt_regs[16]; state->return_address = false; - // DEBUG_PRINT("signal frame"); + DEBUG_PRINT("sigf"); goto frame_ok; } - case UNWIND_COMMAND_STOP: *stop = true; return ERR_OK; + case UNWIND_COMMAND_STOP: + increment_metric(metricID_UnwindNativeStackDeltaStop); + *stop = true; + return ERR_OK; case UNWIND_COMMAND_FRAME_POINTER: if (!unwinder_unwind_frame_pointer(state)) { goto err_native_pc_read; @@ -305,10 +291,10 @@ static EBPF_INLINE ErrorCode unwind_one_frame(PerCPURecord *record, bool *stop) s32 param = info->param; if (info->mergeOpcode) { - // DEBUG_PRINT("AddrDiff %d, merged delta %#02x", addrDiff, info->mergeOpcode); + DEBUG_PRINT("ad=%d md=%x", addrDiff, info->mergeOpcode); if (addrDiff >= (info->mergeOpcode & ~MERGEOPCODE_NEGATIVE)) { param += (info->mergeOpcode & MERGEOPCODE_NEGATIVE) ? -8 : 8; - // DEBUG_PRINT("Merged delta match: cfaDelta=%d", unwindInfo); + DEBUG_PRINT("mdm cfa=%d", unwindInfo); } } @@ -380,10 +366,13 @@ static EBPF_INLINE ErrorCode unwind_one_frame(struct PerCPURecord *record, bool state->return_address = false; state->lr_invalid = false; - DEBUG_PRINT("signal frame"); + DEBUG_PRINT("sigf"); goto frame_ok; } - case UNWIND_COMMAND_STOP: *stop = true; return ERR_OK; + case UNWIND_COMMAND_STOP: + increment_metric(metricID_UnwindNativeStackDeltaStop); + *stop = true; + return ERR_OK; case UNWIND_COMMAND_FRAME_POINTER: if (!unwinder_unwind_frame_pointer(state)) { goto err_native_pc_read; @@ -401,16 +390,16 @@ static EBPF_INLINE ErrorCode unwind_one_frame(struct PerCPURecord *record, bool UnwindInfo *info = bpf_map_lookup_elem(&unwind_info_array, &unwindInfo); if (!info) { increment_metric(metricID_UnwindNativeErrBadUnwindInfoIndex); - DEBUG_PRINT("Giving up due to invalid unwind info array index"); + DEBUG_PRINT("ERR uwi idx"); return ERR_NATIVE_BAD_UNWIND_INFO_INDEX; } s32 param = info->param; if (info->mergeOpcode) { - DEBUG_PRINT("AddrDiff %d, merged delta %#02x", addrDiff, info->mergeOpcode); + DEBUG_PRINT("ad=%d md=%x", addrDiff, info->mergeOpcode); if (addrDiff >= (info->mergeOpcode & ~MERGEOPCODE_NEGATIVE)) { param += (info->mergeOpcode & MERGEOPCODE_NEGATIVE) ? -8 : 8; - DEBUG_PRINT("Merged delta match: cfaDelta=%d", unwindInfo); + DEBUG_PRINT("mdm cfa=%d", unwindInfo); } } @@ -428,7 +417,7 @@ static EBPF_INLINE ErrorCode unwind_one_frame(struct PerCPURecord *record, bool increment_metric(metricID_UnwindNativeErrPCRead); } // report failure to resolve RA and stop unwinding - DEBUG_PRINT("Giving up due to failure to resolve RA"); + DEBUG_PRINT("ERR RA"); return ERR_NATIVE_PC_READ; } diff --git a/support/ebpf/python_tracer.ebpf.c b/support/ebpf/python_tracer.ebpf.c index 005ae3229..8b1b8db40 100644 --- a/support/ebpf/python_tracer.ebpf.c +++ b/support/ebpf/python_tracer.ebpf.c @@ -64,7 +64,8 @@ static EBPF_INLINE ErrorCode process_python_frame( // Read PyFrameObject if (bpf_probe_read_user(pss->frame, sizeof(pss->frame), py_frameobject)) { - // DEBUG_PRINT("Failed to read PyFrameObject 0x%lx", (unsigned long)py_frameobject); + DEBUG_PRINT( + "E%d %lx", metricID_UnwindPythonErrBadFrameCodeObjectAddr, (unsigned long)py_frameobject); increment_metric(metricID_UnwindPythonErrBadFrameCodeObjectAddr); return ERR_PYTHON_BAD_FRAME_OBJECT_ADDR; } @@ -119,10 +120,10 @@ static EBPF_INLINE ErrorCode process_python_frame( } if (!py_codeobject) { - // DEBUG_PRINT( - // "Null codeobject for PyFrameObject 0x%lx 0x%lx", - // (unsigned long)py_frameobject, - // (unsigned long)(py_frameobject + pyinfo->PyFrameObject_f_code)); + DEBUG_PRINT( + "E%d %lx", + metricID_UnwindPythonZeroFrameCodeObject, + (unsigned long)(py_frameobject + pyinfo->PyFrameObject_f_code)); increment_metric(metricID_UnwindPythonZeroFrameCodeObject); goto push_frame; } @@ -139,9 +140,8 @@ static EBPF_INLINE ErrorCode process_python_frame( // Read PyCodeObject long pycode_err = bpf_probe_read_user(pss->code, sizeof(pss->code), py_codeobject); if (pycode_err) { - // DEBUG_PRINT( - // "Failed to read PyCodeObject at 0x%lx err=%ld", (unsigned long)(py_codeobject), - // pycode_err); + DEBUG_PRINT( + "E%d %lx", metricID_UnwindPythonErrBadCodeObjectArgCountAddr, (unsigned long)(py_codeobject)); increment_metric(metricID_UnwindPythonErrBadCodeObjectArgCountAddr); // Push the frame with the code object address so the agent can try to // read it via /proc/pid/mem (which supports page faults unlike BPF). @@ -163,10 +163,10 @@ static EBPF_INLINE ErrorCode process_python_frame( lineno = py_encode_lineno(codeobject_id, (u32)py_f_lasti); push_frame: - DEBUG_PRINT("Pushing Python %lx %lu", (unsigned long)file_id, (unsigned long)lineno); + DEBUG_PRINT("py+ %lx %lu", (unsigned long)file_id, (unsigned long)lineno); ErrorCode error = push_python(&record->state, trace, file_id, lineno); if (error) { - DEBUG_PRINT("failed to push python frame"); + DEBUG_PRINT("ERR py+"); return error; } increment_metric(metricID_UnwindPythonFrames); @@ -184,7 +184,8 @@ static EBPF_INLINE ErrorCode get_PyThreadState( if (pyinfo->tls_offset != 0) { if (bpf_probe_read_user(thread_state, sizeof(void *), tsd_base + pyinfo->tls_offset)) { DEBUG_PRINT( - "Failed to read direct TLS at base 0x%lx offset %d", + "E%d %lx %d", + metricID_UnwindPythonErrReadThreadStateAddr, (unsigned long)tsd_base, pyinfo->tls_offset); increment_metric(metricID_UnwindPythonErrReadThreadStateAddr); @@ -196,7 +197,8 @@ static EBPF_INLINE ErrorCode get_PyThreadState( // Python 3.12 and earlier: use pthread TLS int key; if (bpf_probe_read_user(&key, sizeof(key), autoTLSkeyAddr)) { - DEBUG_PRINT("Failed to read autoTLSkey from 0x%lx", (unsigned long)autoTLSkeyAddr); + DEBUG_PRINT( + "E%d %lx", metricID_UnwindPythonErrBadAutoTlsKeyAddr, (unsigned long)autoTLSkeyAddr); increment_metric(metricID_UnwindPythonErrBadAutoTlsKeyAddr); return ERR_PYTHON_BAD_AUTO_TLS_KEY_ADDR; } @@ -213,14 +215,11 @@ static EBPF_INLINE ErrorCode get_PyFrame(const PyProcInfo *pyinfo, void **frame) { void *tsd_base; if (tsd_get_base(&tsd_base)) { - DEBUG_PRINT("Failed to get TSD base address"); + DEBUG_PRINT("E%d", metricID_UnwindPythonErrReadTsdBase); increment_metric(metricID_UnwindPythonErrReadTsdBase); return ERR_PYTHON_READ_TSD_BASE; } - DEBUG_PRINT( - "TSD Base 0x%lx, autoTLSKeyAddr 0x%lx", - (unsigned long)tsd_base, - (unsigned long)pyinfo->autoTLSKeyAddr); + DEBUG_PRINT("TSD %lx akey %lx", (unsigned long)tsd_base, (unsigned long)pyinfo->autoTLSKeyAddr); // Get the PyThreadState from TSD void *py_tsd_thread_state; @@ -231,7 +230,7 @@ static EBPF_INLINE ErrorCode get_PyFrame(const PyProcInfo *pyinfo, void **frame) } if (!py_tsd_thread_state) { - DEBUG_PRINT("PyThreadState is 0x0"); + DEBUG_PRINT("E%d", metricID_UnwindPythonErrZeroThreadState); increment_metric(metricID_UnwindPythonErrZeroThreadState); return ERR_PYTHON_ZERO_THREAD_STATE; } @@ -240,7 +239,8 @@ static EBPF_INLINE ErrorCode get_PyFrame(const PyProcInfo *pyinfo, void **frame) if (bpf_probe_read_user( frame, sizeof(void *), py_tsd_thread_state + pyinfo->PyThreadState_frame)) { DEBUG_PRINT( - "Failed to read PyThreadState.frame at 0x%lx", + "E%d %lx", + metricID_UnwindPythonErrBadThreadStateFrameAddr, (unsigned long)(py_tsd_thread_state + pyinfo->PyThreadState_frame)); increment_metric(metricID_UnwindPythonErrBadThreadStateFrameAddr); return ERR_PYTHON_BAD_THREAD_STATE_FRAME_ADDR; @@ -249,7 +249,8 @@ static EBPF_INLINE ErrorCode get_PyFrame(const PyProcInfo *pyinfo, void **frame) if (pyinfo->frame_is_cframe) { if (bpf_probe_read_user(frame, sizeof(void *), *frame + pyinfo->PyCFrame_current_frame)) { DEBUG_PRINT( - "Failed to read _PyCFrame.current_frame at 0x%lx", + "E%d %lx", + metricID_UnwindPythonErrBadCFrameFrameAddr, (unsigned long)(*frame + pyinfo->PyCFrame_current_frame)); increment_metric(metricID_UnwindPythonErrBadCFrameFrameAddr); return ERR_PYTHON_BAD_CFRAME_CURRENT_FRAME_ADDR; @@ -328,18 +329,18 @@ static EBPF_INLINE int unwind_python(struct pt_regs *ctx) Trace *trace = &record->trace; u32 pid = trace->pid; - DEBUG_PRINT("unwind_python()"); + DEBUG_PRINT("upy"); const PyProcInfo *pyinfo = bpf_map_lookup_elem(&py_procs, &pid); if (!pyinfo) { // Not a Python process that we have info on - DEBUG_PRINT("Can't build Python stack, no address info"); + DEBUG_PRINT("E%d", metricID_UnwindPythonErrNoProcInfo); increment_metric(metricID_UnwindPythonErrNoProcInfo); error = ERR_PYTHON_NO_PROC_INFO; goto exit; } - DEBUG_PRINT("Building Python stack for 0x%x", pyinfo->version); + DEBUG_PRINT("py v=%x", pyinfo->version); if (!record->pythonUnwindState.py_frame) { increment_metric(metricID_UnwindPythonAttempts); error = get_PyFrame(pyinfo, &record->pythonUnwindState.py_frame); @@ -348,7 +349,7 @@ static EBPF_INLINE int unwind_python(struct pt_regs *ctx) } } if (!record->pythonUnwindState.py_frame) { - DEBUG_PRINT(" -> Python frames are handled"); + DEBUG_PRINT("py done"); unwinder_mark_done(record, PROG_UNWIND_PYTHON); goto exit; } diff --git a/support/ebpf/tracemgmt.h b/support/ebpf/tracemgmt.h index 37c36335b..067b350f5 100644 --- a/support/ebpf/tracemgmt.h +++ b/support/ebpf/tracemgmt.h @@ -151,7 +151,7 @@ static inline EBPF_INLINE bool pid_event_ratelimit(u32 pid, int ratelimit_action int err = bpf_map_update_elem(&reported_pids, &pid, &token, BPF_ANY); if (err != 0) { // Should never happen - DEBUG_PRINT("Failed to report PID %d: %d", pid, err); + DEBUG_PRINT("E%d %d %d", metricID_ReportedPIDsErr, pid, err); increment_metric(metricID_ReportedPIDsErr); return true; } @@ -174,8 +174,7 @@ static inline EBPF_INLINE bool report_pid(void *ctx, u64 pid_tgid, int ratelimit bool value = true; int errNo = bpf_map_update_elem(&pid_events, &pid_tgid, &value, BPF_ANY); if (errNo != 0) { - __attribute__((unused)) u32 tid = pid_tgid & 0xFFFFFFFF; - DEBUG_PRINT("Failed to update pid_events with PID %d TID: %d: %d", pid, tid, errNo); + DEBUG_PRINT("E%d %d %d", metricID_PIDEventsErr, pid, errNo); increment_metric(metricID_PIDEventsErr); return false; } @@ -302,19 +301,19 @@ static inline EBPF_INLINE bool unwinder_unwind_go_morestack(PerCPURecord *record { GoLabelsOffsets *offs = bpf_map_lookup_elem(&go_labels_procs, &record->trace.pid); if (!offs) { - DEBUG_PRINT("morestack: failed to read go labels offsets"); + DEBUG_PRINT("ERR ms golbl"); return false; } void *mptr = get_go_m_ptr(offs, &record->state); - DEBUG_PRINT("morestack: curg offset: %d, mptr: %llx\n", offs->curg, (u64)mptr); + DEBUG_PRINT("ms c=%d m=%llx", offs->curg, (u64)mptr); size_t curg_ptr_addr; if (bpf_probe_read_user(&curg_ptr_addr, sizeof(void *), (void *)((u64)mptr + offs->curg))) { - DEBUG_PRINT("morestack: failed to read value for m_ptr->curg"); + DEBUG_PRINT("ERR ms m->curg"); return false; } - DEBUG_PRINT("morestack: curg is %lx\n", curg_ptr_addr); + DEBUG_PRINT("ms curg=%lx", curg_ptr_addr); // Valid since go 1.25: // https://github.com/golang/go/blob/7b60d06739/src/runtime/runtime2.go#L303-L322 @@ -322,17 +321,13 @@ static inline EBPF_INLINE bool unwinder_unwind_go_morestack(PerCPURecord *record // TODO - make this work on earlier versions. unsigned long regs[6]; if (bpf_probe_read_user(regs, sizeof(regs), (void *)(curg_ptr_addr + 56 /* XXX */))) { - DEBUG_PRINT("morestack: failed to read regs"); + DEBUG_PRINT("ERR ms regs"); return false; } record->state.sp = regs[0]; record->state.pc = regs[1]; record->state.fp = regs[5]; - DEBUG_PRINT( - "morestack: success, sp is %llx, pc is %llx, fp is %llx", - record->state.sp, - record->state.pc, - record->state.fp); + DEBUG_PRINT("ms sp=%llx pc=%llx fp=%llx", record->state.sp, record->state.pc, record->state.fp); return true; } @@ -435,7 +430,7 @@ static inline EBPF_INLINE ErrorCode resolve_unwind_mapping(PerCPURecord *record, if (is_kernel_address(pc)) { // This should not happen as we should only be unwinding usermode stacks. // Seeing PC point to a kernel address indicates a bad unwind. - DEBUG_PRINT("PC value %lx is a kernel address", (unsigned long)pc); + DEBUG_PRINT("kern %lx", (unsigned long)pc); state->error_metric = metricID_UnwindNativeErrKernelAddress; return ERR_NATIVE_UNEXPECTED_KERNEL_ADDRESS; } @@ -445,7 +440,7 @@ static inline EBPF_INLINE ErrorCode resolve_unwind_mapping(PerCPURecord *record, // above the value defined in /proc/sys/vm/mmap_min_addr. // As such small PC values happens regularly (e.g. by handling or extracting the // PC value incorrectly) we track them but don't proceed with unwinding. - DEBUG_PRINT("small pc value %lx, ignoring", (unsigned long)pc); + DEBUG_PRINT("lo pc %lx", (unsigned long)pc); state->error_metric = metricID_UnwindNativeSmallPC; return ERR_NATIVE_SMALL_PC; } @@ -458,7 +453,7 @@ static inline EBPF_INLINE ErrorCode resolve_unwind_mapping(PerCPURecord *record, // Check if we have the data for this virtual address PIDPageMappingInfo *val = bpf_map_lookup_elem(&pid_page_to_mapping_info, &key); if (!val) { - DEBUG_PRINT("Failure to look up interval memory mapping for PC 0x%lx", (unsigned long)pc); + DEBUG_PRINT("ERR mmap %lx", (unsigned long)pc); state->error_metric = metricID_UnwindNativeErrWrongTextSection; return ERR_NATIVE_NO_PID_PAGE_MAPPING; } @@ -467,15 +462,8 @@ static inline EBPF_INLINE ErrorCode resolve_unwind_mapping(PerCPURecord *record, state->text_section_id = val->file_id; state->text_section_offset = pc - state->text_section_bias; - DEBUG_PRINT( - "Text section id for PC %lx is %llx (unwinder %d)", - (unsigned long)pc, - state->text_section_id, - *unwinder); - DEBUG_PRINT( - "Text section bias is %llx, and offset is %llx", - state->text_section_bias, - state->text_section_offset); + DEBUG_PRINT("ts %lx=%llx u=%d", (unsigned long)pc, state->text_section_id, *unwinder); + DEBUG_PRINT("bias=%llx off=%llx", state->text_section_bias, state->text_section_offset); return ERR_OK; } @@ -503,12 +491,12 @@ static inline EBPF_INLINE int get_next_interpreter(PerCPURecord *record) OffsetRange *range = bpf_map_lookup_elem(&interpreter_offsets, §ion_id); if (range != 0) { if (matches_interpreter_range(section_offset, range)) { - DEBUG_PRINT("interpreter_offsets match %d", range->program_index); + DEBUG_PRINT("ioff m=%d", range->program_index); if (!unwinder_is_done(record, range->program_index)) { increment_metric(metricID_UnwindCallInterpreter); return range->program_index; } - DEBUG_PRINT("interpreter unwinder done"); + DEBUG_PRINT("interp done"); } } return PROG_UNWIND_NATIVE; @@ -523,12 +511,12 @@ get_next_unwinder_after_native_frame(PerCPURecord *record, int *unwinder) *unwinder = PROG_UNWIND_STOP; if (state->pc == 0) { - DEBUG_PRINT("Stopping unwind due to unwind failure (PC == 0)"); + DEBUG_PRINT("pc=0 stop"); state->error_metric = metricID_UnwindErrZeroPC; return ERR_NATIVE_ZERO_PC; } - DEBUG_PRINT("==== Resolve next frame unwinder: frame %d ====", record->trace.num_frames); + DEBUG_PRINT("nxt f=%d", record->trace.num_frames); ErrorCode error = resolve_unwind_mapping(record, unwinder); if (error) { return error; diff --git a/support/ebpf/tracer.ebpf.amd64 b/support/ebpf/tracer.ebpf.amd64 index 27e2c91db..53679bef3 100644 Binary files a/support/ebpf/tracer.ebpf.amd64 and b/support/ebpf/tracer.ebpf.amd64 differ diff --git a/support/ebpf/tracer.ebpf.arm64 b/support/ebpf/tracer.ebpf.arm64 index 402ce810f..603e98262 100644 Binary files a/support/ebpf/tracer.ebpf.arm64 and b/support/ebpf/tracer.ebpf.arm64 differ diff --git a/support/ebpf/tsd.h b/support/ebpf/tsd.h index 7d2e7f47a..e059afa86 100644 --- a/support/ebpf/tsd.h +++ b/support/ebpf/tsd.h @@ -22,14 +22,14 @@ tsd_read(const TSDInfo *tsi, const void *tsd_base, int key, void **out) tsd_addr += key * tsi->multiplier; - DEBUG_PRINT("readTSD key %d from address 0x%lx", key, (unsigned long)tsd_addr); + DEBUG_PRINT("tsd %d %lx", key, (unsigned long)tsd_addr); if (bpf_probe_read_user(out, sizeof(*out), tsd_addr)) { goto err; } return 0; err: - DEBUG_PRINT("Failed to read TSD from 0x%lx", (unsigned long)tsd_addr); + DEBUG_PRINT("E%d %lx", metricID_UnwindErrBadTSDAddr, (unsigned long)tsd_addr); increment_metric(metricID_UnwindErrBadTSDAddr); return -1; } @@ -50,7 +50,7 @@ static inline EBPF_INLINE int tsd_get_base(void **tsd_base) // relative to a `task_struct`, so we use that instead. void *tpbase_ptr = ((char *)task) + tpbase_offset; if (bpf_probe_read_kernel(tsd_base, sizeof(void *), tpbase_ptr)) { - DEBUG_PRINT("Failed to read tpbase value"); + DEBUG_PRINT("E%d", metricID_UnwindErrBadTPBaseAddr); increment_metric(metricID_UnwindErrBadTPBaseAddr); return -1; } diff --git a/support/ebpf/util.h b/support/ebpf/util.h index 19e2918cf..319725aff 100644 --- a/support/ebpf/util.h +++ b/support/ebpf/util.h @@ -14,7 +14,7 @@ static inline EBPF_INLINE void increment_metric(u32 metricID) if (count) { ++*count; } else { - // DEBUG_PRINT("Failed to lookup metrics map for metricID %d", metricID); + DEBUG_PRINT("badmet%d", metricID); } }