Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DWARF debug symbols parsing in ELF files #1564

Merged
merged 21 commits into from
Jul 25, 2024
Merged

DWARF debug symbols parsing in ELF files #1564

merged 21 commits into from
Jul 25, 2024

Conversation

lvella
Copy link
Member

@lvella lvella commented Jul 11, 2024

Conversion from ELF now has feature parity with conversion from assembly, so I am setting it as the default.

@lvella lvella marked this pull request as ready for review July 22, 2024 16:30
riscv/tests/riscv_data/vec_median/src/main.rs Outdated Show resolved Hide resolved
riscv/Cargo.toml Show resolved Hide resolved
}
}

/// Index the symbols by their addresses.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't this simply be a Map<addr, Vec|Set<String>>? The names are already disambiguated from dedup_names

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There can be multiple names pointing to the same address, which is fine and it being handled here, and that is a different problem of the same name being used to point to different places (that is solved by dedup_names).

And sure, that is one way of turning a map into a multimap. Do you think that is much better than using a key disambiguator, like I did?

One one hand, I don't like the extra indirection in Map<addr, Vec<String>>, on the other, the way I did probably uses more memory.

Copy link
Collaborator

@pacheco pacheco Jul 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't think about performance here, doesn't seem like it will matter much, just felt conceptually simpler: HashMap<key, Vec<values>> is obviously a multimap (and doesn't need to be a BTree as there's no need for range/ordered access)... with the disambiguator i thought sth more complicated was happening at first. But I guess not a big deal.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write a rust crate with a proper multimap using a hash table.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to fix this... but since it is merged, doesn't sound so fun anymore.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do then

riscv/src/elf/debug_info.rs Show resolved Hide resolved
riscv/src/elf/debug_info.rs Show resolved Hide resolved
@leonardoalt
Copy link
Member

For the Keccak test the generated powdr-asm file is almost 100kb smaller, I wonder why

@pacheco
Copy link
Collaborator

pacheco commented Jul 23, 2024

For the Keccak test the generated powdr-asm file is almost 100kb smaller, I wonder why

it seems to do some more optimizations (e.g., noticed some inlining that didn't happen before)

@lvella
Copy link
Member Author

lvella commented Jul 23, 2024

For the Keccak test the generated powdr-asm file is almost 100kb smaller, I wonder why

I think this is mainly due to two things:

  • There are 145 fewer .debug file lines. I guess because they are unique in the ELF, but can be repeated across multiple .s files.
  • In asm path, every label is prefixed with the name of the file, something like compiler_builtins_dash_46285d5d86658fbf_, but in the ELF path, either the linkage name is used or an address based label is used.

@lvella lvella requested a review from pacheco July 23, 2024 21:09
@leonardoalt leonardoalt added this pull request to the merge queue Jul 25, 2024
Merged via the queue into main with commit 204b9e4 Jul 25, 2024
6 checks passed
@leonardoalt leonardoalt deleted the dwarf-support branch July 25, 2024 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants