grpc-native-debug 1.60.0.pre1-x86_64-linux

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 64ca16b9e56aa57989b0437b2a6fcfbd4bf1657cf481e90fbbe2d2da4cf410cc
4
+ data.tar.gz: 1fb2b1539afcf6f0ae6b49cfe6f5e073ac33ac00eb1436ea7e95877251c75a79
5
+ SHA512:
6
+ metadata.gz: 02fc8a73fb0827ede80df2698b830d0f2ae61469338a8a5c5bc71a58e6dd3d5dd5a1eb858ee849cd7b52905f7bf58b250459b83caf45bf36c39b162b8ae9d32d
7
+ data.tar.gz: 139333d8164051ab1bfbb2457bc6a2b0ba938ba31e9ecae33348360740a0dea94ce1d7510246a3055b0f771b2cb8b0ba998d8da17b01754a159c4ecd77f7f78e
data/README.md ADDED
@@ -0,0 +1,230 @@
1
+ This package contains debug symbols that can be useful for debugging
2
+ applications that use grpc pre-compiled binary gems.
3
+
4
+ An example of a pre-compiled binary gem is `grpc-1.58.0-x86_64-linux.gem`
5
+ (as opposed to a source-built gem like `grpc-1.58.0.gem`).
6
+
7
+ `grpc-native-debug` gems contain debug symbols which complement the
8
+ native libraries in these grpc binary gems. After fetching and unpacking a
9
+ proper `grpc-native-debug` gem, one can load the correct `.dbg` symbol file to
10
+ debug their grpc application.
11
+
12
+ # Background
13
+
14
+ grpc-ruby pre-compiled binary gems are *released with debug symbols stripped*.
15
+ As a consequence, if you are to examine a grpc stack trace in a debugger
16
+ for example, a lot of information will initially be missing.
17
+
18
+ # Using grpc-native-debug
19
+
20
+ ## Finding the correct grpc-native-debug gem
21
+
22
+ Each `grpc-native-debug` gem is *one-to-one* with a `grpc` gem. Specifically:
23
+
24
+ - The version of a `grpc-native-debug` gem **must match the version** of the `grpc`
25
+ gem.
26
+
27
+ - The ruby platform of a `grpc-native-debug` gem **must match the ruby platform** of
28
+ the `grpc` gem.
29
+
30
+ So for example, if you are debugging `grpc-1.60.1-x86_64-linux.gem`, then you
31
+ need to fetch `grpc-native-debug-1.60.1-x86_64-linux.gem`.
32
+
33
+ ## Finding the correct .dbg symbol file
34
+
35
+ Each `grpc-native-debug` gem has a top-level `symbols` directory containing
36
+ symbol files ending in `.dbg`.
37
+
38
+ `grpc` binary gems are shipped with multiple native libraries. There is one
39
+ native library for each supported *minor version* of ruby. As such,
40
+ `grpc-native-debug` gems have exactly one `.dbg` file for each native library
41
+ in the corresponding `grpc` gem.
42
+
43
+ If you unpack a `grpc-native-debug` gem and look at the `symbols`
44
+ directory, you might see something like this:
45
+
46
+ ```
47
+ grpc-native-debug-1.60.1-x86_64-linux/symbols/grpc-1.60.1-x86_64-linux-ruby-3.0.dbg
48
+ grpc-native-debug-1.60.1-x86_64-linux/symbols/grpc-1.60.1-x86_64-linux-ruby-2.7.dbg
49
+ grpc-native-debug-1.60.1-x86_64-linux/symbols/grpc-1.60.1-x86_64-linux-ruby-3.2.dbg
50
+ grpc-native-debug-1.60.1-x86_64-linux/symbols/grpc-1.60.1-x86_64-linux-ruby-3.1.dbg
51
+ ```
52
+
53
+ In each of these `.dbg` files, the `ruby-<major>-<minor>` portion of the string
54
+ indicates which ruby version it's supposed to be used with.
55
+
56
+ So for example, if you are debugging `grpc-1.60.1-x86_64-linux.gem` on ruby-3.0, then you
57
+ need to use symbol file
58
+ `grpc-native-debug-1.60.1-x86_64-linux/symbols/grpc-1.60.1-x86_64-linux-ruby-3.0.dbg`.
59
+
60
+ ## Putting symbols into action (example gdb workflow)
61
+
62
+ There are a variety of ways to use these symbols.
63
+
64
+ As a toy example, suppose we are running an application under gdb using:
65
+
66
+ - ruby-3.0
67
+
68
+ - grpc-1.60.1.x86_64-linux.gem
69
+
70
+ At first, in gdb we might dump a grpc-ruby stack trace looking
71
+ something like this:
72
+
73
+ ```
74
+ (gdb) bt
75
+ #0 0x00007ffff7926e56 in epoll_wait (epfd=5, events=0x7ffff3cb4144, maxevents=100, timeout=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
76
+ #1 0x00007ffff383eb9e in ?? () from /home/.rvm/gems/ruby-3.0.0/gems/grpc-1.60.1-x86_64-linux/src/ruby/lib/grpc/3.0/grpc_c.so
77
+ #2 0x00007ffff355e002 in ?? () from /home/.rvm/gems/ruby-3.0.0/gems/grpc-1.60.1-x86_64-linux/src/ruby/lib/grpc/3.0/grpc_c.so
78
+ #3 0x00007ffff38466e2 in ?? () from /home/.rvm/gems/ruby-3.0.0/gems/grpc-1.60.1-x86_64-linux/src/ruby/lib/grpc/3.0/grpc_c.so
79
+ #4 0x00007ffff35ba2ea in ?? () from /home/.rvm/gems/ruby-3.0.0/gems/grpc-1.60.1-x86_64-linux/src/ruby/lib/grpc/3.0/grpc_c.so
80
+ #5 0x00007ffff34abf6b in ?? () from /home/.rvm/gems/ruby-3.0.0/gems/grpc-1.60.1-x86_64-linux/src/ruby/lib/grpc/3.0/grpc_c.so
81
+ #6 0x00007ffff7c67ca7 in rb_nogvl (func=0x7ffff34abed3, data1=0x0, ubf=<optimized out>, data2=<optimized out>, flags=<optimized out>) at thread.c:1669
82
+ #7 0x00007ffff34ab110 in ?? () from /home/.rvm/gems/ruby-3.0.0/gems/grpc-1.60.1-x86_64-linux/src/ruby/lib/grpc/3.0/grpc_c.so
83
+ #8 0x00007ffff7c6780c in thread_do_start (th=0x555555ad16e0) at thread.c:769
84
+ #9 thread_start_func_2 (th=th@entry=0x555555ad16e0, stack_start=<optimized out>) at thread.c:822
85
+ #10 0x00007ffff7c679a6 in thread_start_func_1 (th_ptr=<optimized out>) at /home/.rvm/src/ruby-3.0.0/thread_pthread.c:994
86
+ #11 0x00007ffff78a63ec in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:444
87
+ #12 0x00007ffff7926a4c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
88
+ ```
89
+
90
+ We could take the following steps to get more debug info:
91
+
92
+ <h3>1) Fetch the correct grpc-native-debug gem</h3>
93
+
94
+ ```
95
+ cd /home
96
+ gem fetch grpc-native-debug-1.60.1.x86_64-linux.gem
97
+ gem unpack grpc-native-debug-1.60.1.x86_64-linux.gem
98
+ ```
99
+
100
+ (note again the version and platform of `grpc-native-debug` must match the `grpc` gem)
101
+
102
+ <h3>2) Load debug symbols (for ruby-3.0)</h3>
103
+
104
+ ```
105
+ (gdb) info sharedlibrary
106
+ From To Syms Read Shared Object Library
107
+ ...
108
+ 0x00007ffff3497450 0x00007ffff3a61912 Yes (*) /home/.rvm/gems/ruby-3.0.0/gems/grpc-1.60.1-x86_64-linux/src/ruby/lib/grpc/3.0/grpc_c.so
109
+ 0x00007ffff3e78730 0x00007ffff3ea60df Yes (*) /home/.rvm/gems/ruby-3.0.0/gems/google-protobuf-3.24.4-x86_64-linux/lib/google/3.0/protobuf_c.so
110
+ (*): Shared library is missing debugging information.
111
+ (gdb) add-symbol-file /home/grpc-native-debug-1.60.1-x86_64-linux/symbols/grpc-1.60.1-x86_64-linux-ruby-3.0.dbg 0x00007ffff3497450
112
+ add symbol table from file "/home/grpc-native-debug-1.60.1-x86_64-linux/symbols/grpc-1.60.1-x86_64-linux-ruby-3.0.dbg" at
113
+ .text_addr = 0x7ffff3497450
114
+ (y or n) y
115
+ Reading symbols from /home/grpc-native-debug-1.60.1-x86_64-linux/symbols/grpc-1.60.1-x86_64-linux-ruby-3.0.dbg...
116
+ (gdb)
117
+ ```
118
+
119
+ Our stack trace might look more like this now:
120
+
121
+ ```
122
+ (gdb) bt
123
+ #0 0x00007ffff7926e56 in epoll_wait (epfd=5, events=0x7ffff3cb4144, maxevents=100, timeout=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
124
+ #1 0x00007ffff383eb9e in do_epoll_wait (ps=0x555555ad1690, deadline=...) at src/core/lib/iomgr/ev_epoll1_linux.cc:723
125
+ #2 pollset_work (ps=0x555555ad1690, worker_hdl=0x0, deadline=...) at src/core/lib/iomgr/ev_epoll1_linux.cc:1038
126
+ #3 0x00007ffff355e002 in pollset_work (pollset=<optimized out>, worker=<optimized out>, deadline=...) at src/core/lib/iomgr/ev_posix.cc:249
127
+ #4 0x00007ffff38466e2 in grpc_pollset_work (pollset=<optimized out>, worker=<optimized out>, deadline=...) at src/core/lib/iomgr/pollset.cc:48
128
+ #5 0x00007ffff35ba2ea in cq_next (cq=0x555555ad1510, deadline=..., reserved=<optimized out>) at src/core/lib/surface/completion_queue.cc:1043
129
+ #6 0x00007ffff34abf6b in run_poll_channels_loop_no_gil (arg=arg@entry=0x0) at ../../../../src/ruby/ext/grpc/rb_channel.c:663
130
+ #7 0x00007ffff7c67ca7 in rb_nogvl (func=0x7ffff34abed3 <run_poll_channels_loop_no_gil>, data1=0x0, ubf=<optimized out>, data2=<optimized out>, flags=flags@entry=0) at thread.c:1669
131
+ #8 0x00007ffff7c68138 in rb_thread_call_without_gvl (func=<optimized out>, data1=<optimized out>, ubf=<optimized out>, data2=<optimized out>) at thread.c:1785
132
+ #9 0x00007ffff34ab110 in run_poll_channels_loop (arg=<optimized out>) at ../../../../src/ruby/ext/grpc/rb_channel.c:734
133
+ #10 0x00007ffff7c6780c in thread_do_start (th=0x555555ad16e0) at thread.c:769
134
+ #11 thread_start_func_2 (th=th@entry=0x555555ad16e0, stack_start=<optimized out>) at thread.c:822
135
+ #12 0x00007ffff7c679a6 in thread_start_func_1 (th_ptr=<optimized out>) at /home/.rvm/src/ruby-3.0.0/thread_pthread.c:994
136
+ #13 0x00007ffff78a63ec in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:444
137
+ #14 0x00007ffff7926a4c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
138
+ ```
139
+
140
+ This is better, but if we try to examine a frame closely we'll notice
141
+ that source file information is still missing:
142
+
143
+ ```
144
+ (gdb) up
145
+ #1 0x00007ffff383eb9e in do_epoll_wait (ps=0x555555ad1690, deadline=...) at src/core/lib/iomgr/ev_epoll1_linux.cc:723
146
+ 723 src/core/lib/iomgr/ev_epoll1_linux.cc: No such file or directory.
147
+ (gdb) list
148
+ 718 in src/core/lib/iomgr/ev_epoll1_linux.cc
149
+ (gdb)
150
+ ```
151
+
152
+ <h3>3) Resolve source files</h3>
153
+
154
+ First, we fetch the *source* `grpc` gem at the **exact same version** of our binary
155
+ `grpc` gem:
156
+
157
+ ```
158
+ cd /home
159
+ gem fetch grpc-1.60.1.gem
160
+ gem unpack grpc-1.60.1.gem
161
+ ```
162
+
163
+ Now we can load those sources in gdb:
164
+
165
+ ```
166
+ (gdb) dir /home/grpc-1.60.1
167
+ Source directories searched: /home/grpc-1.60.1:$cdir:$cwd
168
+ (gdb)
169
+ ```
170
+
171
+ Our stack frame will might look more like this now:
172
+
173
+ ```
174
+ (gdb) list
175
+ warning: Source file is more recent than executable.
176
+ 718 int timeout = poll_deadline_to_millis_timeout(deadline);
177
+ 719 if (timeout != 0) {
178
+ 720 GRPC_SCHEDULING_START_BLOCKING_REGION;
179
+ 721 }
180
+ 722 do {
181
+ 723 r = epoll_wait(g_epoll_set.epfd, g_epoll_set.events, MAX_EPOLL_EVENTS,
182
+ 724 timeout);
183
+ 725 } while (r < 0 && errno == EINTR);
184
+ 726 if (timeout != 0) {
185
+ 727 GRPC_SCHEDULING_END_BLOCKING_REGION;
186
+ (gdb)
187
+ ```
188
+
189
+ But if we move up a few stack frames we might *still* be missing
190
+ some source information:
191
+
192
+ ```
193
+ (gdb) up
194
+ #6 0x00007ffff34abf6b in run_poll_channels_loop_no_gil (arg=arg@entry=0x0) at ../../../../src/ruby/ext/grpc/rb_channel.c:663
195
+ 663 ../../../../src/ruby/ext/grpc/rb_channel.c: No such file or directory.
196
+ ```
197
+
198
+ A portion of the grpc-ruby native extension is built from a sub-directory:
199
+ `src/ruby/ext/grpc`. So we also need to add that sub-directory, to fix this:
200
+
201
+ ```
202
+ (gdb) dir /home/grpc-1.60.1/src/ruby/ext/grpc
203
+ Source directories searched: /home/grpc-1.60.1/src/ruby/ext/grpc:/home/grpc-1.60.1:$cdir:$cwd
204
+ ```
205
+
206
+ Note the additional info:
207
+
208
+ ```
209
+ (gdb) list
210
+ warning: Source file is more recent than executable.
211
+ 658 gpr_mu_lock(&global_connection_polling_mu);
212
+ 659 gpr_cv_broadcast(&global_connection_polling_cv);
213
+ 660 gpr_mu_unlock(&global_connection_polling_mu);
214
+ 661
215
+ 662 for (;;) {
216
+ 663 event = grpc_completion_queue_next(
217
+ 664 g_channel_polling_cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
218
+ 665 if (event.type == GRPC_QUEUE_SHUTDOWN) {
219
+ 666 break;
220
+ 667 }
221
+ (gdb)
222
+ ```
223
+
224
+ # Support
225
+
226
+ grpc-native-debug currently only supports:
227
+
228
+ - ruby platforms: `x86_64-linux` and `x86-linux`
229
+
230
+ - grpc >= 1.60.0
data/platform.rb ADDED
@@ -0,0 +1,19 @@
1
+ # Copyright 2015 gRPC authors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module GRPC
16
+ module NativeDebug
17
+ PLATFORM = 'x86_64-linux'
18
+ end
19
+ end
data/version.rb ADDED
@@ -0,0 +1,19 @@
1
+ # Copyright 2015 gRPC authors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module GRPC
16
+ module NativeDebug
17
+ VERSION = '1.60.0.pre1'
18
+ end
19
+ end
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: grpc-native-debug
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.60.0.pre1
5
+ platform: x86_64-linux
6
+ authors:
7
+ - grpc Authors
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-11-13 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Debug symbols to compliment the native libraries in pre-compiled Ruby
14
+ gRPC binary gems
15
+ email: grpc-io@googlegroups.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - README.md
21
+ - platform.rb
22
+ - symbols/grpc-1.60.0.pre1-x86_64-linux-ruby-2.7.dbg
23
+ - symbols/grpc-1.60.0.pre1-x86_64-linux-ruby-3.0.dbg
24
+ - symbols/grpc-1.60.0.pre1-x86_64-linux-ruby-3.1.dbg
25
+ - symbols/grpc-1.60.0.pre1-x86_64-linux-ruby-3.2.dbg
26
+ - version.rb
27
+ homepage: https://github.com/google/grpc/tree/master/src/ruby/nativedebug
28
+ licenses:
29
+ - Apache-2.0
30
+ metadata: {}
31
+ post_install_message:
32
+ rdoc_options: []
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">"
43
+ - !ruby/object:Gem::Version
44
+ version: 1.3.1
45
+ requirements: []
46
+ rubygems_version: 3.4.1
47
+ signing_key:
48
+ specification_version: 4
49
+ summary: Debug symbols for the native library in Ruby gRPC
50
+ test_files: []