Remove DwarfReader::DetectSourceLanguage API to address issues with multi language binaries#2228
Merged
ddelnano merged 4 commits intoJul 16, 2025
Conversation
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
oazizi000
approved these changes
Jul 16, 2025
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
ddelnano
added a commit
to k8sstormcenter/pixie
that referenced
this pull request
Feb 25, 2026
… multi language binaries (pixie-io#2228) Summary: Remove `DwarfReader::DetectSourceLanguage` API to address issues with multi language binaries Our previous `DwarfReader::DetectSourceLanguage` API assumes that a binary contains a single type of `DW_AT_language` attribute -- meaning a Go binary would include only DIEs with `DW_AT_language=DW_LANG_Go`. With our upgrade to Go 1.24, this assumption is no longer true. For example, Go binaries built under ASAN contain a variety of `DW_AT_language` attribute values depending on the DIE compile unit (see Test plan output). This PR removes this API and updates all callers to determine their use case's language from the relevant compile unit DIE. Relevant Issues: N/A Type of change: /kind bugfix Test Plan: Verified that the tests introduced in commit 1 fail w/ ASAN enabled. New APIs fix the build <details><summary>verification steps</summary> ``` # Tests fail under ASAN since C/C++ ABI is incorrectly assumed (17a0121...)$ bazel test --config asan src/stirling/source_connectors/socket_tracer:uprobe_symaddrs_test --test_output=all --nocache_test_results [==========] Running 4 tests from 2 test suites. [----------] Global test environment set-up. [----------] 3 tests from UprobeSymaddrsTest [ RUN ] UprobeSymaddrsTest.GoCommonSymAddrs [ OK ] UprobeSymaddrsTest.GoCommonSymAddrs (1768 ms) [ RUN ] UprobeSymaddrsTest.GoHTTP2SymAddrs src/stirling/source_connectors/socket_tracer/uprobe_symaddrs_test.cc:83: Failure Expected equality of these values: symaddrs.writeHeader_hf_ptr_loc Which is: type=kLocationTypeStack offset=8 (location_t{.type = kLocationTypeRegisters, .offset = 24}) Which is: type=kLocationTypeRegisters offset=24 [ FAILED ] UprobeSymaddrsTest.GoHTTP2SymAddrs (1728 ms) [ RUN ] UprobeSymaddrsTest.GoTLSSymAddrs src/stirling/source_connectors/socket_tracer/uprobe_symaddrs_test.cc:94: Failure Expected equality of these values: symaddrs.Write_b_loc Which is: type=kLocationTypeStack offset=8 (location_t{.type = kLocationTypeRegisters, .offset = 8}) Which is: type=kLocationTypeRegisters offset=8 src/stirling/source_connectors/socket_tracer/uprobe_symaddrs_test.cc:96: Failure Expected equality of these values: symaddrs.Read_b_loc Which is: type=kLocationTypeStack offset=8 (location_t{.type = kLocationTypeRegisters, .offset = 8}) Which is: type=kLocationTypeRegisters offset=8 [ FAILED ] UprobeSymaddrsTest.GoTLSSymAddrs (1613 ms) [----------] 3 tests from UprobeSymaddrsTest (5110 ms total) [----------] 1 test from UprobeSymaddrsNodeTest [ RUN ] UprobeSymaddrsNodeTest.TLSWrapSymAddrsFromDwarfInfo [ OK ] UprobeSymaddrsNodeTest.TLSWrapSymAddrsFromDwarfInfo (1 ms) [----------] 1 test from UprobeSymaddrsNodeTest (1 ms total) [----------] Global test environment tear-down [==========] 4 tests from 2 test suites ran. (5111 ms total) [ PASSED ] 2 tests. [ FAILED ] 2 tests, listed below: [ FAILED ] UprobeSymaddrsTest.GoHTTP2SymAddrs [ FAILED ] UprobeSymaddrsTest.GoTLSSymAddrs 2 FAILED TESTS I20250710 06:18:14.281155 12 env.cc:51] Shutting down ================================================================================ Target //src/stirling/source_connectors/socket_tracer:uprobe_symaddrs_test up-to-date: bazel-bin/src/stirling/source_connectors/socket_tracer/uprobe_symaddrs_test INFO: Elapsed time: 5.657s, Critical Path: 5.38s INFO: 2 processes: 1 internal, 1 linux-sandbox. INFO: Build completed, 1 test FAILED, 2 total actions //src/stirling/source_connectors/socket_tracer:uprobe_symaddrs_test FAILED in 5.4s /home/ddelnano/.cache/bazel/_bazel_ddelnano/fa8604ca46879b9b1ffd44d337c531f3/execroot/px/bazel-out/k8-fastbuild/testlogs/src/stirling/source_connectors/socket_tracer/uprobe_symaddrs_test/test.log Executed 1 out of 1 test: 1 fails locally. # Verify ASAN build has DIEs with different DW_AT_language attributes (17a0121...) $ bazel build --config asan src/stirling/testing/demo_apps/go_grpc_tls_pl/server:golang_1_24_grpc_tls_server_binary (17a0121...) $ llvm-dwarfdump bazel-bin/src/stirling/testing/demo_apps/go_grpc_tls_pl/server/golang_1_24_grpc_tls_server_binary | grep DW_AT_lang | uniq -c 1 DW_AT_language (DW_LANG_C_plus_plus_14) 1 DW_AT_language (DW_LANG_Mips_Assembler) 22 DW_AT_language (DW_LANG_C_plus_plus_14) 1 DW_AT_language (DW_LANG_Mips_Assembler) 48 DW_AT_language (DW_LANG_C_plus_plus_14) 280 DW_AT_language (DW_LANG_Go) # Verify non ASAN builds have only one DW_AT_language attribute (17a0121...) $ bazel build src/stirling/testing/demo_apps/go_grpc_tls_pl/server:golang_1_24_grpc_tls_server_binary (17a0121...) $ llvm-dwarfdump bazel-bin/src/stirling/testing/demo_apps/go_grpc_tls_pl/server/golang_1_24_grpc_tls_server_binary | grep DW_AT_lang | uniq -c 281 DW_AT_language (DW_LANG_Go) ``` </details> --------- Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
ddelnano
added a commit
to k8sstormcenter/pixie
that referenced
this pull request
Feb 25, 2026
… multi language binaries (pixie-io#2228) Summary: Remove `DwarfReader::DetectSourceLanguage` API to address issues with multi language binaries Our previous `DwarfReader::DetectSourceLanguage` API assumes that a binary contains a single type of `DW_AT_language` attribute -- meaning a Go binary would include only DIEs with `DW_AT_language=DW_LANG_Go`. With our upgrade to Go 1.24, this assumption is no longer true. For example, Go binaries built under ASAN contain a variety of `DW_AT_language` attribute values depending on the DIE compile unit (see Test plan output). This PR removes this API and updates all callers to determine their use case's language from the relevant compile unit DIE. Relevant Issues: N/A Type of change: /kind bugfix Test Plan: Verified that the tests introduced in commit 1 fail w/ ASAN enabled. New APIs fix the build <details><summary>verification steps</summary> ``` # Tests fail under ASAN since C/C++ ABI is incorrectly assumed (17a0121...)$ bazel test --config asan src/stirling/source_connectors/socket_tracer:uprobe_symaddrs_test --test_output=all --nocache_test_results [==========] Running 4 tests from 2 test suites. [----------] Global test environment set-up. [----------] 3 tests from UprobeSymaddrsTest [ RUN ] UprobeSymaddrsTest.GoCommonSymAddrs [ OK ] UprobeSymaddrsTest.GoCommonSymAddrs (1768 ms) [ RUN ] UprobeSymaddrsTest.GoHTTP2SymAddrs src/stirling/source_connectors/socket_tracer/uprobe_symaddrs_test.cc:83: Failure Expected equality of these values: symaddrs.writeHeader_hf_ptr_loc Which is: type=kLocationTypeStack offset=8 (location_t{.type = kLocationTypeRegisters, .offset = 24}) Which is: type=kLocationTypeRegisters offset=24 [ FAILED ] UprobeSymaddrsTest.GoHTTP2SymAddrs (1728 ms) [ RUN ] UprobeSymaddrsTest.GoTLSSymAddrs src/stirling/source_connectors/socket_tracer/uprobe_symaddrs_test.cc:94: Failure Expected equality of these values: symaddrs.Write_b_loc Which is: type=kLocationTypeStack offset=8 (location_t{.type = kLocationTypeRegisters, .offset = 8}) Which is: type=kLocationTypeRegisters offset=8 src/stirling/source_connectors/socket_tracer/uprobe_symaddrs_test.cc:96: Failure Expected equality of these values: symaddrs.Read_b_loc Which is: type=kLocationTypeStack offset=8 (location_t{.type = kLocationTypeRegisters, .offset = 8}) Which is: type=kLocationTypeRegisters offset=8 [ FAILED ] UprobeSymaddrsTest.GoTLSSymAddrs (1613 ms) [----------] 3 tests from UprobeSymaddrsTest (5110 ms total) [----------] 1 test from UprobeSymaddrsNodeTest [ RUN ] UprobeSymaddrsNodeTest.TLSWrapSymAddrsFromDwarfInfo [ OK ] UprobeSymaddrsNodeTest.TLSWrapSymAddrsFromDwarfInfo (1 ms) [----------] 1 test from UprobeSymaddrsNodeTest (1 ms total) [----------] Global test environment tear-down [==========] 4 tests from 2 test suites ran. (5111 ms total) [ PASSED ] 2 tests. [ FAILED ] 2 tests, listed below: [ FAILED ] UprobeSymaddrsTest.GoHTTP2SymAddrs [ FAILED ] UprobeSymaddrsTest.GoTLSSymAddrs 2 FAILED TESTS I20250710 06:18:14.281155 12 env.cc:51] Shutting down ================================================================================ Target //src/stirling/source_connectors/socket_tracer:uprobe_symaddrs_test up-to-date: bazel-bin/src/stirling/source_connectors/socket_tracer/uprobe_symaddrs_test INFO: Elapsed time: 5.657s, Critical Path: 5.38s INFO: 2 processes: 1 internal, 1 linux-sandbox. INFO: Build completed, 1 test FAILED, 2 total actions //src/stirling/source_connectors/socket_tracer:uprobe_symaddrs_test FAILED in 5.4s /home/ddelnano/.cache/bazel/_bazel_ddelnano/fa8604ca46879b9b1ffd44d337c531f3/execroot/px/bazel-out/k8-fastbuild/testlogs/src/stirling/source_connectors/socket_tracer/uprobe_symaddrs_test/test.log Executed 1 out of 1 test: 1 fails locally. # Verify ASAN build has DIEs with different DW_AT_language attributes (17a0121...) $ bazel build --config asan src/stirling/testing/demo_apps/go_grpc_tls_pl/server:golang_1_24_grpc_tls_server_binary (17a0121...) $ llvm-dwarfdump bazel-bin/src/stirling/testing/demo_apps/go_grpc_tls_pl/server/golang_1_24_grpc_tls_server_binary | grep DW_AT_lang | uniq -c 1 DW_AT_language (DW_LANG_C_plus_plus_14) 1 DW_AT_language (DW_LANG_Mips_Assembler) 22 DW_AT_language (DW_LANG_C_plus_plus_14) 1 DW_AT_language (DW_LANG_Mips_Assembler) 48 DW_AT_language (DW_LANG_C_plus_plus_14) 280 DW_AT_language (DW_LANG_Go) # Verify non ASAN builds have only one DW_AT_language attribute (17a0121...) $ bazel build src/stirling/testing/demo_apps/go_grpc_tls_pl/server:golang_1_24_grpc_tls_server_binary (17a0121...) $ llvm-dwarfdump bazel-bin/src/stirling/testing/demo_apps/go_grpc_tls_pl/server/golang_1_24_grpc_tls_server_binary | grep DW_AT_lang | uniq -c 281 DW_AT_language (DW_LANG_Go) ``` </details> --------- Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
entlein
pushed a commit
to k8sstormcenter/pixie
that referenced
this pull request
Jun 2, 2026
… multi language binaries (pixie-io#2228) Summary: Remove `DwarfReader::DetectSourceLanguage` API to address issues with multi language binaries Our previous `DwarfReader::DetectSourceLanguage` API assumes that a binary contains a single type of `DW_AT_language` attribute -- meaning a Go binary would include only DIEs with `DW_AT_language=DW_LANG_Go`. With our upgrade to Go 1.24, this assumption is no longer true. For example, Go binaries built under ASAN contain a variety of `DW_AT_language` attribute values depending on the DIE compile unit (see Test plan output). This PR removes this API and updates all callers to determine their use case's language from the relevant compile unit DIE. Relevant Issues: N/A Type of change: /kind bugfix Test Plan: Verified that the tests introduced in commit 1 fail w/ ASAN enabled. New APIs fix the build <details><summary>verification steps</summary> ``` # Tests fail under ASAN since C/C++ ABI is incorrectly assumed (17a0121...)$ bazel test --config asan src/stirling/source_connectors/socket_tracer:uprobe_symaddrs_test --test_output=all --nocache_test_results [==========] Running 4 tests from 2 test suites. [----------] Global test environment set-up. [----------] 3 tests from UprobeSymaddrsTest [ RUN ] UprobeSymaddrsTest.GoCommonSymAddrs [ OK ] UprobeSymaddrsTest.GoCommonSymAddrs (1768 ms) [ RUN ] UprobeSymaddrsTest.GoHTTP2SymAddrs src/stirling/source_connectors/socket_tracer/uprobe_symaddrs_test.cc:83: Failure Expected equality of these values: symaddrs.writeHeader_hf_ptr_loc Which is: type=kLocationTypeStack offset=8 (location_t{.type = kLocationTypeRegisters, .offset = 24}) Which is: type=kLocationTypeRegisters offset=24 [ FAILED ] UprobeSymaddrsTest.GoHTTP2SymAddrs (1728 ms) [ RUN ] UprobeSymaddrsTest.GoTLSSymAddrs src/stirling/source_connectors/socket_tracer/uprobe_symaddrs_test.cc:94: Failure Expected equality of these values: symaddrs.Write_b_loc Which is: type=kLocationTypeStack offset=8 (location_t{.type = kLocationTypeRegisters, .offset = 8}) Which is: type=kLocationTypeRegisters offset=8 src/stirling/source_connectors/socket_tracer/uprobe_symaddrs_test.cc:96: Failure Expected equality of these values: symaddrs.Read_b_loc Which is: type=kLocationTypeStack offset=8 (location_t{.type = kLocationTypeRegisters, .offset = 8}) Which is: type=kLocationTypeRegisters offset=8 [ FAILED ] UprobeSymaddrsTest.GoTLSSymAddrs (1613 ms) [----------] 3 tests from UprobeSymaddrsTest (5110 ms total) [----------] 1 test from UprobeSymaddrsNodeTest [ RUN ] UprobeSymaddrsNodeTest.TLSWrapSymAddrsFromDwarfInfo [ OK ] UprobeSymaddrsNodeTest.TLSWrapSymAddrsFromDwarfInfo (1 ms) [----------] 1 test from UprobeSymaddrsNodeTest (1 ms total) [----------] Global test environment tear-down [==========] 4 tests from 2 test suites ran. (5111 ms total) [ PASSED ] 2 tests. [ FAILED ] 2 tests, listed below: [ FAILED ] UprobeSymaddrsTest.GoHTTP2SymAddrs [ FAILED ] UprobeSymaddrsTest.GoTLSSymAddrs 2 FAILED TESTS I20250710 06:18:14.281155 12 env.cc:51] Shutting down ================================================================================ Target //src/stirling/source_connectors/socket_tracer:uprobe_symaddrs_test up-to-date: bazel-bin/src/stirling/source_connectors/socket_tracer/uprobe_symaddrs_test INFO: Elapsed time: 5.657s, Critical Path: 5.38s INFO: 2 processes: 1 internal, 1 linux-sandbox. INFO: Build completed, 1 test FAILED, 2 total actions //src/stirling/source_connectors/socket_tracer:uprobe_symaddrs_test FAILED in 5.4s /home/ddelnano/.cache/bazel/_bazel_ddelnano/fa8604ca46879b9b1ffd44d337c531f3/execroot/px/bazel-out/k8-fastbuild/testlogs/src/stirling/source_connectors/socket_tracer/uprobe_symaddrs_test/test.log Executed 1 out of 1 test: 1 fails locally. # Verify ASAN build has DIEs with different DW_AT_language attributes (17a0121...) $ bazel build --config asan src/stirling/testing/demo_apps/go_grpc_tls_pl/server:golang_1_24_grpc_tls_server_binary (17a0121...) $ llvm-dwarfdump bazel-bin/src/stirling/testing/demo_apps/go_grpc_tls_pl/server/golang_1_24_grpc_tls_server_binary | grep DW_AT_lang | uniq -c 1 DW_AT_language (DW_LANG_C_plus_plus_14) 1 DW_AT_language (DW_LANG_Mips_Assembler) 22 DW_AT_language (DW_LANG_C_plus_plus_14) 1 DW_AT_language (DW_LANG_Mips_Assembler) 48 DW_AT_language (DW_LANG_C_plus_plus_14) 280 DW_AT_language (DW_LANG_Go) # Verify non ASAN builds have only one DW_AT_language attribute (17a0121...) $ bazel build src/stirling/testing/demo_apps/go_grpc_tls_pl/server:golang_1_24_grpc_tls_server_binary (17a0121...) $ llvm-dwarfdump bazel-bin/src/stirling/testing/demo_apps/go_grpc_tls_pl/server/golang_1_24_grpc_tls_server_binary | grep DW_AT_lang | uniq -c 281 DW_AT_language (DW_LANG_Go) ``` </details> --------- Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary: Remove
DwarfReader::DetectSourceLanguageAPI to address issues with multi language binariesOur previous
DwarfReader::DetectSourceLanguageAPI assumes that a binary contains a single type ofDW_AT_languageattribute -- meaning a Go binary would include only DIEs withDW_AT_language=DW_LANG_Go. With our upgrade to Go 1.24, this assumption is no longer true. For example, Go binaries built under ASAN contain a variety ofDW_AT_languageattribute values depending on the DIE compile unit (see Test plan output).This PR removes this API and updates all callers to determine their use case's language from the relevant compile unit DIE.
Relevant Issues: N/A
Type of change: /kind bugfix
Test Plan: Verified that the tests introduced in commit 1 fail w/ ASAN enabled. New APIs fix the build
verification steps