Skip to main content

DwarfAnalyzer

Struct DwarfAnalyzer 

Source
pub struct DwarfAnalyzer { /* private fields */ }
Expand description

DWARF analyzer - unified entry point for all DWARF analysis

Implementations§

Source§

impl DwarfAnalyzer

Source

pub fn module_paths(&self) -> Vec<PathBuf>

Return loaded module paths in deterministic order.

Source

pub fn module_paths_equivalent<P: AsRef<Path>, Q: AsRef<Path>>( left: P, right: Q, ) -> bool

Treat identical paths and symlink aliases that canonicalize to the same file as the same loaded module.

Source

pub fn module_spec_matches_path<P: AsRef<Path>>( module_path: P, module_spec: &str, ) -> bool

Match a user-provided module spec against a loaded path by exact path, symlink equivalence, or unique suffix.

Source

pub fn resolve_loaded_module_by_spec( &self, module_spec: &str, ) -> Result<PathBuf>

Resolve a module spec against all loaded modules.

Source

pub fn resolve_target_module_path(&self, target_path: &str) -> Result<PathBuf>

Resolve the configured -t path to the corresponding loaded module.

Source

pub fn resolve_module_spec( &self, module_spec: &str, target_path: Option<&str>, ) -> Result<PathBuf>

Resolve an explicit module spec, respecting -t scoping when configured.

Source

pub fn resolve_address_module( &self, module_spec: Option<&str>, target_path: Option<&str>, fallback: ModuleDefaultPolicy, ) -> Result<PathBuf>

Resolve the module to use for a module-relative address query.

Source

pub fn filter_module_addresses_to_target( &self, module_addresses: Vec<ModuleAddress>, target_path: Option<&str>, ) -> Result<Vec<ModuleAddress>>

Filter module-address matches to the configured -t target.

Source

pub fn filter_address_results_to_target( &self, addresses: Vec<AddressQueryResult>, target_path: Option<&str>, ) -> Result<Vec<AddressQueryResult>>

Filter address-query matches to the configured -t target.

Source§

impl DwarfAnalyzer

Source

pub fn find_global_variables_by_name( &self, name: &str, ) -> Vec<(PathBuf, GlobalVariableInfo)>

Find global/static variables by name across all loaded modules

Source

pub fn plan_global_access_read_plan( &self, prefer_module: &PathBuf, base: &str, path: &VariableAccessPath, ) -> Result<Option<(PathBuf, VariableReadPlan)>>

Plan a global/static source-level access path as a neutral read plan.

Source

pub fn list_all_global_variables(&self) -> Vec<(PathBuf, GlobalVariableInfo)>

List all global/static variables with usable addresses across all loaded modules

Source§

impl DwarfAnalyzer

Source

pub fn resolve_pc(&self, module_address: &ModuleAddress) -> Result<PcContext>

Resolve a module-address pair into the first PC-centered semantic context.

Today ModuleAddress.address is the module/DWARF PC used by the existing query APIs, so pc and normalized_pc intentionally match. Runtime rebasing details are preserved in address_space for future lowering.

Source

pub fn visible_variables(&self, ctx: &PcContext) -> Result<Vec<VisibleVariable>>

Return variables visible at a previously resolved PC context.

Source

pub fn function_parameters( &self, ctx: &PcContext, ) -> Result<Vec<FunctionParameter>>

Return only function formal parameters for display.

This does not evaluate locations, compute frame-base/CFA, or resolve visible lexical variables. It is intended for inexpensive function signature rendering in hot paths such as backtrace output.

Source

pub fn visible_variables_with_diagnostics( &self, ctx: &PcContext, ) -> Result<VisibleVariablesResult>

Return variables visible at a PC context plus non-fatal DWARF diagnostics.

Source

pub fn plan_variable_by_name( &self, ctx: &PcContext, name: &str, ) -> Result<Option<VariableReadPlan>>

