mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 12:14:51 +00:00
Update Typed Data dump on debuggers [ci skip]
This commit is contained in:
parent
f7d3f675fe
commit
a797561e25
15
.gdbinit
15
.gdbinit
@ -185,12 +185,19 @@ define rp
|
||||
print (struct RBasic *)($arg0)
|
||||
else
|
||||
if ($flags & RUBY_T_MASK) == RUBY_T_DATA
|
||||
if ((struct RTypedData *)($arg0))->type & 1
|
||||
printf "%sT_DATA%s(%s): ", $color_type, $color_end, ((const rb_data_type_t *)(((struct RTypedData *)($arg0))->type & ~1))->wrap_struct_name
|
||||
print (struct RTypedData *)($arg0)
|
||||
if ($flags & RUBY_TYPED_FL_IS_TYPED_DATA)
|
||||
set $data = (struct RTypedData *)($arg0)
|
||||
set $type = (const rb_data_type_t *)($data->type & ~1)
|
||||
printf "%sT_DATA%s(%s): ", $color_type, $color_end, $type->wrap_struct_name
|
||||
print *$type
|
||||
if ($data->type & 1)
|
||||
print (void *)&$data->data
|
||||
else
|
||||
print $data
|
||||
end
|
||||
else
|
||||
printf "%sT_DATA%s: ", $color_type, $color_end
|
||||
print (struct RData *)($arg0)
|
||||
print *(struct RData *)($arg0)
|
||||
end
|
||||
else
|
||||
if ($flags & RUBY_T_MASK) == RUBY_T_MATCH
|
||||
|
||||
1
debug.c
1
debug.c
@ -57,6 +57,7 @@ const union {
|
||||
enum ruby_rstring_flags rstring_flags;
|
||||
enum ruby_rarray_flags rarray_flags;
|
||||
enum ruby_rarray_consts rarray_consts;
|
||||
enum rbimpl_typeddata_flags rtypeddata_consts;
|
||||
enum {
|
||||
RUBY_FMODE_READABLE = FMODE_READABLE,
|
||||
RUBY_FMODE_WRITABLE = FMODE_WRITABLE,
|
||||
|
||||
@ -236,13 +236,26 @@ class RbInspector(LLDBInterface):
|
||||
elif rval.is_type("RUBY_T_DATA"):
|
||||
tRTypedData = self.target.FindFirstType("struct RTypedData").GetPointerType()
|
||||
val = val.Cast(tRTypedData)
|
||||
flag = val.GetValueForExpressionPath("->typed_flag")
|
||||
is_typed_data = self.ruby_globals.get("RUBY_TYPED_FL_IS_TYPED_DATA", None)
|
||||
if is_typed_data:
|
||||
typed = rval.flags & is_typed_data
|
||||
else:
|
||||
typed = val.GetValueForExpressionPath("->typed_flag").GetValueAsUnsigned() == 1
|
||||
|
||||
if flag.GetValueAsUnsigned() == 1:
|
||||
print("T_DATA: %s" %
|
||||
val.GetValueForExpressionPath("->type->wrap_struct_name"),
|
||||
if typed:
|
||||
type = val.GetValueForExpressionPath("->type").GetValueAsUnsigned()
|
||||
embed = (type & 1)
|
||||
if embed:
|
||||
flaginfo += "[EMBED] "
|
||||
type = self.frame.EvaluateExpression("(rb_data_type_t *)%0#x" % (type & ~1))
|
||||
print("T_DATA: %s%s" %
|
||||
(flaginfo, type.GetValueForExpressionPath("->wrap_struct_name")),
|
||||
file=self.result)
|
||||
self._append_expression("*(struct RTypedData *) %0#x" % val.GetValueAsUnsigned())
|
||||
print("%s", type.Dereference(), file=self.result)
|
||||
ptr = val.GetValueForExpressionPath("->data")
|
||||
if embed:
|
||||
ptr = ptr.AddressOf()
|
||||
self._append_expression("(void *)%0#x" % ptr.GetValueAsUnsigned())
|
||||
else:
|
||||
print("T_DATA:", file=self.result)
|
||||
self._append_expression("*(struct RData *) %0#x" % val.GetValueAsUnsigned())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user