diff options
| author | KyleMiles <krm504@nyu.edu> | 2024-05-15 13:16:43 -0400 |
|---|---|---|
| committer | KyleMiles <krm504@nyu.edu> | 2024-05-15 13:17:12 -0400 |
| commit | d4b928febf71fc6067db0b81023ad0564d81d808 (patch) | |
| tree | 4f2b1d28b0cf06a1c57a8b99bb54f6b0d2562735 /docs | |
| parent | fb893038862ad045d8ad1c624e0e954042a2f01a (diff) | |
Document DWARF Import and Export limitations
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/guide/types/debuginfo.md | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/docs/guide/types/debuginfo.md b/docs/guide/types/debuginfo.md index c994843c..5a78b85f 100644 --- a/docs/guide/types/debuginfo.md +++ b/docs/guide/types/debuginfo.md @@ -4,27 +4,37 @@ Debug Info is a mechanism for importing types, function signatures, and data var Currently debug info plugins are limited to types, function signatures, and data variables, but in the future will include line number information, comments, local variables, and possibly more. -## Supported DEBUG Info +## Supported Debug Info -Out of the box, Binary Ninja supports PDBs and DWARF. +We currently support [PDBs](https://github.com/Vector35/binaryninja-api/tree/dev/rust/examples/pdb-ng) and [DWARF](https://github.com/Vector35/binaryninja-api/tree/dev/rust/examples/dwarf/dwarf_import) (which are both open source), though you can also [register your own debug info parser through the API](https://api.binary.ninja/binaryninja.debuginfo-module.html#binaryninja.debuginfo.DebugInfoParser). For PDBs, Binary Ninja will automatically try to source from specified local folders and Microsoft's symbol server ([see the PDB settings for more information](../settings.md#all-settings)). -For DWARF, this includes DWARF information compiled in to ELF binaries, DWARF information in external ELF files (`.dwo`, `.debug`, etc), DWARF information compiled in to Mach-O's, and DWARF information in external `.dSYM` files as well. Support for DWARF information in PEs is [planned](https://github.com/Vector35/binaryninja-api/issues/1555). +DWARF supports information compiled in to ELF binaries, information from external ELF files (`.dwo`, `.debug`, etc), information compiled in to Mach-O's, and information from external `.dSYM` files as well. Support for DWARF information in PEs is [planned](https://github.com/Vector35/binaryninja-api/issues/1555). ## Applying debug info +## Not applying debug info + +You can control if debug information is imported for a file by changing the setting "Import Debug Information" (`analysis.debugInfo.internal`). You can import debug information at any point later by using the menu action `Analysis` -> `Import Debug Info`. + ### PDB Notes PDBs will make a best effort to find relevant debug info and apply it when you open a binary. Some PDBs can be very large and take a significant amount of time to parse. When you open a large PDB, you'll see a progress indicator in the status bar at the bottom of the application. ### DWARF Notes -DWARF information will be imported by default if the file contains DWARF sections. Currently, Binary Ninja will not search local or remote locations to attempt to find the associated DWARF information for you. If you have separate DWARF info, you'll need to import that from an external file. +DWARF information is imported from files that contain DWARF sections. Currently, Binary Ninja will not search local or remote locations to attempt to find the associated DWARF information for you. If you have separate DWARF info, you'll need to import that from an external file. -### Importing from External Files +#### DWARF Import Limitations + +[DWARF version 5](https://dwarfstd.org/dwarf5std.html) is mostly backwards compatible with DWARF version 4, which we originally targetted with our DWARF import plugin, with the caveats descibed in [this issue](https://github.com/Vector35/binaryninja-api/issues/5423). -Whether the Binary Ninja chooses the wrong PDB to import debug information from, or you have an external DWARF file you with to import the debug information from, you'll need to explicitly import debug info from that external file. You can either do this on-load by populating the "External Debug Info File" setting field (`analysis.debugInfo.external`), or by using the toolbar menu `Analysis` -> `Import Debug Info from External File`. +Components are supported by the API, but not in the parser. The [same issue](https://github.com/Vector35/binaryninja-api/issues/5423) as above would also allow us to support components more easily as well. + +#### DWARF Export Limitations + +Our [DWARF Export plugin](https://github.com/Vector35/binaryninja-api/tree/dev/rust/examples/dwarf/dwarf_export) is also open source and uses a different system from our debug information import plugins. It also does not support function-local variable names or types. The export plugin currently will export the global variables, function prototypes, and all the types in your binary view except for ones that are FunctionTypeClass or VarArgsTypeClass. #### Special Note for `.dSYM` Files @@ -32,6 +42,6 @@ Whether the Binary Ninja chooses the wrong PDB to import debug information from, For example, you could have the file `hello.macho` that you would like to import debug info for. Thankfully, you also have `hello.dSYM`. So you open `hello.macho` with options, find the "External Debug Info File" and provide the `hello.dSYM` file. When the file opens, you notice that no information was imported and the log reads "No available/valid parsers for file." This is because `hello.dSYM` is a bundle. The actual path you needed to provide for the "External Debug Info File" setting would look something like `hello.dSYM/Contents/Resources/DWARF/hello`. -## Not applying debug info +### Importing from External Files -If you wish not to import debug information for a file, you'll need to change the setting "Import Debug Information" (or `analysis.debugInfo.internal`). If you want to import debug information later, you can use the toolbar menu `Analysis` -> `Import Debug Info`, this will parse the current file and try to apply the recovered debug information. +If Binary Ninja chooses the wrong PDB to import debug information from, or you have an external DWARF file you with to import the debug information from, you'll need to explicitly set the "External Debug Info File" setting field (`analysis.debugInfo.external`), or use the menu action `Analysis` -> `Import Debug Info from External File`. |
