Skip to content

Commit c61393a

Browse files
committed
support viewing non-current threads backtraces
1 parent 9ff8728 commit c61393a

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

lib/ruby-debug-ide/commands/threads.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,31 @@ def help(cmd)
5959
end
6060
end
6161

62+
class ThreadInspectCommand < Command # :nodoc:
63+
self.control = true
64+
self.need_context = true
65+
66+
def regexp
67+
/^\s*th(?:read)?\s+in(?:spect)?\s+(\d+)\s*$/
68+
end
69+
70+
def execute
71+
@state.context = get_context(@match[1].to_i)
72+
end
73+
74+
class << self
75+
def help_command
76+
'thread'
77+
end
78+
79+
def help(cmd)
80+
%{
81+
th[read] in[spect] <nnn>\tswitch thread context to nnn but don't resume any threads
82+
}
83+
end
84+
end
85+
end
86+
6287
class ThreadStopCommand < Command # :nodoc:
6388
self.control = true
6489
self.need_context = true

lib/ruby-debug-ide/ide_processor.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ def process_commands
4242
end
4343
else
4444
@printer.print_msg "Unknown command: #{input}"
45-
end
45+
end
4646
end
4747
end
48+
state.restore_context
4849
end
4950
rescue IOError, Errno::EPIPE
5051
@printer.print_error "INTERNAL ERROR!!! #{$!}\n" rescue nil
@@ -105,7 +106,8 @@ def process_commands
105106

106107
class State # :nodoc:
107108

108-
attr_accessor :context, :file, :line, :binding
109+
attr_accessor :context, :original_context
110+
attr_accessor :file, :line, :binding
109111
attr_accessor :frame_pos, :previous_line
110112
attr_accessor :interface
111113

@@ -114,6 +116,7 @@ def initialize
114116
@previous_line = nil
115117
@proceed = false
116118
yield self
119+
@original_context = context
117120
end
118121

119122
def print(*args)
@@ -127,6 +130,10 @@ def proceed?
127130
def proceed
128131
@proceed = true
129132
end
133+
134+
def restore_context
135+
context = @original_context
136+
end
130137
end
131138

132139
class ControlState # :nodoc:

lib/ruby-debug-ide/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Debugger
2-
IDE_VERSION='0.4.18'
2+
IDE_VERSION='0.4.21.pre1'
33
end

0 commit comments

Comments
 (0)