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

libdwarf is slow -- use libdw instead #12

Open
stephenrkell opened this issue Mar 12, 2019 · 2 comments
Open

libdwarf is slow -- use libdw instead #12

stephenrkell opened this issue Mar 12, 2019 · 2 comments

Comments

@stephenrkell
Copy link
Owner

Reading DIEs through libdwarf is a bit of a performance bottleneck, because it does memory allocation very frequently.

It would be better to use libdw (from elfutils), which more sensibly just memory-maps the file and issues DIEs as pointers/offsets into it. To do so, some cleanup is necessary to remove the last vestiges of libdwarf-specific code.

(Note that we still expect to depend on libdwarf's libdwarf.h -- it has a nice structure where the DW_* constants are #define'd, each on one line. This is used for generating specialised header files that omit certain vendor extensions. The dwarf.h in libdw uses enums, which are much less convenient for this. Of course the definitions are equivalent, so we can include libdw's dwarf.h internally from our code, but use libdwarf's for our generation purposes.)

@stephenrkell
Copy link
Owner Author

To remove the dependency on libdwarf entirely, while still generating header files as at present, a cute trick would be to bootstrap the header file generation using libdw itself. From the DWARF info of libdw, we can get at its enum definitions in a structured way, e.g. by dwarfdumping it and lightly sedding the output.

@stephenrkell
Copy link
Owner Author

I have done some work on the use-libdw branch, although it does not work yet.

Note also that that branch replaces libdwarf with libdw, but in hindsight it should be a configure-time choice. I will go back and parameterise that once the main body of the work is done.

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

No branches or pull requests

1 participant