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

feat: dynamic dependency debug info search #83

Merged
merged 1 commit into from
Jun 29, 2021
Merged

Conversation

pnwamk
Copy link
Contributor

@pnwamk pnwamk commented Jun 28, 2021

Now reopt and reopt-explore will attempt to find function types in the debug information of dynamic dependencies when analyzing a binary. If the dependency has previously been analyzed, the gleaned information will be cached in a REOPTHOME directory (getXdgDirectory XdgData ".reopt" by default or whatever path is specified by the REOPTHOMEenv var).

reopt

new reopt flags:

     --home                      Show location of the reopt home directory.
                                 Customizable via the REOPTHOME environment
                                 variable.
     --lib-dir=PATH              Additional location to search for dynamic
                                 dependencies.
     --debug-dir=PATH            Additional location to search for dynamic
                                 dependencies' debug info.

N.B., in addition to any specified --lib-dir directories, reopt will check the following default unix locations for libraries:

unixLibDirs = [ "/usr/local/lib"
              , "/usr/local/lib64"
              , "/usr/lib"
              , "/usr/lib64"
              , "/lib"
              , "/lib64"]

And in addition to any specified --debug-dir, reopt will query gdb to see where it looks for debug directories by executing the following:

gdb --batch --eval-command="show debug-file-directory"

reopt-explore

reopt-explore also now has the flags to add directories to the paths searched for libs and debug libs, i.e.:

     --lib-dir=PATH              Additional location to search for dynamic
                                 dependencies.
     --debug-dir=PATH            Additional location to search for dynamic
                                 dependencies' debug info.

and has a flag which switches the "exploration mode" to just looking for debug info (e.g., if there is a desire to pre-compute it on a machine before running reopt):

  -d --debug-info              Explore and export debug information for
                               functions only.

@pnwamk
Copy link
Contributor Author

pnwamk commented Jun 28, 2021

To do:

@pnwamk
Copy link
Contributor Author

pnwamk commented Jun 28, 2021

Comparing how the caching of dynamic dependencies' function type information affects run times seems to suggest it doesn't really make a difference so far... probably because of how little work we're doing in them (i.e., we just jump to their .debug_info section and scrape all the function type info).

Edit: the output differs greatly at present however, since on the first run any warnings/errors/etc encountered while parsing the lib do not appear at all on the second run.

@pnwamk pnwamk force-pushed the wip/dep-arg-analysis branch from 2f0a52c to ed02749 Compare June 29, 2021 14:14
@pnwamk pnwamk force-pushed the wip/dep-arg-analysis branch from ed02749 to 79e45fb Compare June 29, 2021 22:47
@pnwamk pnwamk merged commit 244f12f into main Jun 29, 2021
@pnwamk pnwamk deleted the wip/dep-arg-analysis branch June 29, 2021 22:54
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

Successfully merging this pull request may close these issues.

1 participant