Skip to content

Instantly share code, notes, and snippets.

@wjessop
Created November 24, 2015 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wjessop/fb61b2c3dad204bc9b6b to your computer and use it in GitHub Desktop.
Save wjessop/fb61b2c3dad204bc9b6b to your computer and use it in GitHub Desktop.
Ruby compiled with:
'optflags=-O0' 'debugflags=-g3 -ggdb' 'CFLAGS=-O0 -g3 -ggdb'
Confirmed with:
ruby -e 'puts RbConfig::CONFIG["CFLAGS"]'
GDB output shows it reading symbold from Rub, but setting a breakpoint GDB can't find the symbol requested and ultimately never breaks:
root@6ceb0a45e984:/tmp/activesupport# gdb --args /opt/ruby2.2.3/bin/ruby -e '"new string"'
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 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".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /opt/ruby2.2.3/bin/ruby...done.
(gdb) b rb_str_new
Function "rb_str_new" not defined.
Make breakpoint pending on future shared library load? (y or [n])
(gdb) run
Starting program: /opt/ruby2.2.3/bin/ruby -e \"new\ string\"
During startup program exited normally.
(gdb)
Dumping symbols with nm gets ~30 symbols available:
root@6ceb0a45e984:/tmp/activesupport# nm /opt/ruby2.2.3/bin/ruby
0000000000600e30 d _DYNAMIC
0000000000600fe8 d _GLOBAL_OFFSET_TABLE_
00000000004009c8 R _IO_stdin_used
w _Jv_RegisterClasses
0000000000600e10 d __CTOR_END__
0000000000600e08 d __CTOR_LIST__
0000000000600e20 d __DTOR_END__
0000000000600e18 d __DTOR_LIST__
0000000000400aa0 r __FRAME_END__
0000000000600e28 d __JCR_END__
0000000000600e28 d __JCR_LIST__
0000000000601048 A __bss_start
0000000000601038 D __data_start
0000000000400980 t __do_global_ctors_aux
00000000004007e0 t __do_global_dtors_aux
0000000000601040 d __dso_handle
w __gmon_start__
0000000000600e04 d __init_array_end
0000000000600e04 d __init_array_start
0000000000400970 T __libc_csu_fini
00000000004008e0 T __libc_csu_init
U __libc_start_main@@GLIBC_2.2.5
0000000000601048 A _edata
0000000000601058 A _end
00000000004009b8 T _fini
00000000004006f8 T _init
0000000000400790 T _start
00000000004007bc t call_gmon_start
0000000000601048 b completed.6531
0000000000601038 W data_start
0000000000601050 b dtor_idx.6533
0000000000400850 t frame_dummy
0000000000400874 t main
U ruby_init
U ruby_init_stack
U ruby_options
U ruby_run_node
U ruby_sysinit
U setlocale@@GLIBC_2.2.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment