Vector35 / binaryninja-api

Public API, examples, documentation and issues for Binary Ninja
https://binary.ninja/
MIT License
934 stars 212 forks source link

Prompt to open debug file prior to analysis if it might exist #2550

Open yrp604 opened 3 years ago

yrp604 commented 3 years ago

Is your feature request related to a problem? Please describe.

Loading PE with PDBs properly is too many clicks. Open with options, analysis hold, load pdb, remove analysis hold.

Describe the solution you'd like When opening a PE, one of the debug directories in the PE header contains the pdb path. Binja should apply an analysis hold and ask if the user is interested in providing a PDB before loading. Im unsure if this exists for ELF or Mach-O, if so the same behavior would be preferable here.

Describe alternatives you've considered None really

Additional context This is IDA's default behavior

You can see and dump the existence of these paths with:

C:\Users\x\Desktop>link -dump -headers quux.exe
...
SECTION HEADER #2
  .rdata name
   15166 virtual size
   6D000 virtual address (000000014006D000 to 0000000140082165)
   15200 size of raw data
   6B600 file pointer to raw data (0006B600 to 000807FF)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
40000040 flags
         Initialized Data
         Read Only

  Debug Directories

        Time Type        Size      RVA  Pointer
    -------- ------- -------- -------- --------
    60ED531A cv            34 0007B62C    79C2C    Format: RSDS, {368BE35F-7672-431F-AF66-96E6F5EC610E}, 2, C:\Users\x\Desktop\quux.pdb // XXX PATH HERE
    60ED531A feat          14 0007B660    79C60    Counts: Pre-VC++ 11.00=0, C/C++=203, /GS=203, /sdl=0, guardN=202
...
plafosse commented 3 years ago

We plan on modifying the way this is done with a combination of the DebugInfo API and the analysis passes refactor.

CouleeApps commented 1 year ago

This has been possible since 3.2 with the advent of the external debuginfo file source option, via Open with Options.

CouleeApps commented 1 year ago

This will need some extra scaffolding to implement: mainly having a way for Debug Info providers to signal if a file has an external debug info file, and if it can be automatically found. We may want to move the PDB symbol server downloader into this, creating a callback to actually find the external debuginfo file as well.

Once that is done, we can use that callback to signal a popup for manually loading info. Ideally, the popup will include an option to prevent future popups, with a sort of "Do you want to look for an external debug info file? Yes | No | Never"