Plan a visible variable by source name at a previously resolved PC context.

Exact names are preferred over producer-synthesized names like name@....

Source

pub fn plan_variable( &self, ctx: &PcContext, variable_id: VariableId, ) -> Result<Option<VariableReadPlan>>

Plan a visible variable by stable variable id at a previously resolved PC context.

This is the identity-based path for callers that first enumerate visible_variables(ctx) and then request a read plan without relying on a potentially ambiguous source name.

Source

pub fn plan_variable_access( &self, ctx: &PcContext, variable_id: VariableId, path: &VariableAccessPath, ) -> Result<Option<VariableReadPlan>>

Plan a source-level access path from a visible variable id at a PC context.

Source

pub fn plan_variable_access_by_name( &self, ctx: &PcContext, name: &str, path: &VariableAccessPath, ) -> Result<Option<VariableReadPlan>>

Plan a source-level access path from a visible variable at a PC context.

Source§

impl DwarfAnalyzer

Source

pub fn source_line_candidates(&self, file_path: &str) -> Vec<String>

Build DWARF source path candidates for a user-provided file path.

This keeps DWARF path matching rules in the analyzer: exact paths first, then component-boundary suffix matches, then unique basename matches for bare filenames, and finally the original query.

Source

pub fn resolve_source_line_addresses_best_effort<I, S>( &self, candidates: I, line_number: u32, target_path: Option<&str>, ) -> Result<SourceLineAddressSearch>
where I: IntoIterator<Item = S>, S: AsRef<str>,

Probe source-line candidates until a candidate resolves to addresses.

If a candidate resolves before target filtering but all addresses are filtered out, the first filtered match is returned with an empty address list so callers can produce a target-scoped error.

Source

pub fn resolve_source_line_query_best_effort<I, S>( &self, candidates: I, line_number: u32, target_path: Option<&str>, ) -> Result<SourceLineQuerySearch>
where I: IntoIterator<Item = S>, S: AsRef<str>,

Probe source-line candidates and return rich debug information for the first candidate with address results.

Source

pub fn describe_source_line_failure( &self, file_path: &str, line_number: u32, ) -> String

Explain why a source-line lookup did not resolve to executable addresses.

Source§

impl DwarfAnalyzer

Source

pub fn resolve_builtin_type_spec(type_spec: &str) -> Option<TypeInfo>

Source

pub fn resolve_type_spec_in_module<P: AsRef<Path>>( &self, module_path: P, type_spec: &str, ) -> Option<TypeInfo>

Source

pub fn try_resolve_type_spec_in_module<P: AsRef<Path>>( &self, module_path: P, type_spec: &str, ) -> Result<Option<TypeInfo>, TypeLookupAmbiguity>

Source

pub fn resolve_type_spec(&self, type_spec: &str) -> Option<TypeInfo>

Source

pub fn try_resolve_type_spec( &self, type_spec: &str, ) -> Result<Option<TypeInfo>, TypeLookupAmbiguity>

Source

pub fn complete_shallow_unknown_aggregate_type_in_module<P: AsRef<Path>>( &self, module_path: P, ty: TypeInfo, ) -> TypeInfo

Source

pub fn complete_shallow_unknown_aggregate_type(&self, ty: TypeInfo) -> TypeInfo

Source

pub fn resolve_struct_type_shallow_by_name_in_module<P: AsRef<Path>>( &self, module_path: P, name: &str, ) -> Option<TypeInfo>

Resolve struct/class by name (shallow) in a specific module using only indexes

Source

pub fn resolve_struct_type_shallow_by_name( &self, name: &str, ) -> Option<TypeInfo>

Resolve struct/class by name (shallow) across modules (first match)

Source

pub fn resolve_union_type_shallow_by_name_in_module<P: AsRef<Path>>( &self, module_path: P, name: &str, ) -> Option<TypeInfo>

Resolve union by name (shallow) in a specific module

Source

pub fn resolve_union_type_shallow_by_name(&self, name: &str) -> Option<TypeInfo>

Resolve union by name (shallow) across modules (first match)

Source

pub fn resolve_enum_type_shallow_by_name_in_module<P: AsRef<Path>>( &self, module_path: P, name: &str, ) -> Option<TypeInfo>

Resolve enum by name (shallow) in a specific module

Source

pub fn resolve_enum_type_shallow_by_name(&self, name: &str) -> Option<TypeInfo>

Resolve enum by name (shallow) across modules (first match)

Source§

impl DwarfAnalyzer

Source

pub fn module_id_for_path<P: AsRef<Path>>( &self, module_path: P, ) -> Option<ModuleId>

Return the deterministic per-analyzer module id for a loaded module path.

Source

pub fn module_path_for_id(&self, module: ModuleId) -> Option<&Path>

Resolve a semantic module id back to its loaded module path.

Source

pub async fn from_pid(pid: u32) -> Result<Self>

Create DWARF analyzer from PID (now uses parallel loading)

Source

pub fn is_inline_at(&self, module_address: &ModuleAddress) -> Option<bool>

Classify whether an address is inside an inlined subroutine instance Returns Some(true) if inline, Some(false) if a normal (non-inline) context, or None if the module/address cannot be resolved.

Source

pub async fn from_pid_parallel(pid: u32) -> Result<Self>

Create DWARF analyzer from PID using parallel loading

Source

pub async fn from_pid_parallel_with_progress<F>( pid: u32, progress_callback: F, ) -> Result<Self>
where F: Fn(ModuleLoadingEvent) + Send + Sync + 'static,

Create DWARF analyzer from PID using parallel loading with progress callback

Source

pub async fn from_pid_parallel_with_config<F>( pid: u32, debug_search_paths: &[String], allow_loose_debug_match: bool, progress_callback: F, ) -> Result<Self>
where F: Fn(ModuleLoadingEvent) + Send + Sync + 'static,

Create DWARF analyzer from PID using parallel loading with debug search paths and progress callback

Source

pub async fn from_pid_parallel_with_config_and_debuginfod<F>( pid: u32, debug_search_paths: &[String], allow_loose_debug_match: bool, debuginfod_client: Option<Arc<DebuginfodClient>>, progress_callback: F, ) -> Result<Self>
where F: Fn(ModuleLoadingEvent) + Send + Sync + 'static,

Create DWARF analyzer from PID with debug search paths, debuginfod, and progress callback.

Source

pub fn discover_pid_runtime_modules( pid: u32, ) -> Result<Vec<LoadedModuleRuntimeInfo>>

Discover runtime module mappings for a PID.

Source

pub fn runtime_modules_from_pid_offsets( entries: &[PidOffsetsEntry], ) -> Vec<LoadedModuleRuntimeInfo>

Convert cached process offsets into one runtime mapping per module path.

Source

pub async fn refresh_pid_runtime_modules_with_config_and_debuginfod<F>( &mut self, runtime_modules: Vec<LoadedModuleRuntimeInfo>, debug_search_paths: &[String], allow_loose_debug_match: bool, debuginfod_client: Option<Arc<DebuginfodClient>>, progress_callback: F, ) -> Result<usize>
where F: Fn(ModuleLoadingEvent) + Send + Sync + 'static,

Load newly discovered modules into an existing PID analyzer.

Source

pub async fn from_pid_runtime_modules_with_config_and_debuginfod<F>( pid: u32, runtime_modules: Vec<LoadedModuleRuntimeInfo>, debug_search_paths: &[String], allow_loose_debug_match: bool, debuginfod_client: Option<Arc<DebuginfodClient>>, progress_callback: F, ) -> Result<Self>
where F: Fn(ModuleLoadingEvent) + Send + Sync + 'static,

Create DWARF analyzer from an already discovered PID runtime module snapshot.

Source

