mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
lldb_cruby.py: fixed inspecting string [ci skip]
Show the size of String. To see the whole contents even after NUL char: ``` (lldb) rp str (const char [5]) $1 = "x" (lldb) memory read -s1 --format x --count `sizeof($1)` -- &$1 0x1010457a8: 0x78 0x00 0x61 0x61 0x61 ```
This commit is contained in:
parent
98131f148f
commit
e078352a78
1 changed files with 2 additions and 5 deletions
|
@ -130,11 +130,8 @@ def lldb_inspect(debugger, target, result, val):
|
|||
print('T_%s: %s' % ('CLASS' if flType == RUBY_T_CLASS else 'MODULE' if flType == RUBY_T_MODULE else 'ICLASS', val.Dereference()), file=result)
|
||||
elif flType == RUBY_T_STRING:
|
||||
tRString = target.FindFirstType("struct RString").GetPointerType()
|
||||
val = val.Cast(tRString)
|
||||
if flags & RSTRING_NOEMBED:
|
||||
print(val.GetValueForExpressionPath("->as.heap"), file=result)
|
||||
else:
|
||||
print(val.GetValueForExpressionPath("->as.ary"), file=result)
|
||||
ptr, len = string2cstr(val.Cast(tRString))
|
||||
append_command_output(debugger, "print *(const char (*)[%d])%0#x" % (len, ptr), result)
|
||||
elif flType == RUBY_T_SYMBOL:
|
||||
tRSymbol = target.FindFirstType("struct RSymbol").GetPointerType()
|
||||
print(val.Cast(tRSymbol).Dereference(), file=result)
|
||||
|
|
Loading…
Add table
Reference in a new issue