diff --git a/misc/lldb_cruby.py b/misc/lldb_cruby.py index 657801ca4c8..19db3c74d5c 100644 --- a/misc/lldb_cruby.py +++ b/misc/lldb_cruby.py @@ -527,14 +527,15 @@ def rb_backtrace(debugger, command, result, internal_dict): if frame.IsValid(): val = frame.EvaluateExpression(command) else: - val = target.EvaluateExpression(command) + val = bt.target.EvaluateExpression(command) error = val.GetError() if error.Fail(): - print >> result, error + print(error, file=result) return else: - print("Need an EC for now") + print("Need an EC for now", file=result) + return bt.print_bt(val) diff --git a/misc/test_lldb_cruby.rb b/misc/test_lldb_cruby.rb index 97cda24b6f7..f287555da8e 100644 --- a/misc/test_lldb_cruby.rb +++ b/misc/test_lldb_cruby.rb @@ -14,8 +14,9 @@ run #{ruby_opts} -e'#{code}' #{command} eom tf.flush - o, s = Open3.capture2('lldb', '-b', '-s', tf.path) + o, e, s = Open3.capture3('lldb', '-b', '-s', tf.path) assert_true s.success?, message + assert_not_match /^Traceback/, e, message assert_match /^\(lldb\) #{Regexp.quote(command)}\n#{pattern}/, o, message end end @@ -47,6 +48,11 @@ eom /rb_control_frame_t +TYPE *\n0x\h+ +EVAL +-e
\n0x\h+ +METHOD +-e foo\n0x\h+ +CFUNC *\n/ end + def test_rbbt_error + assert_lldb 'p 1', 'rbbt', /Need an EC for now\n/ + assert_lldb 'p 1', 'rbbt no_such_variable', /(?:.*\n)*?error: .*no_such_variable/ + end + def test_rbbt_zjit omit 'ZJIT is not built' unless system('./miniruby', '--zjit', '-e', 'exit RubyVM::ZJIT.enabled?', err: File::NULL) # Call foo deeper than the warm-up so that bar lands on a frame whose _iseq no interpreter has written