Skip to content

Instantly share code, notes, and snippets.

@jasonrclark
Created November 25, 2015 15:55
Show Gist options
  • Save jasonrclark/c7e547037b2c3801a5cf to your computer and use it in GitHub Desktop.
Save jasonrclark/c7e547037b2c3801a5cf to your computer and use it in GitHub Desktop.
$ ruby -e 'puts RbConfig::CONFIG["CFLAGS"]'
-O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat
$ gdb --args /usr/local/bin/ruby -e '"new string"'
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/bin/ruby...done.
(gdb) b rb_str_new
Breakpoint 1 at 0xfe2d9: rb_str_new. (25 locations)
(gdb) run
Starting program: /usr/local/bin/ruby -e \"new\ string\"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, rb_str_new_cstr (
ptr=0x555555767eed "exception reentered") at string.c:639
warning: Source file is more recent than executable.
639 return rb_str_new(ptr, strlen(ptr));
(gdb)
nm finds about 6600 lines
$ nm /usr/local/bin/ruby
00000000000eee20 t BSD__sfvwrite
00000000000eef00 t BSD_vfprintf
000000000021f800 r ByteValTable.11135
00000000004da200 d COMPILE_OPTION_DEFAULT
000000000027c950 r CR_ASCII
000000000025e4c0 r CR_Age_1_1
000000000025dac0 r CR_Age_2_0
000000000025d0c0 r CR_Age_2_1
000000000025c500 r CR_Age_3_
...
0000000000093bb0 T rb_Array
00000000001d03f0 T rb_Complex
00000000000932c0 T rb_Float
0000000000093c10 T rb_Hash
00000000000217c5 t rb_Hash.part.24
0000000000092840 T rb_Integer
00000000000b7400 T rb_Rational
0000000000093ac0 T rb_String
00000000001b5bc0 T rb_absint_numwords
00000000001b52b0 t rb_absint_numwords.part.25
00000000001b5be0 T rb_absint_singlebit_p
00000000001b4de0 T rb_absint_size
0000000000181ab0 T rb_add_event_hook
0000000000181ca0 T rb_add_event_hook2
0000000000174e30 t rb_add_method
0000000000175160 t rb_add_method_cfunc
00000000001751d0 t rb_add_refined_method_entry
0000000000175ce0 T rb_alias
000000000013e730 T rb_alias_variable
0000000000102a90 T rb_alloc_tmp_buffer
000000000004bb20 t rb_any_cmp
0000000000050ac0 t rb_any_hash
000000000008e6a0 T rb_any_to_s
000000000016e330 T rb_apply
00000000004eae00 B rb_argv0
000000000015f2c0 t rb_arity_error_new
000000000019dc90 t rb_ary_and
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment