Skip to content

[ruby] create debug symbol packages#34632

Merged
apolcyn merged 58 commits intogrpc:masterfrom
apolcyn:rb_dbg_symbols
Oct 17, 2023
Merged

[ruby] create debug symbol packages#34632
apolcyn merged 58 commits intogrpc:masterfrom
apolcyn:rb_dbg_symbols

Conversation

@apolcyn
Copy link
Copy Markdown
Contributor

@apolcyn apolcyn commented Oct 9, 2023

Introduce grpc-native-debug gems containing debug symbol packages that complement the shared libraries shipped in pre-compiled binary gems.

Example package layout (1.60.0.dev is the "version" in this example):

$ find grpc-native-debug-1.60.0.dev-x86_64-linux/
grpc-native-debug-1.60.0.dev-x86_64-linux/
grpc-native-debug-1.60.0.dev-x86_64-linux/symbols
grpc-native-debug-1.60.0.dev-x86_64-linux/symbols/grpc-1.60.0.dev-x86_64-linux-ruby-3.0.dbg
grpc-native-debug-1.60.0.dev-x86_64-linux/symbols/grpc-1.60.0.dev-x86_64-linux-ruby-2.7.dbg
grpc-native-debug-1.60.0.dev-x86_64-linux/symbols/grpc-1.60.0.dev-x86_64-linux-ruby-3.2.dbg
grpc-native-debug-1.60.0.dev-x86_64-linux/symbols/grpc-1.60.0.dev-x86_64-linux-ruby-3.1.dbg
grpc-native-debug-1.60.0.dev-x86_64-linux/README.md
grpc-native-debug-1.60.0.dev-x86_64-linux/version.rb
grpc-native-debug-1.60.0.dev-x86_64-linux/platform.rb

Intended Usage

  1. Fetch the grpc-native-debug package matching the RUBY_PLATFORM and version of the grpc gem being debugged. For example, if using grpc-1.60-x86_64-linux.gem, then fetch grpc-native-debug-1.60-x86_64-linux.gem.

  2. Unpack the gem and find the symbols directory

  3. Find the .dbg file matching the version of ruby being used (there are separate shared libraries for each ruby version so we also need separate .dbg files).

  4. Use the symbols however needed. For example, to load in gdb one can follow https://stackoverflow.com/questions/30281766/need-to-load-debugging-symbols-for-shared-library-in-gdb.

Caveats

- currently only works for linux x86 and x86_64 libraries

Why not just include debug symbols in the shared libraries we ship?

If we stopped stripping the shared libraries in binary gems today, we'd multiply the package size by an order of magnitude.

For example, on linux x86_64, a stripped and compressed grpc_c.so is about 4MB. The same thing unstripped is ~80MB. There's a further multiplying effect because we include ~4 different extension libraries in each binary gem - one for each ruby minor version. Considering that the linux x86_64 gem is ~18MB today, > 300MB would be a 10-20X size increase.

@apolcyn apolcyn added lang/ruby release notes: yes Indicates if PR needs to be in release notes labels Oct 9, 2023
@apolcyn apolcyn merged commit 36af323 into grpc:master Oct 17, 2023
@apolcyn
Copy link
Copy Markdown
Contributor Author

apolcyn commented Oct 17, 2023

cc @dazuma FYI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bloat/none imported Specifies if the PR has been imported to the internal repository lang/ruby per-call-memory/neutral per-channel-memory/neutral release notes: yes Indicates if PR needs to be in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants