stop_in_debugger 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 91de2e6b917ef3d694226c705b553e39c73958ebf98e0eed6e026c17cb9a5ab8
4
+ data.tar.gz: d6b4bc3c28315d86d8b5fe4f42303c3224e31c56e560c9d0c899b9b2621b52f9
5
+ SHA512:
6
+ metadata.gz: 5a6ee0ad6f368084a14621bd1d84660a0f0ed4bb63124abf7ba9727d5de9e03f7664d904f76c04fcbb5e1d5a11cda28eeb2f7aa6f78d36ca177ce6332125bf76
7
+ data.tar.gz: 949e8dcedc187bbaa1e2931dae90c50ddf0dc02d12ac863b4eeab10285482cd87e6af893e850424a50318a5393e7d6e7c3247a1ff29d510a8066c76900c752e5
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.bundle
10
+ *.so
11
+ *.o
12
+ *.a
13
+ mkmf.log
14
+ /compile_commands.json
15
+ /.clangd/
@@ -0,0 +1 @@
1
+ 2.6.5
@@ -0,0 +1,18 @@
1
+ sudo: false
2
+ language: ruby
3
+
4
+ os:
5
+ - linux
6
+ - osx
7
+
8
+ before_install: gem install bundler
9
+
10
+ deploy:
11
+ provider: rubygems
12
+ api_key:
13
+ secure: So3EmqgB/lKUXg2Wd69u0o/QbmcwsXwBhmaGMUmLaz1gEMVBXGo4Kcj/n5QgQkIdv2IlNHjUjfTEhnW0Fy+84qMzwz6U08Xpf2c+GBVWjSF2HvwfKI+yO1n9GMHqWPjYC4EMr51gNlqoMl/jUJmKdaEHScndp++q/ET5iaXU8Vn7hR0DMDVwdc7VQc8tnTCb1JVI3aYKIWkdXqAzpWwk8a9/HWCfKmz0fiURY2O1uzbYY28aPskaznTEMW3StGSk8mybXnbg+WaCw7HGTSKVGZKlot8d1yvwkGLw+IGJ257KzlMhJ9FxADhMxjmd8ukwiODO9rQ1K7p/tUIBg8ePQLqhtTOIE8rvUVBt4JuBD+SQt5K8URClg3qLInHXdGiONf9DyOZl2NqHZi0g5N/DWGd2jbmS80tAft5QNCBrWoLUe3aLLVmEn1uTmTBGGfj+7hr4IEN8qK+zIVy52pdjoagp6Nio4zAx6lLWi29lFCenLxyQVq8nZ3sYtF25G3xBowerrjrgusF3Ze43cmD8G9sNXFnV8SiCGATXVWe2FGgHCI3KkXNlw7d7pAgXWSjDd0Cm51WBbGkiz4Hb8f5xCwYgWLJG6l4nXi3daoCay7eP5aCZYiNxO2bNmkIQJ7sN6l9iscJRb27xWhfL4FhR2ZiGBiMq0YaEq5mQVf1d2eg=
14
+ gem: stop_in_debugger
15
+ on:
16
+ tags: true
17
+ repo: jez/stop_in_debugger
18
+ skip_cleanup: 'true'
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in stop_in_debugger.gemspec
6
+ gemspec
@@ -0,0 +1,22 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ stop_in_debugger (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ rake (13.0.1)
10
+ rake-compiler (1.1.1)
11
+ rake
12
+
13
+ PLATFORMS
14
+ ruby
15
+
16
+ DEPENDENCIES
17
+ rake (>= 12.3.3)
18
+ rake-compiler
19
+ stop_in_debugger!
20
+
21
+ BUNDLED WITH
22
+ 1.17.2
@@ -0,0 +1,55 @@
1
+ # Blue Oak Model License
2
+
3
+ Version 1.0.0
4
+
5
+ ## Purpose
6
+
7
+ This license gives everyone as much permission to work with
8
+ this software as possible, while protecting contributors
9
+ from liability.
10
+
11
+ ## Acceptance
12
+
13
+ In order to receive this license, you must agree to its
14
+ rules. The rules of this license are both obligations
15
+ under that agreement and conditions to your license.
16
+ You must not do anything with this software that triggers
17
+ a rule that you cannot or will not follow.
18
+
19
+ ## Copyright
20
+
21
+ Each contributor licenses you to do everything with this
22
+ software that would otherwise infringe that contributor's
23
+ copyright in it.
24
+
25
+ ## Notices
26
+
27
+ You must ensure that everyone who gets a copy of
28
+ any part of this software from you, with or without
29
+ changes, also gets the text of this license or a link to
30
+ <https://blueoakcouncil.org/license/1.0.0>.
31
+
32
+ ## Excuse
33
+
34
+ If anyone notifies you in writing that you have not
35
+ complied with [Notices](#notices), you can keep your
36
+ license by taking all practical steps to comply within 30
37
+ days after the notice. If you do not do so, your license
38
+ ends immediately.
39
+
40
+ ## Patent
41
+
42
+ Each contributor licenses you to do everything with this
43
+ software that would otherwise infringe any patent claims
44
+ they can license or become able to license.
45
+
46
+ ## Reliability
47
+
48
+ No contributor can revoke this license.
49
+
50
+ ## No Liability
51
+
52
+ ***As far as the law allows, this software comes as is,
53
+ without any warranty or condition, and no contributor
54
+ will be liable to anyone for any damages related to this
55
+ software or this license, under any kind of legal claim.***
@@ -0,0 +1,60 @@
1
+ # StopInDebugger
2
+
3
+ Stop in a C debugger (like GDB or LLDB) when a Ruby method is called.
4
+
5
+ Useful to debug the Ruby VM itself and learn how it works, as the Ruby VM is
6
+ implemented in C.
7
+
8
+ ```ruby
9
+ # -- test/main.rb --
10
+ require 'stop_in_debugger'
11
+
12
+ def hello
13
+ puts 'Hello, world!'
14
+ end
15
+
16
+ # Execution will halt here if a debugger is attached, or
17
+ # the program will exit if a debugger is not attached.
18
+ StopInDebugger.stop_in_debugger
19
+
20
+ hello
21
+ ```
22
+
23
+ A sample debugger session looks like this:
24
+
25
+ ```
26
+ ❯ bundle exec lldb -- $(rbenv which ruby) test/main.rb
27
+ ```
28
+
29
+ Or with colors:
30
+
31
+ ![lldb session using stop in debugger](lldb-example.png)
32
+
33
+ From there, you can add whatever breakpoints you want. This works best when
34
+ you've built Ruby with debug symbols and no optimizations.
35
+
36
+ ## Installation
37
+
38
+ This gem is on RubyGems.org, so you can make your Gemfile look like this:
39
+
40
+ ```ruby
41
+ # -- Gemfile --
42
+ source 'https://rubygems.org'
43
+ gem 'stop_in_debugger'
44
+ ```
45
+
46
+ and then install with:
47
+
48
+ ```
49
+ bundle install
50
+ ```
51
+
52
+ ## Developing
53
+
54
+ ```bash
55
+ bundle install
56
+ bundle exec rake
57
+
58
+ # to generate a compile_commands.json file for clangd
59
+ bundle exec rake compile_commands
60
+ ```
@@ -0,0 +1,14 @@
1
+ require "rake/extensiontask"
2
+
3
+ task :build => :compile
4
+
5
+ Rake::ExtensionTask.new("stop_in_debugger") do |ext|
6
+ ext.lib_dir = "lib/stop_in_debugger"
7
+ end
8
+
9
+ task :default => [:clobber, :compile]
10
+
11
+ task :compile_commands do
12
+ # Requires https://github.com/rizsotto/Bear
13
+ system "bear bundle exec rake"
14
+ end
@@ -0,0 +1,266 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ # V=0 quiet, V=1 verbose. other values don't work.
5
+ V = 0
6
+ Q1 = $(V:1=)
7
+ Q = $(Q1:0=@)
8
+ ECHO1 = $(V:1=@ :)
9
+ ECHO = $(ECHO1:0=@ echo)
10
+ NULLCMD = :
11
+
12
+ #### Start of system configuration section. ####
13
+
14
+ srcdir = .
15
+ topdir = /home/jez/.rbenv/versions/2.6.5/include/ruby-2.6.0
16
+ hdrdir = $(topdir)
17
+ arch_hdrdir = /home/jez/.rbenv/versions/2.6.5/include/ruby-2.6.0/x86_64-linux
18
+ PATH_SEPARATOR = :
19
+ VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
20
+ prefix = $(DESTDIR)/home/jez/.rbenv/versions/2.6.5
21
+ rubysitearchprefix = $(rubylibprefix)/$(sitearch)
22
+ rubyarchprefix = $(rubylibprefix)/$(arch)
23
+ rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
24
+ exec_prefix = $(prefix)
25
+ vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
26
+ sitearchhdrdir = $(sitehdrdir)/$(sitearch)
27
+ rubyarchhdrdir = $(rubyhdrdir)/$(arch)
28
+ vendorhdrdir = $(rubyhdrdir)/vendor_ruby
29
+ sitehdrdir = $(rubyhdrdir)/site_ruby
30
+ rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
31
+ vendorarchdir = $(vendorlibdir)/$(sitearch)
32
+ vendorlibdir = $(vendordir)/$(ruby_version)
33
+ vendordir = $(rubylibprefix)/vendor_ruby
34
+ sitearchdir = $(sitelibdir)/$(sitearch)
35
+ sitelibdir = $(sitedir)/$(ruby_version)
36
+ sitedir = $(rubylibprefix)/site_ruby
37
+ rubyarchdir = $(rubylibdir)/$(arch)
38
+ rubylibdir = $(rubylibprefix)/$(ruby_version)
39
+ sitearchincludedir = $(includedir)/$(sitearch)
40
+ archincludedir = $(includedir)/$(arch)
41
+ sitearchlibdir = $(libdir)/$(sitearch)
42
+ archlibdir = $(libdir)/$(arch)
43
+ ridir = $(datarootdir)/$(RI_BASE_NAME)
44
+ mandir = $(datarootdir)/man
45
+ localedir = $(datarootdir)/locale
46
+ libdir = $(exec_prefix)/lib
47
+ psdir = $(docdir)
48
+ pdfdir = $(docdir)
49
+ dvidir = $(docdir)
50
+ htmldir = $(docdir)
51
+ infodir = $(datarootdir)/info
52
+ docdir = $(datarootdir)/doc/$(PACKAGE)
53
+ oldincludedir = $(DESTDIR)/usr/include
54
+ includedir = $(prefix)/include
55
+ runstatedir = $(localstatedir)/run
56
+ localstatedir = $(prefix)/var
57
+ sharedstatedir = $(prefix)/com
58
+ sysconfdir = $(prefix)/etc
59
+ datadir = $(datarootdir)
60
+ datarootdir = $(prefix)/share
61
+ libexecdir = $(exec_prefix)/libexec
62
+ sbindir = $(exec_prefix)/sbin
63
+ bindir = $(exec_prefix)/bin
64
+ archdir = $(rubyarchdir)
65
+
66
+
67
+ CC_WRAPPER =
68
+ CC = gcc
69
+ CXX = g++
70
+ LIBRUBY = $(LIBRUBY_SO)
71
+ LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
72
+ LIBRUBYARG_SHARED = -Wl,-rpath,'$${ORIGIN}/../lib' -Wl,-rpath,'$${ORIGIN}/../lib' -l$(RUBY_SO_NAME)
73
+ LIBRUBYARG_STATIC = -Wl,-rpath,'$${ORIGIN}/../lib' -Wl,-rpath,'$${ORIGIN}/../lib' -l$(RUBY_SO_NAME)-static $(MAINLIBS)
74
+ empty =
75
+ OUTFLAG = -o $(empty)
76
+ COUTFLAG = -o $(empty)
77
+ CSRCFLAG = $(empty)
78
+
79
+ RUBY_EXTCONF_H =
80
+ cflags = $(optflags) $(debugflags) $(warnflags)
81
+ cxxflags = $(optflags) $(debugflags) $(warnflags)
82
+ optflags = -O3
83
+ debugflags = -ggdb3
84
+ warnflags = -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wno-maybe-uninitialized
85
+ cppflags =
86
+ CCDLFLAGS = -fPIC
87
+ CFLAGS = $(CCDLFLAGS) $(cflags) -fPIC $(ARCH_FLAG)
88
+ INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
89
+ DEFS =
90
+ CPPFLAGS = -I/home/jez/.rbenv/versions/2.6.5/include -I/home/jez/.local/include $(DEFS) $(cppflags)
91
+ CXXFLAGS = $(CCDLFLAGS) $(cxxflags) $(ARCH_FLAG)
92
+ ldflags = -L. -L/home/jez/.rbenv/versions/2.6.5/lib -L/home/jez/.local/lib -fstack-protector-strong -rdynamic -Wl,-export-dynamic
93
+ dldflags = -L/home/jez/.rbenv/versions/2.6.5/lib -L/home/jez/.local/lib -Wl,--compress-debug-sections=zlib
94
+ ARCH_FLAG =
95
+ DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
96
+ LDSHARED = $(CC) -shared
97
+ LDSHAREDXX = $(CXX) -shared
98
+ AR = ar
99
+ EXEEXT =
100
+
101
+ RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
102
+ RUBY_SO_NAME = ruby
103
+ RUBYW_INSTALL_NAME =
104
+ RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
105
+ RUBYW_BASE_NAME = rubyw
106
+ RUBY_BASE_NAME = ruby
107
+
108
+ arch = x86_64-linux
109
+ sitearch = $(arch)
110
+ ruby_version = 2.6.0
111
+ ruby = $(bindir)/$(RUBY_BASE_NAME)
112
+ RUBY = $(ruby)
113
+ ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
114
+
115
+ RM = rm -f
116
+ RM_RF = $(RUBY) -run -e rm -- -rf
117
+ RMDIRS = rmdir --ignore-fail-on-non-empty -p
118
+ MAKEDIRS = /bin/mkdir -p
119
+ INSTALL = /usr/bin/install -c
120
+ INSTALL_PROG = $(INSTALL) -m 0755
121
+ INSTALL_DATA = $(INSTALL) -m 644
122
+ COPY = cp
123
+ TOUCH = exit >
124
+
125
+ #### End of system configuration section. ####
126
+
127
+ preload =
128
+ libpath = . $(libdir)
129
+ LIBPATH = -L. -L$(libdir) -Wl,-rpath,$(libdir)
130
+ DEFFILE =
131
+
132
+ CLEANFILES = mkmf.log
133
+ DISTCLEANFILES =
134
+ DISTCLEANDIRS =
135
+
136
+ extout =
137
+ extout_prefix =
138
+ target_prefix = /stop_in_debugger
139
+ LOCAL_LIBS =
140
+ LIBS = $(LIBRUBYARG_SHARED) -lm -lc
141
+ ORIG_SRCS = stop_in_debugger.c
142
+ SRCS = $(ORIG_SRCS)
143
+ OBJS = stop_in_debugger.o
144
+ HDRS =
145
+ LOCAL_HDRS =
146
+ TARGET = stop_in_debugger
147
+ TARGET_NAME = stop_in_debugger
148
+ TARGET_ENTRY = Init_$(TARGET_NAME)
149
+ DLLIB = $(TARGET).so
150
+ EXTSTATIC =
151
+ STATIC_LIB =
152
+
153
+ TIMESTAMP_DIR = .
154
+ BINDIR = $(bindir)
155
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
156
+ RUBYLIBDIR = $(sitelibdir)$(target_prefix)
157
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
158
+ HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
159
+ ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
160
+ TARGET_SO_DIR =
161
+ TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
162
+ CLEANLIBS = $(TARGET_SO)
163
+ CLEANOBJS = *.o *.bak
164
+
165
+ all: $(DLLIB)
166
+ static: $(STATIC_LIB)
167
+ .PHONY: all install static install-so install-rb
168
+ .PHONY: clean clean-so clean-static clean-rb
169
+
170
+ clean-static::
171
+ clean-rb-default::
172
+ clean-rb::
173
+ clean-so::
174
+ clean: clean-so clean-static clean-rb-default clean-rb
175
+ -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
176
+
177
+ distclean-rb-default::
178
+ distclean-rb::
179
+ distclean-so::
180
+ distclean-static::
181
+ distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
182
+ -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
183
+ -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
184
+ -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
185
+
186
+ realclean: distclean
187
+ install: install-so install-rb
188
+
189
+ install-so: $(DLLIB) $(TIMESTAMP_DIR)/.sitearchdir.-.stop_in_debugger.time
190
+ $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
191
+ clean-static::
192
+ -$(Q)$(RM) $(STATIC_LIB)
193
+ install-rb: pre-install-rb do-install-rb install-rb-default
194
+ install-rb-default: pre-install-rb-default do-install-rb-default
195
+ pre-install-rb: Makefile
196
+ pre-install-rb-default: Makefile
197
+ do-install-rb:
198
+ do-install-rb-default:
199
+ pre-install-rb-default:
200
+ @$(NULLCMD)
201
+ $(TIMESTAMP_DIR)/.sitearchdir.-.stop_in_debugger.time:
202
+ $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
203
+ $(Q) $(TOUCH) $@
204
+
205
+ site-install: site-install-so site-install-rb
206
+ site-install-so: install-so
207
+ site-install-rb: install-rb
208
+
209
+ .SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
210
+
211
+ .cc.o:
212
+ $(ECHO) compiling $(<)
213
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
214
+
215
+ .cc.S:
216
+ $(ECHO) translating $(<)
217
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
218
+
219
+ .mm.o:
220
+ $(ECHO) compiling $(<)
221
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
222
+
223
+ .mm.S:
224
+ $(ECHO) translating $(<)
225
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
226
+
227
+ .cxx.o:
228
+ $(ECHO) compiling $(<)
229
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
230
+
231
+ .cxx.S:
232
+ $(ECHO) translating $(<)
233
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
234
+
235
+ .cpp.o:
236
+ $(ECHO) compiling $(<)
237
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
238
+
239
+ .cpp.S:
240
+ $(ECHO) translating $(<)
241
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
242
+
243
+ .c.o:
244
+ $(ECHO) compiling $(<)
245
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
246
+
247
+ .c.S:
248
+ $(ECHO) translating $(<)
249
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
250
+
251
+ .m.o:
252
+ $(ECHO) compiling $(<)
253
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
254
+
255
+ .m.S:
256
+ $(ECHO) translating $(<)
257
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
258
+
259
+ $(TARGET_SO): $(OBJS) Makefile
260
+ $(ECHO) linking shared-object stop_in_debugger/$(DLLIB)
261
+ -$(Q)$(RM) $(@)
262
+ $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
263
+
264
+
265
+
266
+ $(OBJS): $(HDRS) $(ruby_headers)
@@ -0,0 +1,3 @@
1
+ require "mkmf"
2
+
3
+ create_makefile("stop_in_debugger/stop_in_debugger")
@@ -0,0 +1,14 @@
1
+ #include "ruby.h"
2
+
3
+ // This only works on x86
4
+ __attribute__((noinline))
5
+ static VALUE stop_in_debugger(VALUE self) {
6
+ __asm__("int $3");
7
+ return Qnil;
8
+ } // 👋 Type 'finish' to return from this function, or add breakpoints and type 'continue'.
9
+
10
+ void Init_stop_in_debugger() {
11
+ VALUE cStopInDebugger;
12
+ cStopInDebugger = rb_define_class("StopInDebugger", rb_cObject);
13
+ rb_define_singleton_method(cStopInDebugger, "stop_in_debugger", stop_in_debugger, 0);
14
+ }
@@ -0,0 +1 @@
1
+ require 'stop_in_debugger/stop_in_debugger'
Binary file
@@ -0,0 +1,6 @@
1
+ # typed: strict
2
+
3
+ module StopInDebugger
4
+ sig {returns(NilClass)}
5
+ def self.stop_in_debugger; end
6
+ end
@@ -0,0 +1,27 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = "stop_in_debugger"
3
+ spec.version = "0.1.0"
4
+ spec.authors = ["Jake Zimmerman"]
5
+ spec.email = ["zimmerman.jake@gmail.com"]
6
+
7
+ spec.summary = "Stop in a C debugger when a Ruby method is called"
8
+ spec.homepage = "https://github.com/jez/stop_in_debugger"
9
+
10
+ if spec.respond_to?(:metadata)
11
+ spec.metadata["homepage_uri"] = spec.homepage
12
+ spec.metadata["source_code_uri"] = "https://github.com/jez/stop_in_debugger"
13
+ else
14
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
15
+ end
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = `git --git-dir #{File.expand_path('../.git', __FILE__)} ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+ spec.extensions = ["ext/stop_in_debugger/extconf.rb"]
24
+
25
+ spec.add_development_dependency 'rake', '>= 12.3.3'
26
+ spec.add_development_dependency 'rake-compiler'
27
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stop_in_debugger
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jake Zimmerman
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-07-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 12.3.3
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 12.3.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake-compiler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description:
42
+ email:
43
+ - zimmerman.jake@gmail.com
44
+ executables: []
45
+ extensions:
46
+ - ext/stop_in_debugger/extconf.rb
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - ".ruby-version"
51
+ - ".travis.yml"
52
+ - Gemfile
53
+ - Gemfile.lock
54
+ - LICENSE.md
55
+ - README.md
56
+ - Rakefile
57
+ - ext/stop_in_debugger/Makefile
58
+ - ext/stop_in_debugger/extconf.rb
59
+ - ext/stop_in_debugger/stop_in_debugger.c
60
+ - lib/stop_in_debugger.rb
61
+ - lldb-example.png
62
+ - rbi/stop_in_debugger.rbi
63
+ - stop_in_debugger.gemspec
64
+ homepage: https://github.com/jez/stop_in_debugger
65
+ licenses: []
66
+ metadata:
67
+ homepage_uri: https://github.com/jez/stop_in_debugger
68
+ source_code_uri: https://github.com/jez/stop_in_debugger
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubygems_version: 3.0.3
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: Stop in a C debugger when a Ruby method is called
88
+ test_files: []