Skip to content

Commit

Permalink
Rename AddrSrcInfo -> AddrCodeInfo
Browse files Browse the repository at this point in the history
Rename the internal AddrSrcInfo type to AddrCodeInfo. We use "code" as
opposed to "source" (or "src"), because we already use the latter for
the symbolization source terminology.

Signed-off-by: Daniel Müller <deso@posteo.net>
  • Loading branch information
d-e-s-o committed Sep 12, 2023
1 parent 08e38bb commit ddb90c4
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions src/dwarf/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::elf::ElfParser;
use crate::inspect::FindAddrOpts;
use crate::inspect::SymInfo;
use crate::inspect::SymType;
use crate::symbolize::AddrSrcInfo;
use crate::symbolize::AddrCodeInfo;
use crate::Addr;
use crate::Error;
use crate::IntSym;
Expand Down Expand Up @@ -91,10 +91,10 @@ impl DwarfResolver {
Self::from_parser(Rc::new(parser), debug_line_info, debug_info_symbols)
}

/// Find line information of an address.
/// Find source code information of an address.
///
/// `addr` is a normalized address.
pub fn find_line_info(&self, addr: Addr) -> Result<Option<AddrSrcInfo<'_>>> {
pub fn find_line_info(&self, addr: Addr) -> Result<Option<AddrCodeInfo<'_>>> {
// TODO: This conditional logic is weird and potentially
// unnecessary. Consider removing it or moving it higher
// in the call chain.
Expand All @@ -107,7 +107,7 @@ impl DwarfResolver {
column,
} = location;

AddrSrcInfo {
AddrCodeInfo {
dir,
file,
line,
Expand Down
6 changes: 3 additions & 3 deletions src/elf/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::path::PathBuf;

use crate::inspect::FindAddrOpts;
use crate::inspect::SymInfo;
use crate::symbolize::AddrSrcInfo;
use crate::symbolize::AddrCodeInfo;
use crate::Addr;
use crate::IntSym;
use crate::Result;
Expand Down Expand Up @@ -92,7 +92,7 @@ impl SymResolver for ElfResolver {
}

#[cfg(feature = "dwarf")]
fn find_line_info(&self, addr: Addr) -> Result<Option<AddrSrcInfo<'_>>> {
fn find_line_info(&self, addr: Addr) -> Result<Option<AddrCodeInfo<'_>>> {
if let ElfBackend::Dwarf(dwarf) = &self.backend {
dwarf.find_line_info(addr)
} else {
Expand All @@ -101,7 +101,7 @@ impl SymResolver for ElfResolver {
}

#[cfg(not(feature = "dwarf"))]
fn find_line_info(&self, addr: Addr) -> Result<Option<AddrSrcInfo>> {
fn find_line_info(&self, addr: Addr) -> Result<Option<AddrCodeInfo>> {
Ok(None)
}

Expand Down
8 changes: 4 additions & 4 deletions src/gsym/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::path::PathBuf;
use crate::inspect::FindAddrOpts;
use crate::inspect::SymInfo;
use crate::mmap::Mmap;
use crate::symbolize::AddrSrcInfo;
use crate::symbolize::AddrCodeInfo;
use crate::Addr;
use crate::IntSym;
use crate::IntoError as _;
Expand Down Expand Up @@ -128,9 +128,9 @@ impl SymResolver for GsymResolver<'_> {
///
/// # Returns
///
/// The `AddrSrcInfo` corresponding to the address or `None`.
/// The `AddrCodeInfo` corresponding to the address or `None`.
#[cfg_attr(feature = "tracing", crate::log::instrument(skip(self), fields(file = debug(&self.file_name))))]
fn find_line_info(&self, addr: Addr) -> Result<Option<AddrSrcInfo<'_>>> {
fn find_line_info(&self, addr: Addr) -> Result<Option<AddrCodeInfo<'_>>> {
let idx = match self.ctx.find_addr(addr) {
Some(idx) => idx,
None => return Ok(None),
Expand Down Expand Up @@ -205,7 +205,7 @@ impl SymResolver for GsymResolver<'_> {
.ok_or_invalid_data(|| {
format!("failed to retrieve file name string @ {}", finfo.filename)
})?;
return Ok(Some(AddrSrcInfo {
return Ok(Some(AddrCodeInfo {
dir: Path::new(dir),
file,
line: Some(lntab_row.file_line),
Expand Down
4 changes: 2 additions & 2 deletions src/kernel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::elf::ElfResolver;
use crate::inspect::FindAddrOpts;
use crate::inspect::SymInfo;
use crate::ksym::KSymResolver;
use crate::symbolize::AddrSrcInfo;
use crate::symbolize::AddrCodeInfo;
use crate::Addr;
use crate::Error;
use crate::IntSym;
Expand Down Expand Up @@ -52,7 +52,7 @@ impl SymResolver for KernelResolver {
Ok(Vec::new())
}

fn find_line_info(&self, addr: Addr) -> Result<Option<AddrSrcInfo>> {
fn find_line_info(&self, addr: Addr) -> Result<Option<AddrCodeInfo>> {
if let Some(resolver) = self.elf_resolver.as_ref() {
resolver.find_line_info(addr)
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/ksym.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::rc::Rc;
use crate::inspect::FindAddrOpts;
use crate::inspect::SymInfo;
use crate::inspect::SymType;
use crate::symbolize::AddrSrcInfo;
use crate::symbolize::AddrCodeInfo;
use crate::Addr;
use crate::IntSym;
use crate::Result;
Expand Down Expand Up @@ -172,7 +172,7 @@ impl SymResolver for KSymResolver {
}
}

fn find_line_info(&self, _addr: Addr) -> Result<Option<AddrSrcInfo>> {
fn find_line_info(&self, _addr: Addr) -> Result<Option<AddrCodeInfo>> {
Ok(None)
}

Expand Down
4 changes: 2 additions & 2 deletions src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::fmt::Debug;

use crate::inspect::FindAddrOpts;
use crate::inspect::SymInfo;
use crate::symbolize::AddrSrcInfo;
use crate::symbolize::AddrCodeInfo;
use crate::Addr;
use crate::Result;

Expand Down Expand Up @@ -45,7 +45,7 @@ where
/// Find the address and size of a symbol name.
fn find_addr(&self, name: &str, opts: &FindAddrOpts) -> Result<Vec<SymInfo>>;
/// Find the file name and the line number of an address.
fn find_line_info(&self, addr: Addr) -> Result<Option<AddrSrcInfo>>;
fn find_line_info(&self, addr: Addr) -> Result<Option<AddrCodeInfo>>;
/// Translate an address (virtual) in a process to the file offset
/// in the object file.
fn addr_file_off(&self, addr: Addr) -> Option<u64>;
Expand Down
2 changes: 1 addition & 1 deletion src/symbolize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub use symbolizer::Sym;
pub use symbolizer::Symbolizer;


pub(crate) struct AddrSrcInfo<'src> {
pub(crate) struct AddrCodeInfo<'src> {
pub dir: &'src Path,
pub file: &'src OsStr,
pub line: Option<u32>,
Expand Down

0 comments on commit ddb90c4

Please sign in to comment.