Commit 1ad28c4
authored
Remove
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 <[email protected]>DwarfReader::DetectSourceLanguage API to address issues with multi language binaries (#2228)1 parent b3c810f commit 1ad28c4
File tree
10 files changed
+114
-98
lines changed- src/stirling
- obj_tools
- source_connectors
- dynamic_tracer/dynamic_tracing
- socket_tracer
10 files changed
+114
-98
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
96 | | - | |
97 | 95 | | |
98 | 96 | | |
99 | 97 | | |
| |||
154 | 152 | | |
155 | 153 | | |
156 | 154 | | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
174 | 166 | | |
175 | | - | |
176 | | - | |
177 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
178 | 170 | | |
179 | | - | |
| 171 | + | |
180 | 172 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
187 | 178 | | |
188 | 179 | | |
189 | 180 | | |
| |||
923 | 914 | | |
924 | 915 | | |
925 | 916 | | |
926 | | - | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
927 | 926 | | |
928 | 927 | | |
929 | | - | |
| 928 | + | |
930 | 929 | | |
931 | 930 | | |
932 | 931 | | |
933 | | - | |
934 | | - | |
935 | | - | |
936 | 932 | | |
937 | 933 | | |
938 | 934 | | |
| |||
968 | 964 | | |
969 | 965 | | |
970 | 966 | | |
971 | | - | |
| 967 | + | |
972 | 968 | | |
973 | 969 | | |
974 | 970 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
181 | 187 | | |
182 | 188 | | |
183 | 189 | | |
| |||
291 | 297 | | |
292 | 298 | | |
293 | 299 | | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | 300 | | |
298 | 301 | | |
299 | 302 | | |
300 | 303 | | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | 320 | | |
327 | 321 | | |
328 | 322 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
128 | 134 | | |
129 | | - | |
130 | | - | |
| 135 | + | |
| 136 | + | |
131 | 137 | | |
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
136 | | - | |
137 | | - | |
138 | | - | |
| 142 | + | |
139 | 143 | | |
140 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
141 | 150 | | |
142 | | - | |
| 151 | + | |
143 | 152 | | |
144 | | - | |
| 153 | + | |
145 | 154 | | |
146 | 155 | | |
147 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
Lines changed: 32 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
56 | 71 | | |
57 | 72 | | |
58 | 73 | | |
59 | | - | |
| 74 | + | |
60 | 75 | | |
61 | | - | |
62 | 76 | | |
63 | 77 | | |
64 | | - | |
65 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
66 | 82 | | |
67 | 83 | | |
68 | 84 | | |
69 | 85 | | |
70 | 86 | | |
71 | | - | |
72 | | - | |
73 | 87 | | |
74 | 88 | | |
75 | 89 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
84 | 94 | | |
85 | | - | |
86 | | - | |
87 | | - | |
| 95 | + | |
88 | 96 | | |
89 | 97 | | |
90 | 98 | | |
91 | | - | |
| 99 | + | |
92 | 100 | | |
93 | 101 | | |
94 | 102 | | |
| |||
110 | 118 | | |
111 | 119 | | |
112 | 120 | | |
113 | | - | |
114 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
115 | 124 | | |
116 | 125 | | |
117 | 126 | | |
| |||
156 | 165 | | |
157 | 166 | | |
158 | 167 | | |
159 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
160 | 171 | | |
161 | 172 | | |
162 | 173 | | |
| |||
Lines changed: 10 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
36 | | - | |
| 39 | + | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
42 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
43 | 48 | | |
44 | | - | |
45 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
46 | 52 | | |
47 | 53 | | |
48 | 54 | | |
| |||
0 commit comments