From 27024004fa9804631c6f21e2022bb2dd690e8c5c Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 29 Aug 2023 19:31:53 -0400 Subject: [PATCH] Fix string2cstr in lldb_cruby.py [ci skip] --- misc/lldb_cruby.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/misc/lldb_cruby.py b/misc/lldb_cruby.py index 95e03c6209..e667a46628 100755 --- a/misc/lldb_cruby.py +++ b/misc/lldb_cruby.py @@ -197,12 +197,11 @@ def string2cstr(rstring): flags = rstring.GetValueForExpressionPath(".basic->flags").unsigned if flags & RUBY_T_MASK != RUBY_T_STRING: raise TypeError("not a string") + clen = int(rstring.GetValueForExpressionPath(".len").value, 0) if flags & RUBY_FL_USER1: cptr = int(rstring.GetValueForExpressionPath(".as.heap.ptr").value, 0) - clen = int(rstring.GetValueForExpressionPath(".as.heap.len").value, 0) else: cptr = int(rstring.GetValueForExpressionPath(".as.embed.ary").location, 0) - clen = int(rstring.GetValueForExpressionPath(".as.embed.len").value, 0) return cptr, clen def output_string(debugger, result, rstring):