pub async fn from_pid_runtime_modules_with_config_debuginfod_and_explicit_debug_file<F>( pid: u32, runtime_modules: Vec<LoadedModuleRuntimeInfo>, debug_search_paths: &[String], allow_loose_debug_match: bool, debuginfod_client: Option<Arc<DebuginfodClient>>, explicit_debug_file: Option<ExplicitDebugFile>, progress_callback: F, ) -> Result<Self>
where F: Fn(ModuleLoadingEvent) + Send + Sync + 'static,

Create DWARF analyzer from an already discovered PID runtime module snapshot, with optional debuginfod and a user-provided debug file for one module.

Source

pub async fn from_exec_path<P: AsRef<Path>>(exec_path: P) -> Result<Self>

Create DWARF analyzer from executable path (single module mode, now async parallel)

Source

pub async fn from_exec_path_with_config<P: AsRef<Path>>( exec_path: P, debug_search_paths: &[String], allow_loose_debug_match: bool, ) -> Result<Self>

Create DWARF analyzer from executable path with debug search paths

Source

pub async fn from_exec_path_with_config_and_debuginfod<P: AsRef<Path>>( exec_path: P, debug_search_paths: &[String], allow_loose_debug_match: bool, debuginfod_client: Option<Arc<DebuginfodClient>>, ) -> Result<Self>

Create DWARF analyzer from executable path with debug search paths and debuginfod.

Source

pub async fn from_exec_path_with_config_and_progress<P, F>( exec_path: P, debug_search_paths: &[String], allow_loose_debug_match: bool, progress_callback: F, ) -> Result<Self>
where P: AsRef<Path>, F: Fn(ModuleLoadingEvent) + Send + Sync + 'static,

Create DWARF analyzer from executable path with debug search paths and progress callback

Source

pub async fn from_exec_path_with_config_and_debuginfod_and_progress<P, F>( exec_path: P, debug_search_paths: &[String], allow_loose_debug_match: bool, debuginfod_client: Option<Arc<DebuginfodClient>>, progress_callback: F, ) -> Result<Self>
where P: AsRef<Path>, F: Fn(ModuleLoadingEvent) + Send + Sync + 'static,

Create DWARF analyzer from executable path with debug search paths, debuginfod, and progress callback.

Source

pub async fn from_exec_path_with_config_debuginfod_explicit_debug_file_and_progress<P, F>( exec_path: P, debug_search_paths: &[String], allow_loose_debug_match: bool, debuginfod_client: Option<Arc<DebuginfodClient>>, explicit_debug_file: Option<PathBuf>, progress_callback: F, ) -> Result<Self>
where P: AsRef<Path>, F: Fn(ModuleLoadingEvent) + Send + Sync + 'static,

Create DWARF analyzer from executable path with debug search paths, debuginfod, an optional explicit debug file, and progress callback.

Source

pub fn lookup_function_addresses(&self, name: &str) -> Vec<ModuleAddress>

Lookup function addresses across all modules Returns: Vec - one for each address where the function is found

Source

pub fn query_function(&self, name: &str) -> Result<FunctionQueryResult>

Query function debug information across all modules.

Source

pub fn query_function_best_effort( &self, name: &str, ) -> Result<FunctionQueryResult>

Query function debug information across all modules, skipping addresses that fail to resolve so callers can still display partial results.

Source

pub fn vaddr_to_file_offset<P: AsRef<Path>>( &self, module_path: P, vaddr: u64, ) -> Option<u64>

Convert a module-relative virtual address (DWARF PC) to an ELF file offset Returns None if the module is unknown or the address is not within a PT_LOAD segment

Source

pub fn recover_caller_frame( &self, module_address: &ModuleAddress, registers: &[u16], ) -> Result<Option<CallerFrameRecovery>>

Recover the direct caller frame at a module address as PlanExprOp[].

Source

pub fn recover_caller_frame_for_context( &self, ctx: &PcContext, registers: &[u16], ) -> Result<Option<CallerFrameRecovery>>

