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

Add identification of golang binaries #179

Merged
merged 4 commits into from
Aug 7, 2023

Conversation

marcin-ol
Copy link
Contributor

Support identification of Golang binaries by looking for ELF section .note.go.buildid, supported since Go 1.5.
Reference: golang/go#11048.

granulate_utils/golang.py Outdated Show resolved Hide resolved
granulate_utils/linux/elf.py Outdated Show resolved Hide resolved
@Jongy
Copy link
Contributor

Jongy commented Aug 4, 2023

Related: Granulate/gprofiler#817

@Jongy
Copy link
Contributor

Jongy commented Aug 4, 2023

Btw this change will have a side effect of greatly improving the performance (iterating over sections is much less work than iterating over symbols), helping for Granulate/gprofiler#696 cause.

"""
with open_elf(elf) as elf:
build_id_section = elf.get_section_by_name(".note.gnu.build-id")
build_id_section = elf.get_section_by_name(section)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can name it note_section as it's not necessarily a build-id one anymore

Copy link
Contributor

@Jongy Jongy left a comment

Choose a reason for hiding this comment

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

One final small comment.

Other than that I'll have to review the usage of changed functions (is_golang_process and get_elf_buildid) in other project which use granulate-utils to ensure compatibility is kept.

@marcin-ol
Copy link
Contributor Author

One final small comment.

Other than that I'll have to review the usage of changed functions (is_golang_process and get_elf_buildid) in other project which use granulate-utils to ensure compatibility is kept.

If you find any other use, then I'll split this into lower-level find_elf_note() and restore interface of function get_elf_buildid().

@Jongy
Copy link
Contributor

Jongy commented Aug 6, 2023

No problematic usages. I'm ready to merge this - just waiting on your reply on the last comment.

@Jongy Jongy merged commit 23b39aa into Granulate:master Aug 7, 2023
7 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.

None yet

2 participants