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

Don't crash on missing addresses - just print them and go on #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jsgf
Copy link

@jsgf jsgf commented May 18, 2019

This allows stack-sizes to work on binaries where previously it was crashing.

This allows stack-sizes to work on binaries where previously it was crashing.
@japaric
Copy link
Owner

japaric commented Dec 18, 2019

Sorry for taking so long to get to this PR.

This crate is used as a library so we shouldn't print from functions that are called from any of the public API.

Did you run stack-sizes on a stripped binary (e.g. strip -s $binary)? That would explain why the tool panicked: a stripped binary has no symbol table that maps addresses to symbols thus the addresses in the .stack_sizes section produced by the Rust compiler (via -Z emit-stack-sizes) can't be mapped to any meaningful symbol name by the tool.

If you are using the tool on a binary that has not been stripped then I would like to replicate the results myself so I can better understand why a symbol would appear in the .stack_sizes section but not in the .symtab. Since you mentioned linking C++ code it could the case that the C++ object (.o) files were stripped before linking; though I don't know if a linker can work with stripped object files.

@jsgf
Copy link
Author

jsgf commented Dec 19, 2019

I don't remember the full context, but I'm pretty sure I was running it on freshly compiled binaries with full symbol and debug info present.

@SoftwareApe
Copy link

SoftwareApe commented Nov 12, 2020

I'm also getting the same error on some, but not all of my C++ executables, so I'm quite keen on having something of the sort merged.

However I understand why printing from a library is unwanted, but could we instead use None here, indicating that the stack wasn't found? Then the caller of the library could deal with this problem. Otherwise we could use std::result to propagate what was the exact issue we encountered.

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.

3 participants