mirror of
https://github.com/ruby/ruby.git
synced 2026-10-28 08:25:20 +08:00
Fix error paths of lldb rbbt
Without an argument, or with an expression that failed to evaluate, rbbt raised a Python exception instead of reporting the problem. Evaluating without a process referred to an undefined `target` as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
321a6665d1
commit
9f323525f8
2 files changed
+11
-4
Notes:
git
2026-10-01 22:37:37 +00:00
No files matched your search
+4
-3
@@ -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)
|
||||
|
||||
|
||||
@@ -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 <main>\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
|
||||
|
||||
Reference in new issue
Block a user