|
1 | 1 | # Debug Info |
2 | 2 |
|
3 | | -Debug Info is a mechanism for importing types, function signatures, and data variables from either the original binary (e.g. an ELF compiled with DWARF) or a supplemental file (e.g. a PDB). |
| 3 | +Debug Info is a mechanism for importing types, function signatures, data variables, and more from either the original binary (e.g. an ELF compiled with debug info) or a supplemental file (e.g. a PDB or .debug file). |
4 | 4 |
|
5 | | -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. |
| 5 | +Currently, debug info plugins are limited to applying types, function signatures, data variables, and local stack variables, but in the future will include line number information, comments, and possibly more. |
6 | 6 |
|
7 | | -## Supported Debug Info |
| 7 | +## Supported Formats |
8 | 8 |
|
9 | 9 | We currently support [PDBs](https://github.com/Vector35/binaryninja-api/tree/dev/plugins/pdb-ng) and [DWARF](https://github.com/Vector35/binaryninja-api/tree/dev/plugins/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). |
10 | 10 |
|
11 | | -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#settings-reference)). |
| 11 | +Binary Ninja will automatically try to access relevant PDBs from specified local folders and Microsoft's symbol server (see the [PDB settings](../settings.md#settings-reference) for more information). |
12 | 12 |
|
13 | | -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). |
| 13 | +Binary Ninja's DWARF loader supports loading information compiled into binaries, information from external files (`.dwo`, `.debug`, etc.), and information from external `.dSYM` files as well. |
14 | 14 |
|
15 | 15 | ## Applying Debug Info |
16 | 16 |
|
17 | | -Debug Info is automatically applied by default if applicable. |
| 17 | +Debug Info is automatically applied by default if available. |
18 | 18 |
|
19 | 19 | { width="300" } |
20 | 20 |
|
21 | | -However, for some file formats, you may wish to specify an external source of Debug Info using the `Import Debug Info from External File` menu option under `Analysis`. |
| 21 | +However, for some file formats, you may wish to specify an external source of Debug Info using the `Analysis/Import Debug Info from External File` menu option. |
22 | 22 |
|
23 | 23 | ## Blocking Debug Info |
24 | 24 |
|
25 | | -You can control if debug information is imported for a file by changing the setting "Import Debug Information" ([`analysis.debugInfo.internal`](https://docs.binary.ninja/guide/settings.html#analysis.debugInfo.internal)). You can import debug information at any point later by using the menu action `Analysis` -> `Import Debug Info`. |
| 25 | +You can control if debug information is imported for a file by changing the setting [`analysis.debugInfo.internal`](https://docs.binary.ninja/guide/settings.html#analysis.debugInfo.internal). You can import debug information at any point later by using the menu action `Analysis/Import Debug Info`. |
26 | 26 |
|
27 | | -### PDB Notes |
| 27 | +## PDB Notes |
28 | 28 |
|
29 | | -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. |
| 29 | +Binary Ninja will make a best effort to find relevant PDBs and apply debug info from them when you open a binary. Some PDBs can be very large and take a significant amount of time to process. When you open a file with a large PDB, you'll see a progress indicator in the status bar at the bottom of the application. |
30 | 30 |
|
31 | | -### DWARF Notes |
| 31 | +## DWARF Notes |
32 | 32 |
|
33 | | -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. |
| 33 | +DWARF information is imported from files that contain DWARF sections. Binary Ninja can automatically locate and load separate DWARF information through several methods: |
34 | 34 |
|
35 | | -#### DWARF Import Limitations |
| 35 | +- **Debuginfod servers**: If [`network.enableDebuginfod`](https://docs.binary.ninja/guide/settings.html#network.enableDebuginfod) is enabled, Binary Ninja will query the [debuginfod](https://developers.redhat.com/blog/2019/10/14/introducing-debuginfod-the-elfutils-debuginfo-server) servers configured in [`network.debuginfodServers`](https://docs.binary.ninja/guide/settings.html#network.debuginfodServers) |
| 36 | +- **Sibling debug files**: If [`analysis.debugInfo.loadSiblingDebugFiles`](https://docs.binary.ninja/guide/settings.html#analysis.debugInfo.loadSiblingDebugFiles) is enabled, Binary Ninja will look for files of the form `<filename>.debug` and `<filename>.dSYM` in the same directory as the binary |
| 37 | +- **Debug directories**: Binary Ninja will search the directories specified in [`analysis.debugInfo.debugDirectories`](https://docs.binary.ninja/guide/settings.html#analysis.debugInfo.debugDirectories) for debug files stored by the binary's build ID |
| 38 | + |
| 39 | +If automatic loading does not succeed, you can still manually import debug info from an external file using the `Analysis/Import Debug Info from External File` menu option. |
| 40 | + |
| 41 | +### DWARF Import Limitations |
36 | 42 |
|
37 | 43 | [DWARF version 5](https://dwarfstd.org/dwarf5std.html) is mostly backwards compatible with DWARF version 4, which we originally targeted with our DWARF import plugin, with the caveats described in [this issue](https://github.com/Vector35/binaryninja-api/issues/5423). |
38 | 44 |
|
39 | 45 | 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. |
40 | 46 |
|
41 | | -#### DWARF Export Limitations |
| 47 | +### DWARF Export Limitations |
42 | 48 |
|
43 | 49 | Our [DWARF Export plugin](https://github.com/Vector35/binaryninja-api/tree/dev/plugins/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`. |
44 | 50 |
|
45 | | -#### Special Note for `.dSYM` Files |
| 51 | +### Special Note for `.dSYM` Files |
46 | 52 |
|
47 | 53 | Binary Ninja will automatically load `.dSYM` files given the following: |
48 | 54 |
|
|
0 commit comments