Skip to content

Commit 2fe205e

Browse files
Merge branch 'master' into alias-whereami-command
2 parents 9acb310 + bad4d38 commit 2fe205e

File tree

13 files changed

+124
-8
lines changed

13 files changed

+124
-8
lines changed

lib/debug/breakpoint.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def safe_eval b, expr
2323
b.eval(expr)
2424
rescue Exception => e
2525
puts "[EVAL ERROR]"
26-
puts " expr: #{expr}"
26+
puts " expr: #{expr.inspect}"
2727
puts " err: #{e} (#{e.class})"
2828
puts "Error caused by #{self}."
2929
nil
@@ -352,7 +352,7 @@ def setup
352352
next if ThreadClient.current.management?
353353
next if skip_path?(tp.path)
354354

355-
if need_suspend? safe_eval(tp.binding, @cond)
355+
if @cond.nil? || need_suspend?(safe_eval(tp.binding, @cond))
356356
suspend
357357
end
358358
}

lib/debug/console.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ def history_file
163163
path = File.join(File.expand_path(state_dir), 'rdbg', 'history')
164164
end
165165

166+
require 'fileutils'
166167
FileUtils.mkdir_p(File.dirname(path)) unless File.exist?(path)
167168
path
168169
end

lib/debug/frame_info.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def parameters_info
171171

172172
private def get_singleton_class obj
173173
obj.singleton_class # TODO: don't use it
174-
rescue TypeError
174+
rescue Exception
175175
nil
176176
end
177177

lib/debug/server.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# frozen_string_literal: true
22

33
require 'socket'
4+
require 'fileutils'
45
require_relative 'config'
56
require_relative 'version'
67

lib/debug/server_dap.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def process_request req
358358
}
359359
send_response req, breakpoints: (bps.map do |bp| {verified: true,} end)
360360
else
361-
send_response req, success: false, message: "#{req_path} is not available"
361+
send_response req, breakpoints: (args['breakpoints'].map do |bp| {verified: false, message: "#{req_path} could not be located; specify source location in launch.json with \"localfsMap\" or \"localfs\""} end)
362362
end
363363

364364
when 'setFunctionBreakpoints'

lib/debug/thread_client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@ def initialize
13101310
frame._local_variables = b.local_variables.map{|name|
13111311
[name, b.local_variable_get(name)]
13121312
}.to_h
1313-
frame._callee = b.eval('__callee__')
1313+
frame._callee = b.eval('::Kernel.__callee__')
13141314
end
13151315
}
13161316
append(frames)

lib/debug/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module DEBUGGER__
4-
VERSION = "1.11.0"
4+
VERSION = "1.11.1"
55
end

test/console/backtrace_test.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,31 @@ def test_backtrace_prints_without_hanging
229229
end
230230
end
231231
end
232+
233+
class BrokenSingletonMethodBacktraceTest < ConsoleTestCase
234+
def program
235+
<<~RUBY
236+
1| class C
237+
2| def self.foo
238+
3| debugger
239+
4| end
240+
5| def singleton_class
241+
6| raise
242+
7| end
243+
8| def self.singleton_class
244+
9| eval(")") # SyntaxError
245+
10| end
246+
11| end
247+
12| C.foo
248+
RUBY
249+
end
250+
251+
def test_raise_exception
252+
debug_code program do
253+
type 'c'
254+
assert_line_text(/foo/)
255+
type 'c'
256+
end
257+
end
258+
end
232259
end

test/console/break_test.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,17 @@ def test_break_only_stops_when_path_matches
255255
end
256256
end
257257

258+
def test_break_only_path
259+
with_extra_tempfile "foohtml" do |extra_file|
260+
debug_code(program(extra_file.path)) do
261+
type "break path: #{extra_file.path}"
262+
type 'c'
263+
assert_line_text(/#{extra_file.path}/)
264+
type 'c'
265+
end
266+
end
267+
end
268+
258269
def test_the_path_option_supersede_skip_path_config
259270
# skips the extra_file's breakpoint
260271
with_extra_tempfile do |extra_file|

test/console/record_test.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,4 +315,24 @@ def test_1663647719
315315
end
316316
end
317317
end
318+
319+
class RecordOnBasicClassTest < ConsoleTestCase
320+
def program
321+
<<~RUBY
322+
1| class Test < BasicObject
323+
2| def test
324+
3| 42
325+
4| end
326+
5| end
327+
6| Test.new.test
328+
RUBY
329+
end
330+
331+
def test_issue1152
332+
debug_code program do
333+
type 'record on'
334+
type 'c'
335+
end
336+
end
337+
end
318338
end

0 commit comments

Comments
 (0)