diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-10-09 09:04:37 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-10-09 09:08:21 +0900 |
commit | e078352a787ce3d52b5147a5fdf69b89a9d60cff (patch) | |
tree | b24d8777b21fcd35de9b4e9963f9b0652bf23275 /misc/lldb_cruby.py | |
parent | 98131f148f057b1364ae080f99b1efb2dc72002a (diff) | |
download | ruby-e078352a787ce3d52b5147a5fdf69b89a9d60cff.tar.gz |
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
```
Diffstat (limited to 'misc/lldb_cruby.py')
-rwxr-xr-x | misc/lldb_cruby.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/misc/lldb_cruby.py b/misc/lldb_cruby.py index 45ba6e3828..619f97d646 100755 --- a/misc/lldb_cruby.py +++ b/misc/lldb_cruby.py @@ -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) |