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

write: make it easier to generate valid DWARF #490

Open
philipc opened this issue Apr 24, 2020 · 2 comments
Open

write: make it easier to generate valid DWARF #490

philipc opened this issue Apr 24, 2020 · 2 comments

Comments

@philipc
Copy link
Collaborator

philipc commented Apr 24, 2020

A couple of issues were encountered in #448 and https://github.com/bjorn3/rustc_codegen_cranelift/pull/978:

  • subprograms need a DW_AT_name attribute
  • DW_AT_high_pc can only be a length for DWARF version >= 4
  • base addresses in location lists are new in DWARF version 3

And there'll be a whole bunch of other things that the standard requires or that are added in newer versions which we don't check for at all.

Some ideas for how to help with this:

  • add these sorts of checks to the dwarf-validate example
  • add a validate method to UnitTable or Unit

Ideally the API would disallow these sorts of errors, but it is too low level for this. Maybe we should provide a higher level API too.

@philipc
Copy link
Collaborator Author

philipc commented Apr 24, 2020

This also needs to handle GNU extensions that were added to newer versions. We should emit the GNU extension for older versions, and the standard value for newer versions.

@bjorn3
Copy link
Contributor

bjorn3 commented Apr 24, 2020

Things that would be nice to check:

  • Attributes present, but not allowed either in the specified DWARF version or any version. Eg using DW_AT_high_pc witha length for DWARF version < 4
  • Attributed missing, but mandatory, like DW_TAG_subprogram without DW_AT_name or specified code location.
  • Attributes missing and not mandatory but likely wanted, like DW_AT_stmt_list for DW_TAG_compilation_unit when there is a .debug_line section.

Maybe we should provide a higher level API too.

That would be nice.

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

No branches or pull requests

2 participants