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

[PROF-10953] feat: Add GoPCLnTab support as SymbolSource #52

Merged
merged 17 commits into from
Jan 29, 2025

Conversation

nsavoire
Copy link
Collaborator

@nsavoire nsavoire commented Nov 22, 2024

What does this PR do?

This change adds support for uploading the .gopclntab section to SymbolUploader.
This is disabled by default, and can be enabled by using the --upload-gopclntab CLI flag.

Motivation

Go executables always have a gopclntab section that contain symbol information and can be used to symbolicate addresses even when executable is stripped.

The new 'gopclntab' symbol source has a higher precedence than 'symbol_table' but lower than 'debug_info'. The rationale is that gopclntab covers only Go code, if the executable embeds some C/C++/Rust, then those parts will be described by dwarf. We want to prioritize symbol sources that potentially cover all executable (for example if executable is stripped, profiler will upload symbol information with 'gopclntab' as source, and later on an unstripped version could be uploaded with datadog-ci with 'debug_info' as source and will replace the existing symbols).

@nsavoire nsavoire marked this pull request as ready for review November 22, 2024 09:30
@nsavoire nsavoire requested a review from a team as a code owner November 22, 2024 09:30
@nsavoire nsavoire changed the title Add GoPCLnTab support as SymbolSource [PROF-10953] Add GoPCLnTab support as SymbolSource Nov 22, 2024
@nsavoire nsavoire changed the title [PROF-10953] Add GoPCLnTab support as SymbolSource [PROF-10953] feat: Add GoPCLnTab support as SymbolSource Nov 22, 2024
@nsavoire nsavoire force-pushed the nsavoire/add_gopclntab_symbol_source branch 5 times, most recently from ab8e393 to 9c7bdca Compare November 26, 2024 21:24
Copy link
Member

@felixge felixge left a comment

Choose a reason for hiding this comment

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

LGTM. I only managed to spend a few minutes lookin this over, so ideally somebody else can take a look as well. If not I'll try to make more time tomorrow.

@nsavoire nsavoire force-pushed the nsavoire/add_gopclntab_symbol_source branch 3 times, most recently from fe0b3b6 to 40af65c Compare November 29, 2024 09:47
@nsavoire nsavoire force-pushed the nsavoire/add_gopclntab_symbol_source branch from bd936a3 to ff1a0ce Compare December 2, 2024 13:15
@nsavoire nsavoire force-pushed the nsavoire/add_gopclntab_symbol_source branch 2 times, most recently from 817a0a3 to a321f29 Compare December 2, 2024 13:19
@nsavoire nsavoire force-pushed the nsavoire/add_gopclntab_symbol_source branch from 97a6d80 to 3042a47 Compare January 2, 2025 18:10
Copy link
Collaborator

@r1viollet r1viollet left a comment

Choose a reason for hiding this comment

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

LGTM, great feature!
Happy to consider more of the filtering logics in later PRs

@nsavoire nsavoire force-pushed the nsavoire/add_gopclntab_symbol_source branch 3 times, most recently from bfa87ba to 62d3925 Compare January 10, 2025 00:26

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
This change adds support for uploading the .gopclntab section to
SymbolUploader.
This is disabled by default, and can be enabled by using the
`--upload-gopclntab` CLI flag.
@nsavoire nsavoire force-pushed the nsavoire/add_gopclntab_symbol_source branch from 62d3925 to 600e782 Compare January 10, 2025 14:04
if !goFuncEndFound {
// Iterate over the functions to find the maximum offset of the inline tree.
maxInlineTreeOffset := goPCLnTabInfo.findMaxInlineTreeOffset()
// If the inline tree offset is found, truncate the goFunc data.
Copy link
Member

Choose a reason for hiding this comment

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

Can this fail? If we can't find the offset will we fail to truncate?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If it fails, then goFunc is now discarded

@nsavoire nsavoire force-pushed the nsavoire/add_gopclntab_symbol_source branch from c8ea0f3 to a83721c Compare January 28, 2025 13:23
Copy link
Member

@Gandem Gandem left a comment

Choose a reason for hiding this comment

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

Thank you! 🚀

@nsavoire nsavoire merged commit a675ad7 into main Jan 29, 2025
9 checks passed
@nsavoire nsavoire deleted the nsavoire/add_gopclntab_symbol_source branch January 29, 2025 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants