debugger-xml 0.4.1 → 0.5.0.pre1
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.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/bin/{rdebug-ide → rdebug-xml} +27 -11
- data/debugger-xml.gemspec +2 -5
- data/ext/mkrf_conf.rb +32 -0
- data/lib/byebug/commands/eval.rb +5 -0
- data/lib/byebug/commands/var/ide.rb +27 -0
- data/lib/byebug/commands/var/inspect.rb +42 -0
- data/lib/byebug/context_xml.rb +15 -12
- data/lib/byebug/helpers/vars.rb +40 -0
- data/lib/byebug/printers/texts/xml.yml +8 -1
- data/lib/byebug/states/regular_xml_state.rb +9 -0
- data/lib/debugger_xml.rb +2 -2
- data/lib/debugger_xml/byebug_proxy.rb +88 -80
- data/lib/debugger_xml/debugger_proxy.rb +6 -2
- data/lib/debugger_xml/ide/interface.rb +8 -0
- data/lib/debugger_xml/ide/processor.rb +1 -1
- data/lib/debugger_xml/multiprocess/pre_child.rb +3 -3
- data/lib/debugger_xml/version.rb +1 -1
- data/lib/debugger_xml/vim/control_command_processor.rb +5 -7
- data/lib/debugger_xml/vim/interface.rb +1 -1
- metadata +15 -26
- data/lib/byebug/commands/frame.rb +0 -16
- data/lib/byebug/commands/inspect.rb +0 -30
- data/lib/byebug/commands/threads.rb +0 -10
- data/lib/byebug/commands/variables.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fb05bd1841ff5eb3055402d1df6f8b5d3fd7ae9
|
4
|
+
data.tar.gz: c09ec46079b00b063ff9d87dea83041f707f88ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c87886821d745b2af27faf0d5194ae41c5b3f27f82b01632d7ea1c2f49348500319d20e46009c01d5146003b510b3f11c17bcb68f7c432a3245716bdd02cccf0
|
7
|
+
data.tar.gz: 1755a9bd9bc4259ea2dea7ece26abcf2a1ad738f8a917c900fee02429ff87bd8f339b1b2788f2c055328132aa67be7c0862ca766951bf4d449880b45239fe064
|
data/.gitignore
CHANGED
@@ -3,8 +3,22 @@
|
|
3
3
|
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
|
4
4
|
require 'optparse'
|
5
5
|
require 'ostruct'
|
6
|
-
|
7
|
-
|
6
|
+
|
7
|
+
DEBUGGER_TYPE = if RUBY_VERSION < "2.0"
|
8
|
+
require 'debugger'
|
9
|
+
:debugger
|
10
|
+
else
|
11
|
+
require 'byebug'
|
12
|
+
:byebug
|
13
|
+
end
|
14
|
+
require 'debugger_xml'
|
15
|
+
if DEBUGGER_TYPE == :debugger
|
16
|
+
PROXY_CLASS = DebuggerXml::DebuggerProxy
|
17
|
+
PRINTER_CLASS = Printers::Xml
|
18
|
+
else
|
19
|
+
PROXY_CLASS = DebuggerXml::ByebugProxy
|
20
|
+
PRINTER_CLASS = Byebug::Printers::Xml
|
21
|
+
end
|
8
22
|
|
9
23
|
$stdout.sync = true
|
10
24
|
|
@@ -12,28 +26,30 @@ class RdebugIde
|
|
12
26
|
|
13
27
|
def initialize
|
14
28
|
check_argv!
|
15
|
-
@proxy =
|
29
|
+
@proxy = PROXY_CLASS.new
|
16
30
|
@proxy.set_argv(ARGV.clone)
|
31
|
+
# todo: we need to parse args first, need to make in more elegant way
|
32
|
+
options
|
17
33
|
@proxy.set_rdebug_script(rdebug_path)
|
18
34
|
@proxy.set_prog_script(ARGV.shift)
|
19
35
|
if options.int_handler
|
20
36
|
install_interruption_handler
|
21
37
|
end
|
22
38
|
@proxy.tracing = options.tracing
|
23
|
-
@proxy.printer =
|
39
|
+
@proxy.printer = PRINTER_CLASS.new
|
24
40
|
@proxy.wait_connection = true
|
25
41
|
DebuggerXml.wait_for_start = options.wait_for_start
|
26
|
-
|
27
|
-
|
42
|
+
DebuggerXml.logger = if options.debug_mode
|
43
|
+
DebuggerXml::Ide::Logger.new
|
28
44
|
else
|
29
|
-
|
45
|
+
DebuggerXml::FakeLogger.new
|
30
46
|
end
|
31
47
|
init_multi_process_debug(options) if options.dispatcher_port
|
32
48
|
end
|
33
49
|
|
34
50
|
def run
|
35
|
-
|
36
|
-
bt =
|
51
|
+
DebuggerXml.start_remote_ide(@proxy, options.host, options.port)
|
52
|
+
bt = @proxy.debug_load
|
37
53
|
if bt
|
38
54
|
print bt.backtrace.map{|l| "\t#{l}"}.join("\n"), "\n"
|
39
55
|
print "Uncaught exception: #{bt}\n"
|
@@ -86,8 +102,8 @@ class RdebugIde
|
|
86
102
|
)
|
87
103
|
opts = OptionParser.new do |opts|
|
88
104
|
opts.banner = %{
|
89
|
-
Using rdebug-
|
90
|
-
Usage: rdebug-
|
105
|
+
Using rdebug-xml
|
106
|
+
Usage: rdebug-xml is supposed to be called from RDT, NetBeans, RubyMine or
|
91
107
|
vim-ruby-debugger. The command line interface to 'debugger' is rdebug.
|
92
108
|
}.gsub(/^\s*/, '')
|
93
109
|
opts.separator ""
|
data/debugger-xml.gemspec
CHANGED
@@ -18,11 +18,8 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
else
|
24
|
-
gem.add_dependency 'byebug'
|
25
|
-
end
|
21
|
+
gem.extensions << 'ext/mkrf_conf.rb'
|
22
|
+
|
26
23
|
gem.add_dependency 'builder', '>= 2.0.0'
|
27
24
|
gem.add_development_dependency 'rake', '~> 0.9.2.2'
|
28
25
|
gem.add_development_dependency 'minitest', '~> 2.12.1'
|
data/ext/mkrf_conf.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rubygems/dependency_installer'
|
2
|
+
|
3
|
+
def already_installed(dep)
|
4
|
+
!Gem::DependencyInstaller.new(:domain => :local).find_gems_with_sources(dep).empty? ||
|
5
|
+
!Gem::DependencyInstaller.new(:domain => :local,:prerelease => true).find_gems_with_sources(dep).empty?
|
6
|
+
end
|
7
|
+
|
8
|
+
if RUBY_VERSION < '2.0'
|
9
|
+
dep = Gem::Dependency.new('debugger', '> 0')
|
10
|
+
else
|
11
|
+
dep = Gem::Dependency.new('byebug', '> 0')
|
12
|
+
end
|
13
|
+
|
14
|
+
begin
|
15
|
+
puts "Installing debugging gem"
|
16
|
+
inst = Gem::DependencyInstaller.new :prerelease => dep.prerelease?
|
17
|
+
inst.install dep
|
18
|
+
rescue
|
19
|
+
begin
|
20
|
+
inst = Gem::DependencyInstaller.new(:prerelease => true)
|
21
|
+
inst.install dep
|
22
|
+
rescue Exception => e
|
23
|
+
puts e
|
24
|
+
puts e.backtrace.join "\n "
|
25
|
+
exit(1)
|
26
|
+
end
|
27
|
+
end unless dep.nil? || already_installed(dep)
|
28
|
+
|
29
|
+
# create dummy rakefile to indicate success
|
30
|
+
f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w")
|
31
|
+
f.write("task :default\n")
|
32
|
+
f.close
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Byebug
|
2
|
+
class VarCommand < Command
|
3
|
+
class IdeCommand < Command
|
4
|
+
include Helpers::VarHelper
|
5
|
+
|
6
|
+
def regexp
|
7
|
+
/^\s* ide \s*$/x
|
8
|
+
end
|
9
|
+
|
10
|
+
def execute
|
11
|
+
var_ide
|
12
|
+
end
|
13
|
+
|
14
|
+
def short_description
|
15
|
+
'Shows set of variables for IDE usage'
|
16
|
+
end
|
17
|
+
|
18
|
+
def description
|
19
|
+
<<-EOD
|
20
|
+
v[ar] ide
|
21
|
+
|
22
|
+
#{short_description}
|
23
|
+
EOD
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Byebug
|
2
|
+
class VarCommand < Command
|
3
|
+
class InspectCommand < Command
|
4
|
+
include Helpers::VarHelper
|
5
|
+
|
6
|
+
# reference inspection results in order to save them from the GC
|
7
|
+
@@references = []
|
8
|
+
def self.reference_result(result)
|
9
|
+
@@references << result
|
10
|
+
end
|
11
|
+
def self.clear_references
|
12
|
+
@@references = []
|
13
|
+
end
|
14
|
+
|
15
|
+
def regexp
|
16
|
+
/^\s* inspect (?:\s+ (.+))?\s*$/x
|
17
|
+
end
|
18
|
+
|
19
|
+
def execute
|
20
|
+
var_inspect(@match[1])
|
21
|
+
end
|
22
|
+
|
23
|
+
def var_inspect(obj_ref)
|
24
|
+
obj = bb_eval(obj_ref)
|
25
|
+
VarCommand::InspectCommand.reference_result(obj)
|
26
|
+
print prv({eval_result: obj}, 'local')
|
27
|
+
end
|
28
|
+
|
29
|
+
def short_description
|
30
|
+
'Inspects a given object (supposed to be used only from ide).'
|
31
|
+
end
|
32
|
+
|
33
|
+
def description
|
34
|
+
<<-EOD
|
35
|
+
v[ar] inspect [object ref/expression]
|
36
|
+
|
37
|
+
#{short_description}
|
38
|
+
EOD
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/byebug/context_xml.rb
CHANGED
@@ -1,29 +1,32 @@
|
|
1
1
|
module Byebug
|
2
2
|
class Context
|
3
3
|
class << self
|
4
|
-
IGNORED_XML_FILES = Dir.glob(File.expand_path('../../../**/*', __FILE__))
|
5
4
|
|
6
5
|
def stack_size(byebug_frames = false)
|
7
6
|
backtrace = Thread.current.backtrace_locations(0)
|
8
7
|
return 0 unless backtrace
|
9
8
|
|
10
9
|
unless byebug_frames
|
11
|
-
backtrace = backtrace.select { |l| !
|
10
|
+
backtrace = backtrace.select { |l| !ignored_file?(l.path) }
|
12
11
|
end
|
13
12
|
backtrace.size
|
14
13
|
end
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
result = ignored_without_xml(path) ||
|
18
|
-
IGNORED_XML_FILES.include?(path) ||
|
19
|
-
!!path.match(/^\(eval\)/) ||
|
20
|
-
!!path.match(/rdebug-vim$/) ||
|
21
|
-
!!path.match(/rdebug-ide$/)
|
22
|
-
result
|
23
|
-
end
|
16
|
+
IGNORED_XML_FILES = Dir.glob(File.expand_path('../../../**/*', __FILE__))
|
24
17
|
|
25
|
-
|
26
|
-
|
18
|
+
def ignored_file_with_xml(path)
|
19
|
+
result = ignored_file_without_xml(path) ||
|
20
|
+
IGNORED_XML_FILES.include?(path) ||
|
21
|
+
!!path.match(/^\(eval\)/) ||
|
22
|
+
!!path.match(/rdebug-vim$/) ||
|
23
|
+
!!path.match(/rdebug-ide$/) ||
|
24
|
+
!!path.match(/rdebug-xml$/)
|
25
|
+
result
|
27
26
|
end
|
27
|
+
|
28
|
+
alias_method :ignored_file_without_xml, :ignored_file?
|
29
|
+
alias_method :ignored_file?, :ignored_file_with_xml
|
30
|
+
|
28
31
|
end
|
29
32
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Byebug
|
2
|
+
module Helpers
|
3
|
+
module VarHelper # :nodoc:
|
4
|
+
def var_instance_with_xml(*args)
|
5
|
+
if Byebug.printer.type == "xml"
|
6
|
+
DebuggerXml.logger.puts("match: #{@match}")
|
7
|
+
DebuggerXml.logger.puts("THE OBJ: #{get_obj(@match).inspect}")
|
8
|
+
print Byebug.printer.print_instance_variables(get_obj(@match))
|
9
|
+
else
|
10
|
+
var_instance_without_xml(*args)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
alias_method :var_instance_without_xml, :var_instance
|
15
|
+
alias_method :var_instance, :var_instance_with_xml
|
16
|
+
|
17
|
+
def var_ide(*_)
|
18
|
+
locals = []
|
19
|
+
_self = @state.context.frame_self(@state.frame)
|
20
|
+
locals << ['self', _self] unless _self.to_s == "main"
|
21
|
+
locals += @state.context.frame_locals(@state.frame).sort.map { |key, value| [key, value] }
|
22
|
+
print prv(locals, 'instance')
|
23
|
+
end
|
24
|
+
|
25
|
+
def get_obj(match)
|
26
|
+
if match[2]
|
27
|
+
begin
|
28
|
+
DebuggerXml.logger.puts("Getting object space: #{match[2].hex}")
|
29
|
+
ObjectSpace._id2ref(match[2].hex)
|
30
|
+
rescue RangeError
|
31
|
+
errmsg "Unknown object id : %s" % match[2]
|
32
|
+
nil
|
33
|
+
end
|
34
|
+
else
|
35
|
+
bb_warning_eval(match.post_match.empty? ? 'self' : match.post_match)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -2,6 +2,13 @@ general:
|
|
2
2
|
errors:
|
3
3
|
unsupported: "Unsupported command '{cmd}'"
|
4
4
|
|
5
|
+
break:
|
6
|
+
created:
|
7
|
+
tag: breakpointAdded
|
8
|
+
attributes:
|
9
|
+
"no": "{id}"
|
10
|
+
location: "{file}:{line}"
|
11
|
+
|
5
12
|
breakpoints:
|
6
13
|
set_breakpoint_to_line:
|
7
14
|
tag: breakpointAdded
|
@@ -58,7 +65,7 @@ frame:
|
|
58
65
|
tag: frame
|
59
66
|
attributes:
|
60
67
|
"no": "{pos}"
|
61
|
-
file: "{
|
68
|
+
file: "{full_path}"
|
62
69
|
line: "{line}"
|
63
70
|
current: "{mark}"
|
64
71
|
|
data/lib/debugger_xml.rb
CHANGED
@@ -17,7 +17,7 @@ module DebuggerXml
|
|
17
17
|
proxy.start
|
18
18
|
@control_thread = proxy.debug_thread_class.new do
|
19
19
|
server = TCPServer.new(host, port)
|
20
|
-
$stderr.printf "Fast Debugger (debugger-xml #{VERSION}) listens on #{host}:#{port}\n"
|
20
|
+
$stderr.printf "Fast Debugger (debugger-xml #{VERSION}, #{proxy.gem_info}) listens on #{host}:#{port}\n"
|
21
21
|
while (session = server.accept)
|
22
22
|
dispatcher = ENV['IDE_PROCESS_DISPATCHER']
|
23
23
|
if dispatcher && !dispatcher.include?(":")
|
@@ -25,7 +25,7 @@ module DebuggerXml
|
|
25
25
|
end
|
26
26
|
interface = DebuggerXml::Ide::Interface.new(session)
|
27
27
|
processor = DebuggerXml::Ide::ControlCommandProcessor.new(interface, proxy)
|
28
|
-
|
28
|
+
proxy.handler = DebuggerXml::Ide::Processor.new(interface, proxy)
|
29
29
|
processor.process_commands
|
30
30
|
end
|
31
31
|
end
|
@@ -1,108 +1,116 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
::
|
5
|
-
end
|
1
|
+
if Object.const_defined?("Byebug")
|
2
|
+
module DebuggerXml
|
3
|
+
class ByebugProxy
|
4
|
+
include Byebug::Helpers::FileHelper
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
def start
|
7
|
+
::Byebug::Setting[:autolist] = false
|
8
|
+
::Byebug.start
|
9
|
+
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
def handler
|
12
|
+
::Byebug.handler
|
13
|
+
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
control_command_classes.map { |cmd| cmd.new(state) }
|
19
|
-
end
|
15
|
+
def handler=(value)
|
16
|
+
::Byebug.handler = value
|
17
|
+
end
|
20
18
|
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
def control_commands(interface)
|
20
|
+
control_command_classes = commands.select(&:allow_in_control)
|
21
|
+
state = ::Byebug::ControlState.new(interface)
|
22
|
+
control_command_classes.map { |cmd| cmd.new(state) }
|
23
|
+
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
def build_command_processor_state(interface)
|
26
|
+
::Byebug::RegularXmlState.new(handler.context, [], handler.file, interface, handler.line)
|
27
|
+
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
def commands
|
30
|
+
::Byebug::commands
|
31
|
+
end
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
def event_commands(state)
|
34
|
+
event_command_classes.map { |cls| cls.new(state) }
|
35
|
+
end
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
def print(*args)
|
38
|
+
printer.print(*args)
|
39
|
+
end
|
40
40
|
|
41
|
-
|
42
|
-
|
41
|
+
def canonic_file(file)
|
42
|
+
normalize(file)
|
43
|
+
end
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
end
|
45
|
+
def line_at(file, line)
|
46
|
+
end
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
def breakpoints
|
49
|
+
::Byebug.breakpoints
|
50
|
+
end
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
def debug_thread?(context)
|
53
|
+
context && context.thread.is_a?(debug_thread_class)
|
54
|
+
end
|
55
55
|
|
56
|
-
|
57
|
-
|
58
|
-
|
56
|
+
def debug_thread_class
|
57
|
+
::Byebug::DebugThread
|
58
|
+
end
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
def current_context
|
61
|
+
::Byebug.current_context
|
62
|
+
end
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
|
64
|
+
def set_rdebug_script(file)
|
65
|
+
::Byebug.const_set("RDEBUG_SCRIPT", file)
|
66
|
+
end
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
def set_prog_script(file)
|
69
|
+
::Byebug.const_set("PROG_SCRIPT", file)
|
70
|
+
end
|
71
71
|
|
72
|
-
|
73
|
-
|
74
|
-
|
72
|
+
def set_argv(argv)
|
73
|
+
::Byebug.const_set("ARGV", argv)
|
74
|
+
end
|
75
75
|
|
76
|
-
|
77
|
-
|
78
|
-
|
76
|
+
def interrupt_last
|
77
|
+
::Byebug.interrupt_last
|
78
|
+
end
|
79
79
|
|
80
|
-
|
81
|
-
|
82
|
-
|
80
|
+
def tracing=(value)
|
81
|
+
::Byebug.tracing = value
|
82
|
+
end
|
83
83
|
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
def wait_connection=(value)
|
85
|
+
::Byebug.wait_connection = value
|
86
|
+
end
|
87
87
|
|
88
|
-
|
89
|
-
|
90
|
-
|
88
|
+
def printer=(value)
|
89
|
+
::Byebug.printer = value
|
90
|
+
end
|
91
91
|
|
92
|
-
|
93
|
-
|
94
|
-
|
92
|
+
def debug_load
|
93
|
+
::Byebug.debug_load(::Byebug::PROG_SCRIPT, false)
|
94
|
+
end
|
95
95
|
|
96
|
-
|
96
|
+
def clear_references
|
97
|
+
::Byebug::VarCommand::InspectCommand.clear_references
|
98
|
+
end
|
97
99
|
|
98
|
-
|
99
|
-
|
100
|
-
|
100
|
+
def gem_info
|
101
|
+
"byebug #{::Byebug::VERSION}"
|
102
|
+
end
|
101
103
|
|
102
|
-
|
103
|
-
|
104
|
-
|
104
|
+
private
|
105
|
+
|
106
|
+
def event_command_classes
|
107
|
+
commands
|
108
|
+
end
|
105
109
|
|
110
|
+
def printer
|
111
|
+
::Byebug.printer
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
106
115
|
end
|
107
116
|
end
|
108
|
-
|
@@ -97,8 +97,12 @@ module DebuggerXml
|
|
97
97
|
::Debugger.debug_load(::Debugger::PROG_SCRIPT, false, false)
|
98
98
|
end
|
99
99
|
|
100
|
-
def
|
101
|
-
::Debugger::InspectCommand
|
100
|
+
def clear_references
|
101
|
+
::Debugger::InspectCommand.clear_references
|
102
|
+
end
|
103
|
+
|
104
|
+
def gem_info
|
105
|
+
"debugger #{::Debugger::VERSION}"
|
102
106
|
end
|
103
107
|
|
104
108
|
private
|
@@ -58,11 +58,11 @@ module DebuggerXml
|
|
58
58
|
Debugger.tracing = options.tracing
|
59
59
|
Debugger.wait_for_start = options.wait_for_start
|
60
60
|
Debugger.wait_connection = true
|
61
|
-
Debugger.printer =
|
61
|
+
Debugger.printer = PRINTER_CLASS.new
|
62
62
|
DebuggerXml.logger = if options.debug_mode
|
63
|
-
|
63
|
+
DebuggerXml::Ide::Logger.new
|
64
64
|
else
|
65
|
-
|
65
|
+
DebuggerXml::FakeLogger.new
|
66
66
|
end
|
67
67
|
DebuggerXml.start_remote_ide(options.host, options.port)
|
68
68
|
end
|
data/lib/debugger_xml/version.rb
CHANGED
@@ -9,14 +9,12 @@ module DebuggerXml
|
|
9
9
|
@mutex = Mutex.new
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
@
|
16
|
-
super(*args)
|
17
|
-
@interface.send_response
|
18
|
-
end
|
12
|
+
def process_command(*args)
|
13
|
+
@mutex.synchronize do
|
14
|
+
super(*args)
|
15
|
+
@interface.send_response
|
19
16
|
end
|
17
|
+
end
|
20
18
|
|
21
19
|
end
|
22
20
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: debugger-xml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0.pre1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Astashov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: byebug
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: builder
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,9 +70,10 @@ description: XML interface for debugger
|
|
84
70
|
email:
|
85
71
|
- anton.astashov@gmail.com
|
86
72
|
executables:
|
87
|
-
- rdebug-ide
|
88
73
|
- rdebug-vim
|
89
|
-
|
74
|
+
- rdebug-xml
|
75
|
+
extensions:
|
76
|
+
- ext/mkrf_conf.rb
|
90
77
|
extra_rdoc_files: []
|
91
78
|
files:
|
92
79
|
- ".gitignore"
|
@@ -95,21 +82,23 @@ files:
|
|
95
82
|
- LICENSE.txt
|
96
83
|
- README.md
|
97
84
|
- Rakefile
|
98
|
-
- bin/rdebug-ide
|
99
85
|
- bin/rdebug-vim
|
86
|
+
- bin/rdebug-xml
|
100
87
|
- debugger-xml.gemspec
|
101
|
-
-
|
88
|
+
- ext/mkrf_conf.rb
|
89
|
+
- lib/byebug/commands/eval.rb
|
102
90
|
- lib/byebug/commands/help.rb
|
103
91
|
- lib/byebug/commands/info.rb
|
104
|
-
- lib/byebug/commands/inspect.rb
|
105
92
|
- lib/byebug/commands/kill.rb
|
106
93
|
- lib/byebug/commands/start.rb
|
107
|
-
- lib/byebug/commands/threads.rb
|
108
94
|
- lib/byebug/commands/trace.rb
|
109
|
-
- lib/byebug/commands/
|
95
|
+
- lib/byebug/commands/var/ide.rb
|
96
|
+
- lib/byebug/commands/var/inspect.rb
|
110
97
|
- lib/byebug/context_xml.rb
|
98
|
+
- lib/byebug/helpers/vars.rb
|
111
99
|
- lib/byebug/printers/texts/xml.yml
|
112
100
|
- lib/byebug/printers/xml.rb
|
101
|
+
- lib/byebug/states/regular_xml_state.rb
|
113
102
|
- lib/debugger/command_processor.rb
|
114
103
|
- lib/debugger/commands/edit.rb
|
115
104
|
- lib/debugger/commands/frame.rb
|
@@ -210,12 +199,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
210
199
|
version: '0'
|
211
200
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
201
|
requirements:
|
213
|
-
- - "
|
202
|
+
- - ">"
|
214
203
|
- !ruby/object:Gem::Version
|
215
|
-
version:
|
204
|
+
version: 1.3.1
|
216
205
|
requirements: []
|
217
206
|
rubyforge_project:
|
218
|
-
rubygems_version: 2.
|
207
|
+
rubygems_version: 2.4.6
|
219
208
|
signing_key:
|
220
209
|
specification_version: 4
|
221
210
|
summary: Implements XML interface for the 'debugger' gem, compatible with ruby-debug-ide
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Byebug
|
2
|
-
module FrameFunctions
|
3
|
-
|
4
|
-
# Mark should be 'true' or 'false', as a String
|
5
|
-
def get_pr_arguments_with_xml(pos, mark = nil)
|
6
|
-
mark = (pos == @state.frame_pos).to_s
|
7
|
-
res = get_pr_arguments_without_xml(pos, mark)
|
8
|
-
res[:file] = File.expand_path(res[:file])
|
9
|
-
res
|
10
|
-
end
|
11
|
-
|
12
|
-
alias_method :get_pr_arguments_without_xml, :get_pr_arguments
|
13
|
-
alias_method :get_pr_arguments, :get_pr_arguments_with_xml
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module Byebug
|
2
|
-
class InspectCommand < Command
|
3
|
-
# reference inspection results in order to save them from the GC
|
4
|
-
@@references = []
|
5
|
-
def self.reference_result(result)
|
6
|
-
@@references << result
|
7
|
-
end
|
8
|
-
def self.clear_references
|
9
|
-
@@references = []
|
10
|
-
end
|
11
|
-
|
12
|
-
def regexp
|
13
|
-
/^\s*v(?:ar)?\s+inspect\s+/
|
14
|
-
end
|
15
|
-
|
16
|
-
def execute
|
17
|
-
run_with_binding do |binding|
|
18
|
-
obj = debug_eval(@match.post_match, binding)
|
19
|
-
InspectCommand.reference_result(obj)
|
20
|
-
print prv({eval_result: obj}, "local")
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def help
|
25
|
-
%{
|
26
|
-
v[ar] instpect <object>\tinpect a given object (supposed to be used only from ide)
|
27
|
-
}
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
module Byebug
|
2
|
-
module ThreadFunctions # :nodoc:
|
3
|
-
def thread_arguments_with_pid(context, should_show_top_frame = true)
|
4
|
-
thread_arguments_without_pid(context, should_show_top_frame).merge(pid: Process.pid)
|
5
|
-
end
|
6
|
-
|
7
|
-
alias_method :thread_arguments_without_pid, :thread_arguments
|
8
|
-
alias_method :thread_arguments, :thread_arguments_with_pid
|
9
|
-
end
|
10
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
module Byebug
|
2
|
-
module VarFunctions # :nodoc:
|
3
|
-
|
4
|
-
def var_global
|
5
|
-
var_list(global_variables.reject { |v| [:$=, :$KCODE, :$-K, :$FILENAME].include?(v) })
|
6
|
-
end
|
7
|
-
|
8
|
-
end
|
9
|
-
class VarInstanceCommand < Command
|
10
|
-
|
11
|
-
def execute_with_xml(*args)
|
12
|
-
if Byebug.printer.type == "xml"
|
13
|
-
DebuggerXml.logger.puts("match: #{@match}")
|
14
|
-
DebuggerXml.logger.puts("THE OBJ: #{get_obj(@match).inspect}")
|
15
|
-
print Byebug.printer.print_instance_variables(get_obj(@match))
|
16
|
-
else
|
17
|
-
execute_without_xml(*args)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
alias_method :execute_without_xml, :execute
|
22
|
-
alias_method :execute, :execute_with_xml
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def get_obj(match)
|
27
|
-
if match[1]
|
28
|
-
begin
|
29
|
-
DebuggerXml.logger.puts("Getting object space")
|
30
|
-
ObjectSpace._id2ref(match[1].hex)
|
31
|
-
rescue RangeError
|
32
|
-
errmsg "Unknown object id : %s" % match[1]
|
33
|
-
nil
|
34
|
-
end
|
35
|
-
else
|
36
|
-
bb_warning_eval(match.post_match.empty? ? 'self' : match.post_match)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
class VarIdeCommand < Command
|
42
|
-
def regexp
|
43
|
-
/^\s*v(?:ar)?\s+ide\s*$/
|
44
|
-
end
|
45
|
-
|
46
|
-
def execute
|
47
|
-
locals = []
|
48
|
-
_self = @state.context.frame_self(@state.frame_pos)
|
49
|
-
locals << ['self', _self] unless _self.to_s == "main"
|
50
|
-
locals += @state.context.frame_locals(@state.frame_pos).sort.map { |key, value| [key, value] }
|
51
|
-
print prv(locals, 'instance')
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|