@@ -32,11 +32,18 @@ async fn create_and_attach_loader(
3232 . as_ref ( )
3333 . map ( |c| c. ebpf_config . proc_module_offsets_max_entries as u32 )
3434 . unwrap_or ( 4096 ) ;
35+ let pin_path = ghostscope_process:: maps:: proc_offsets_pin_path ( ) ;
3536 if let Err ( e) = ghostscope_process:: maps:: ensure_pinned_proc_offsets_exists ( max_entries) {
36- warn ! (
37- "Failed to ensure pinned proc_module_offsets map exists ({} entries): {}" ,
38- max_entries, e
37+ error ! (
38+ "Failed to ensure pinned proc_module_offsets map exists at {} ({} entries): {:#}" ,
39+ pin_path. display( ) ,
40+ max_entries,
41+ e
3942 ) ;
43+ return Err ( e. context ( format ! (
44+ "Unable to prepare pinned proc_module_offsets map at {}" ,
45+ pin_path. display( )
46+ ) ) ) ;
4047 }
4148
4249 let mut loader = GhostScopeLoader :: new ( & config. ebpf_bytecode )
@@ -398,14 +405,17 @@ pub async fn compile_and_load_script_for_tui(
398405 }
399406 Err ( e) => {
400407 error ! (
401- "Failed to attach uprobe for trace_id {}: {}" ,
408+ "Failed to attach uprobe for trace_id {}: {:# }" ,
402409 config. assigned_trace_id, e
403410 ) ;
411+ tracing:: info!(
412+ "Attachment hints: check privileges, target binary availability, PID validity, and function addresses if needed."
413+ ) ;
404414 // Update corresponding result to failed
405415 for result in & mut results {
406416 if result. pc_address == config. function_address . unwrap_or ( 0 ) {
407417 result. status =
408- ExecutionStatus :: Failed ( format ! ( "Failed to attach uprobe: {e}" ) ) ;
418+ ExecutionStatus :: Failed ( format ! ( "Failed to attach uprobe: {e:# }" ) ) ;
409419 success_count -= 1 ;
410420 failed_count += 1 ;
411421 break ;
@@ -682,17 +692,16 @@ pub async fn compile_and_load_script_for_cli(
682692 }
683693 Err ( e) => {
684694 error ! (
685- "Failed to attach uprobe for trace_id {}: {}" ,
695+ "Failed to attach uprobe for trace_id {}: {:# }" ,
686696 config. assigned_trace_id, e
687697 ) ;
688- return Err ( anyhow:: anyhow!(
689- "Failed to attach uprobe: {}. Possible reasons: \
690- 1. Need root permissions (run with sudo), \
691- 2. Target binary doesn't exist or lacks debug info, \
692- 3. Process not running or PID invalid, \
693- 4. Function addresses not accessible",
694- e
695- ) ) ;
698+ tracing:: info!(
699+ "Attachment hints: check privileges, target binary availability, PID validity, and function addresses if needed."
700+ ) ;
701+ return Err ( e. context ( format ! (
702+ "Failed to attach uprobe for trace_id {}" ,
703+ config. assigned_trace_id
704+ ) ) ) ;
696705 }
697706 }
698707 }
0 commit comments