pub struct ElfConverter { /* private fields */ }convert only.Expand description
Reusable ELF-to-GSYM converter with immutable options.
Options are fixed at construction, so one converter can be shared across
many images. Default uses ConversionOptions::default.
use gsym::convert::ElfConverter;
let report = ElfConverter::default().convert_path("./app")?;
for warning in &report.warnings {
eprintln!("warning: {warning}");
}
report.builder.write_to(std::fs::File::create("app.gsym")?)?;Implementations§
Source§impl ElfConverter
impl ElfConverter
Sourcepub const fn new(options: ConversionOptions) -> Self
pub const fn new(options: ConversionOptions) -> Self
Creates a converter using options.
Sourcepub const fn options(&self) -> &ConversionOptions
pub const fn options(&self) -> &ConversionOptions
Returns this converter’s immutable options.
Sourcepub fn convert(&self, inputs: ElfInputs<'_>) -> Result<ConversionReport>
pub fn convert(&self, inputs: ElfInputs<'_>) -> Result<ConversionReport>
Converts linked ELF image/debug inputs into a GSYM builder.
Uses exactly the inputs given, with no filesystem or network access. Companions supplied here are cross-checked against the image, so a debug or symbol file from a different architecture or build is rejected.
§Errors
Returns an error for malformed inputs, incompatible companion files, invalid DWARF, or unrepresentable GSYM records.
Sourcepub fn convert_path(
&self,
image_path: impl AsRef<Path>,
) -> Result<ConversionReport>
pub fn convert_path( &self, image_path: impl AsRef<Path>, ) -> Result<ConversionReport>
Converts an ELF path and discovers supported companion debug files.
Searches for companion debug information unless
DiscoveryPolicy::Disabled is set. The chosen paths are reported in
ConversionReport::discovered_debug and its siblings, and problems
encountered while searching appear as warnings rather than errors.
With debuginfod configured, this may perform network requests. See
docs::conversion.
§Errors
Returns an error when an input cannot be read or converted.
Sourcepub fn convert_path_with_observer(
&self,
image_path: impl AsRef<Path>,
observer: impl FnMut(DiscoveryEvent<'_>),
) -> Result<ConversionReport>
pub fn convert_path_with_observer( &self, image_path: impl AsRef<Path>, observer: impl FnMut(DiscoveryEvent<'_>), ) -> Result<ConversionReport>
Converts an ELF path while reporting potentially slow discovery work.
The observer is called immediately before each debuginfod request. It may be called more than once when several servers or companions are considered.
§Errors
Returns an error when an input cannot be read or converted.
Trait Implementations§
Source§impl Clone for ElfConverter
impl Clone for ElfConverter
Source§fn clone(&self) -> ElfConverter
fn clone(&self) -> ElfConverter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more