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

/proc/<id>/maps can be read once per stack trace extraction #3

Open
bgedik opened this issue Oct 16, 2018 · 2 comments
Open

/proc/<id>/maps can be read once per stack trace extraction #3

bgedik opened this issue Oct 16, 2018 · 2 comments

Comments

@bgedik
Copy link
Collaborator

bgedik commented Oct 16, 2018

Since I am not too familiar with the overall organization, it was not obvious to me how to achieve this, but ideally, we should not do this repeatedly.

@bgedik bgedik changed the title /proc/<id>/maps can be read once for stack trace extraction /proc/<id>/maps can be read once per stack trace extraction Oct 16, 2018
@melintea
Copy link
Owner

melintea commented Oct 16, 2018

Good point. It can be done via a hash map that would cache binaryname => base value

The map is accessed safely in bfd_vma compute_maps_base(const char * binfile) which is called via resolve(). resolve() operates under _lib_mutex which protects for multi-thread access.

If the process dynamically loads dynamic modules (as opposed to simply inking with) we will have to open /proc each time we do not find a binary in the map.

@bgedik
Copy link
Collaborator Author

bgedik commented Oct 16, 2018

One concern: If the same library is dynamically loaded/unloaded multiple times, it is not guaranteed to be mapped to the same location. Could it be safer to do this once at the beginning of stack trace extraction?

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

2 participants