Skip to content

DWARF5 Support #87

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

Merged
merged 5 commits into from
Mar 28, 2025
Merged

DWARF5 Support #87

merged 5 commits into from
Mar 28, 2025

Conversation

fosterbrereton
Copy link
Contributor

This is the initial set of changes required to get orc compatible with DWARF5-formatted data. I only did what was necessary to get orc_test passing its current battery of tests (which were pretty useful!) Likely more changes will be required as DWARF5 issues are found in the wild.

Copy link
Contributor

@leethomason leethomason left a comment

Choose a reason for hiding this comment

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

Fantastic PR - nice job ferreting all this out.
Some comments for your consideration, but nothing blocking.

//
// A note on SPECREF:
//
// SPECREF (specification references) are bookmarks to the specification where more context
Copy link
Contributor

Choose a reason for hiding this comment

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

This is very cool. Might be worth a link to the specref ref. (Although that is super meta.) But this one: https://github.com/tobie/specref?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I pulled that term out of thin air. It's an actual thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I poked around it for a bit; looks limited to Web specs, and contains no information for DWARF :(

That said, I could certainly put a link to the "official" PDFs here in this file.

// addrx has changed to be a single ULEB;
// therefore we need to return the length
// of the ULEB instead of its value.
return temp_seek(s, [&]{
Copy link
Contributor

Choose a reason for hiding this comment

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

are you actually capturing anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes - the ULEB is variable-length binary data. In this case we're reading it just to see how big it is on disk, and returning that length.

// Do nothing. We started this project with DWARF4
// so the baseline implementation should match that.
} else if (_version == 5) {
// SPECREF: DWARF5 page 218 (200) line 15 --
Copy link
Contributor

Choose a reason for hiding this comment

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

loving the SPECREF

// the offset, then to get the string. The 0th string immediately follows the last
// entry offset.

const std::size_t entry_offset = temp_seek(_s, _debug_str_offsets._offset, [&] {
Copy link
Contributor

Choose a reason for hiding this comment

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

do you need to capture anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not quite sure what you mean with the question? I'm using the lambda to convert the string entry that comes in to an offset with a specific DWARF5 data section.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh capturing within the lambda? The [&] gives the compiler the freedom to capture whatever it needs by reference. Since this lambda's lifetime is limited to the temp_seek call, everything its referencing is alive when used within the lambda.

@fosterbrereton fosterbrereton enabled auto-merge (squash) March 28, 2025 22:18
@fosterbrereton fosterbrereton merged commit 5244c40 into main Mar 28, 2025
3 checks passed
@fosterbrereton fosterbrereton deleted the fosterbrereton/dwarf5-support branch March 28, 2025 22:25
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.

2 participants