1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

tool/runruby.rb: support RUNRUBY_USE_LLDB as well as RUNRUBY_USE_GDB

This commit is contained in:
Nobuyoshi Nakada 2019-06-05 11:03:57 +09:00
parent 26d02cc7cd
commit a105831819
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -6,6 +6,12 @@
show = false show = false
precommand = [] precommand = []
srcdir = File.realpath('..', File.dirname(__FILE__)) srcdir = File.realpath('..', File.dirname(__FILE__))
case
when ENV['RUNRUBY_USE_GDB'] == 'true'
debugger = :gdb
when ENV['RUNRUBY_USE_LLDB'] == 'true'
debugger = :lldb
end
while arg = ARGV[0] while arg = ARGV[0]
break ARGV.shift if arg == '--' break ARGV.shift if arg == '--'
case arg case arg
@ -132,16 +138,16 @@ end
ENV.update env ENV.update env
if debugger or ENV['RUNRUBY_USE_GDB'] == 'true' if debugger
if debugger == :gdb or !debugger case debugger
when :gdb, nil
debugger = %W'gdb -x #{srcdir}/.gdbinit' debugger = %W'gdb -x #{srcdir}/.gdbinit'
if File.exist?(gdb = 'run.gdb') or if File.exist?(gdb = 'run.gdb') or
File.exist?(gdb = File.join(abs_archdir, 'run.gdb')) File.exist?(gdb = File.join(abs_archdir, 'run.gdb'))
debugger.push('-x', gdb) debugger.push('-x', gdb)
end end
debugger << '--args' debugger << '--args'
end when :lldb
if debugger == :lldb
debugger = ['lldb', '-O', "command script import #{srcdir}/misc/lldb_cruby.py"] debugger = ['lldb', '-O', "command script import #{srcdir}/misc/lldb_cruby.py"]
if File.exist?(lldb = 'run.lldb') or if File.exist?(lldb = 'run.lldb') or
File.exist?(lldb = File.join(abs_archdir, 'run.lldb')) File.exist?(lldb = File.join(abs_archdir, 'run.lldb'))