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

Unify code of source information access for DWARF, PDB, dSYM #907

Closed
XVilka opened this issue Mar 26, 2021 · 7 comments
Closed

Unify code of source information access for DWARF, PDB, dSYM #907

XVilka opened this issue Mar 26, 2021 · 7 comments
Assignees
Labels
DWARF help wanted Extra attention is needed PDB refactor Refactoring requests
Milestone

Comments

@XVilka
Copy link
Member

XVilka commented Mar 26, 2021

Currently the code for handling source-level information access with DWARF, PDB, dSYM, etc is separate in every cases.
We should think about better abstract API for all of these. It will also affect config variables like asm.dwarf, etc.

See also:

Good source of inspiration is the DebugInfo APIs from Binary Ninja: https://api.binary.ninja/binaryninja.debuginfo-module.html

@XVilka XVilka added DWARF PDB refactor Refactoring requests labels Mar 26, 2021
@thestr4ng3r
Copy link
Member

After #880, the line info is available in a format-agnistic way in RzBinObject.lines so from the perspective of querying the info after it has been loaded, this is already done.
Regarding loading itself, bin plugins can supply their line info using the lines callback. This is already nice, but it only really works when the debug info is bound to the binary format itself, like dex.
Dwarf however can occur in pretty much any format including elf and pe, so it doesn't work there. I could imagine additional debug info plugins that, if the bin plugin doesn't return lines, are tried one after another. Then dwarf would be one such plugin. (There were dbginfo plugins before, but they were not doing that)

@ret2libc
Copy link
Member

Dwarf however can occur in pretty much any format including elf and pe, so it doesn't work there.

As well as separate files completely. Not sure if it changes anything, but just keep it in mind.

@XVilka
Copy link
Member Author

XVilka commented Apr 1, 2021

Even more, it can be served by a daemon:

With GNU Binutils 2.34 comes debuginfod support, which is the HTTP server catching our eye while the debuginfod server is distributed as part of the latest elfutils package. This isn't for a general purpose web server thankfully but is an HTTP server for distributing ELF/DWARF debugging information and source code. With debuginfod enabled, Binutils' readelf and objdump utilities can query the HTTP server(s) for debug files that cannot otherwise be found. Enabling this option requires building Binutils using --with-debuginfod.

See https://developers.redhat.com/blog/2019/10/14/introducing-debuginfod-the-elfutils-debuginfo-server/ for more information.

@XVilka XVilka added this to the 0.4.0 milestone May 12, 2021
@XVilka XVilka assigned ghost May 18, 2021
@ret2libc ret2libc removed this from the 0.4.0 milestone Feb 10, 2022
@XVilka XVilka unassigned ghost and Basstorm Feb 13, 2022
@stale stale bot added the stale label Aug 31, 2022
@XVilka XVilka added the help wanted Extra attention is needed label Nov 4, 2022
@rizinorg rizinorg deleted a comment from stale bot Nov 4, 2022
@XVilka XVilka removed the stale label May 6, 2023
@XVilka
Copy link
Member Author

XVilka commented May 15, 2023

@imbillow note, that also it would require some changes in the config variables - e.g. asm.dwarf. etc.
We should think what make sense to be generic, e.g. asm.dbginfo, etc and use these instead.
Just like we have bin.dbginfo already.

@XVilka
Copy link
Member Author

XVilka commented Jun 1, 2023

TODO: Check also the Rust 1.70 new feature (e.g. -Cdebuginfo=line-tables-only), how it works with Rizin: rust-lang/rust#109808

@XVilka XVilka added this to the 0.7.0 milestone Jun 15, 2023
@XVilka
Copy link
Member Author

XVilka commented Jun 16, 2023

@imbillow turned out OMF also could have source code information available, currently it's not parsed:

Note, also we don't seem to parse types information available from OMF as well, probably could be done, similarly to DWARF and PDB.

@XVilka
Copy link
Member Author

XVilka commented Jan 25, 2024

As most of this was complete, I am closing this issue, thanks @imbillow for the hard work! If something is missing, lets open a new issue.

@XVilka XVilka closed this as completed Jan 25, 2024
@XVilka XVilka added this to Debugger Jul 11, 2024
@XVilka XVilka moved this to Done in Debugger Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DWARF help wanted Extra attention is needed PDB refactor Refactoring requests
Projects
Status: Done
Development

No branches or pull requests

5 participants