Recover the direct caller frame at a previously resolved PC context.

Source

pub fn compact_unwind_table_for_context( &self, ctx: &PcContext, ) -> Result<Option<Arc<CompactUnwindTable>>>

Build compact unwind rows for the module referenced by a PC context.

Source

pub fn compact_unwind_row_for_context( &self, ctx: &PcContext, ) -> Result<Option<CompactUnwindRow>>

Resolve the compact unwind row that covers a previously resolved PC context.

Source

pub fn compact_unwind_table_for_module( &self, module: ModuleId, ) -> Result<Option<Arc<CompactUnwindTable>>>

Build compact unwind rows for a loaded semantic module id.

Source

pub fn get_loaded_modules(&self) -> Vec<&PathBuf>

Get all loaded module paths

Source

pub fn loaded_module_runtime_info(&self) -> Vec<LoadedModuleRuntimeInfo>

Get loaded module paths with process mapping metadata, when available.

Source

pub fn module_entry_address<P: AsRef<Path>>( &self, module_path: P, ) -> Option<u64>

Get the ELF entry address for a loaded module, when present.

Source

pub fn classify_section_for_address<P: AsRef<Path>>( &self, module_path: P, vaddr: u64, ) -> Option<SectionType>

Classify the section type for a link-time virtual address in a specific module

Source

pub fn lookup_function_address_by_name( &self, function_name: &str, ) -> Option<ModuleAddress>

Lookup function address by name - returns first match Returns ModuleAddress for the first function found

Source

pub fn lookup_source_location( &self, module_address: &ModuleAddress, ) -> Option<SourceLocation>

Lookup source location by module address Returns source location for the given module address

Source

pub fn lookup_addresses_by_source_line( &self, file_path: &str, line_number: u32, ) -> Vec<ModuleAddress>

Lookup addresses by source line (cross-module) Returns: Vec for all matches

Source

pub fn query_source_line( &self, file_path: &str, line_number: u32, ) -> Result<Vec<AddressQueryResult>>

Query source-line debug information across all modules.

Source

pub fn query_source_line_best_effort( &self, file_path: &str, line_number: u32, ) -> Result<Vec<AddressQueryResult>>

Query source-line debug information across all modules, skipping addresses that fail to resolve so callers can still display partial results.

Source

pub fn query_address<P: AsRef<Path>>( &self, module_path: P, address: u64, ) -> Result<AddressQueryResult>

Query a specific address within a module.

Source

pub fn get_all_function_names(&self) -> Vec<String>

Get all function names (cross-module)

Source

pub fn get_stats(&self) -> AnalyzerStats

Get statistics for debugging

Source

pub fn get_module_stats(&self) -> ModuleStats

Get module statistics (compatible with ghostscope-binary’s ModuleStats)

Source

pub fn get_main_executable(&self) -> Option<MainExecutableInfo>

Get main executable module information

Source

pub fn list_functions(&self) -> Vec<String>

Get list of all function names across all modules

Source

pub fn lookup_functions_by_pattern(&self, pattern: &str) -> Vec<String>

Lookup functions by pattern (simplified - exact match only for now)

Source

pub fn lookup_all_function_names(&self) -> Vec<String>

Get all function names (alias for compatibility)

Source

pub fn get_pid(&self) -> u32

Get PID (accessor for private field)

Source

pub fn get_shared_library_info(&self) -> Vec<SharedLibraryInfo>

Get shared library information (compatibility method)

Source

pub fn get_executable_file_info(&self) -> Option<ExecutableFileInfo>

Get executable file information (for “info file” command)

Source

pub fn get_grouped_file_info_by_module( &self, ) -> Result<Vec<(String, Vec<SimpleFileInfo>)>>

Get grouped file info by module (compatibility method)

Trait Implementations§

Source§

impl Debug for DwarfAnalyzer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more