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

Fallback to the first executable map if the given executable is invalid #184

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

pablogsal
Copy link
Member

When a core file is created from a Python script that's executed
directly via shebang, the reported executable will be the shell script.
This is a problem because when we proceed to analyse the core file
pystack fails as this is not the correct binary that was used to
generate the core.

To avoid this problem, detect when this happens and fall back to the
executable reported in the first map that has a path in the core, which
is generally the real executable that we need.

Issue number of the reported bug or feature request: #

Describe your changes
A clear and concise description of the changes you have made.

Testing performed
Describe the testing you have performed to ensure that the bug has been addressed, or that the new feature works as planned.

Additional context
Add any other context about your contribution here.

src/pystack/__main__.py Outdated Show resolved Hide resolved
src/pystack/__main__.py Outdated Show resolved Hide resolved
Copy link
Contributor

@godlygeek godlygeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You accidentally implemented the opposite of what I asked for - you had us fall back onto this autodetection only if the user did provide an executable on the command line, instead of only if they didn't.

I've fixed that, and moved this detection up a bit higher in the file where it seems to fit better. After those changes, this LGTM. If you're happy with my changes, please squash them and 🚀

When a core file is created from a Python script that's executed
directly via shebang, the reported executable will be the shell script.
This is a problem because when we proceed to analyse the core file
pystack fails as this is not the correct binary that was used to
generate the core.

To avoid this problem, detect when this happens and fall back to the
executable reported in the first map that has a path in the core, which
is generally the real executable that we need.

Signed-off-by: Pablo Galindo <[email protected]>
@pablogsal pablogsal enabled auto-merge (squash) July 24, 2024 11:08
@pablogsal pablogsal merged commit c0b8b49 into bloomberg:main Jul 24, 2024
21 checks passed
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.

2 participants