Skip to content

Commit

Permalink
Make the output of --sym-info hopefully a little less confusing
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlattimore committed Jan 7, 2025
1 parent 7d3a5f9 commit f9e179b
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions libwild/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4330,18 +4330,7 @@ impl std::fmt::Debug for FileLayoutState<'_> {
}

fn print_symbol_info<S: StorageModel>(symbol_db: &SymbolDb<S>, name: &str) {
if let Some(symbol_id) = symbol_db
.global_names
.get(&SymbolName::prehashed(name.as_bytes()))
{
println!(
"Global definition:\n {}",
symbol_db.symbol_debug(symbol_id)
);
} else {
println!("No global symbol `{name}` defined by any input files");
}
println!("Definitions / references for `{name}`:");
println!("Definitions / references with name `{name}`:");
for i in 0..symbol_db.num_symbols() {
let symbol_id = SymbolId::from_usize(i);
if symbol_db
Expand All @@ -4355,12 +4344,13 @@ fn print_symbol_info<S: StorageModel>(symbol_db: &SymbolDb<S>, name: &str) {
let local_index = symbol_id.to_input(o.symbol_id_range);
match o.object.symbol(local_index) {
Ok(sym) => {
let canonical = symbol_db.definition(symbol_id);
println!(
" {}: symbol_id={symbol_id} Local #{local_index} \
in File #{file_id} {} ({})",
" {}: symbol_id={symbol_id} -> {canonical} {} \n \
#{local_index} in File #{file_id} {}",
crate::symbol::SymDebug(sym),
o.input,
symbol_db.local_symbol_value_flags(symbol_id),
o.input,
);
}
Err(e) => {
Expand Down

0 comments on commit f9e179b

Please sign in to comment.