lldb_cruby.py: fixed embedded string ptr [ci skip]
Use GetLocation to get the address of embedded array.
This commit is contained in:
parent
7909f06212
commit
98131f148f
@ -33,6 +33,8 @@ def lldb_init(debugger):
|
|||||||
|
|
||||||
def string2cstr(rstring):
|
def string2cstr(rstring):
|
||||||
"""Returns the pointer to the C-string in the given String object"""
|
"""Returns the pointer to the C-string in the given String object"""
|
||||||
|
if rstring.TypeIsPointerType():
|
||||||
|
rstring = rstring.Dereference()
|
||||||
flags = rstring.GetValueForExpressionPath(".basic->flags").unsigned
|
flags = rstring.GetValueForExpressionPath(".basic->flags").unsigned
|
||||||
if flags & RUBY_T_MASK != RUBY_T_STRING:
|
if flags & RUBY_T_MASK != RUBY_T_STRING:
|
||||||
raise TypeError("not a string")
|
raise TypeError("not a string")
|
||||||
@ -40,7 +42,7 @@ def string2cstr(rstring):
|
|||||||
cptr = int(rstring.GetValueForExpressionPath(".as.heap.ptr").value, 0)
|
cptr = int(rstring.GetValueForExpressionPath(".as.heap.ptr").value, 0)
|
||||||
clen = int(rstring.GetValueForExpressionPath(".as.heap.len").value, 0)
|
clen = int(rstring.GetValueForExpressionPath(".as.heap.len").value, 0)
|
||||||
else:
|
else:
|
||||||
cptr = int(rstring.GetValueForExpressionPath(".as.ary").value, 0)
|
cptr = int(rstring.GetValueForExpressionPath(".as.ary").location, 0)
|
||||||
clen = (flags & RSTRING_EMBED_LEN_MASK) >> RSTRING_EMBED_LEN_SHIFT
|
clen = (flags & RSTRING_EMBED_LEN_MASK) >> RSTRING_EMBED_LEN_SHIFT
|
||||||
return cptr, clen
|
return cptr, clen
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user