From 10f08a72506d38b5bb4f13fa4db0867c5e95bda6 Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Thu, 9 Jan 2025 17:34:42 +0100 Subject: [PATCH] Generated code --- main/debug_gdb_scripts.c | 69 +++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/main/debug_gdb_scripts.c b/main/debug_gdb_scripts.c index f64a4b1394898..28edcf7f413db 100644 --- a/main/debug_gdb_scripts.c +++ b/main/debug_gdb_scripts.c @@ -711,12 +711,12 @@ asm( ".ascii \" self.val = val\\n\"\n" ".ascii \"\\n\"\n" ".ascii \" def to_string(self):\\n\"\n" - ".ascii \" return format_zstr(self.val)\\n\"\n" + ".ascii \" return '((zend_string*) 0x%x) %s' % (self.val.address, format_zstr(self.val))\\n\"\n" ".ascii \"\\n\"\n" ".ascii \" def children(self):\\n\"\n" ".ascii \" for field in self.val.type.fields():\\n\"\n" ".ascii \" if field.name == 'val':\\n\"\n" - ".ascii \" yield ('val', self.to_string())\\n\"\n" + ".ascii \" yield ('val', format_zstr(self.val))\\n\"\n" ".ascii \" else:\\n\"\n" ".ascii \" yield (field.name, format_nested(self.val[field.name]))\\n\"\n" ".ascii \"\\n\"\n" @@ -765,7 +765,7 @@ asm( ".ascii \" self.val = val\\n\"\n" ".ascii \"\\n\"\n" ".ascii \" def to_string(self):\\n\"\n" - ".ascii \" return self.format_type(self.val)\\n\"\n" + ".ascii \" return '((zend_type*) 0x%x) %s' % (self.val.address, self.format_type(self.val))\\n\"\n" ".ascii \"\\n\"\n" ".ascii \" def children(self):\\n\"\n" ".ascii \" for field in self.val.type.fields():\\n\"\n" @@ -907,7 +907,7 @@ asm( ".ascii \" self.val = val\\n\"\n" ".ascii \"\\n\"\n" ".ascii \" def to_string(self):\\n\"\n" - ".ascii \" return self.value_to_string()\\n\"\n" + ".ascii \" return '((zval*) 0x%x) %s' % (self.val.address, self.value_to_string())\\n\"\n" ".ascii \"\\n\"\n" ".ascii \" def value_to_string(self):\\n\"\n" ".ascii \" t = int(self.val['u1']['v']['type'])\\n\"\n" @@ -952,36 +952,38 @@ asm( ".ascii \" for field in self.val.type.fields():\\n\"\n" ".ascii \" if field.name == 'value':\\n\"\n" ".ascii \" value = self.val['value']\\n\"\n" + ".ascii \" sub_field = 'ptr'\\n\"\n" ".ascii \" t = int(self.val['u1']['v']['type'])\\n\"\n" ".ascii \" if t == ZendTypeBits.bit('undef'):\\n\"\n" - ".ascii \" value = value['lval']\\n\"\n" + ".ascii \" sub_field = 'lval'\\n\"\n" ".ascii \" elif t == ZendTypeBits.bit('null'):\\n\"\n" - ".ascii \" value = value['lval']\\n\"\n" + ".ascii \" sub_field = 'lval'\\n\"\n" ".ascii \" elif t == ZendTypeBits.bit('false'):\\n\"\n" - ".ascii \" value = value['lval']\\n\"\n" + ".ascii \" sub_field = 'lval'\\n\"\n" ".ascii \" elif t == ZendTypeBits.bit('true'):\\n\"\n" - ".ascii \" value = value['lval']\\n\"\n" + ".ascii \" sub_field = 'lval'\\n\"\n" ".ascii \" elif t == ZendTypeBits.bit('long'):\\n\"\n" - ".ascii \" value = value['lval']\\n\"\n" + ".ascii \" sub_field = 'lval'\\n\"\n" ".ascii \" elif t == ZendTypeBits.bit('double'):\\n\"\n" - ".ascii \" value = value['dval']\\n\"\n" + ".ascii \" sub_field = 'dval'\\n\"\n" ".ascii \" elif t == ZendTypeBits.bit('string'):\\n\"\n" - ".ascii \" value = value['str'].dereference()\\n\"\n" + ".ascii \" sub_field = 'str'\\n\"\n" ".ascii \" elif t == ZendTypeBits.bit('array'):\\n\"\n" - ".ascii \" value = value['arr'].dereference()\\n\"\n" + ".ascii \" sub_field = 'arr'\\n\"\n" ".ascii \" elif t == ZendTypeBits.bit('object'):\\n\"\n" - ".ascii \" value = value['obj'].dereference()\\n\"\n" + ".ascii \" sub_field = 'obj'\\n\"\n" ".ascii \" elif t == ZendTypeBits.bit('resource'):\\n\"\n" - ".ascii \" value = value['res'].dereference()\\n\"\n" + ".ascii \" sub_field = 'res'\\n\"\n" ".ascii \" elif t == ZendTypeBits.bit('reference'):\\n\"\n" - ".ascii \" value = value['ref'].dereference()\\n\"\n" + ".ascii \" sub_field = 'ref'\\n\"\n" ".ascii \" elif t == ZendTypeBits.bit('constant_ast'):\\n\"\n" - ".ascii \" value = value['ast'].dereference()\\n\"\n" + ".ascii \" sub_field = 'ast'\\n\"\n" ".ascii \" elif t == ZendTypeBits.bit('indirect'):\\n\"\n" - ".ascii \" value = value['zv'].dereference()\\n\"\n" - ".ascii \" else:\\n\"\n" - ".ascii \" value = value['ptr']\\n\"\n" - ".ascii \" yield (field.name, value)\\n\"\n" + ".ascii \" sub_field = 'zv'\\n\"\n" + ".ascii \" value = value[sub_field]\\n\"\n" + ".ascii \" if sub_field != 'ptr' and value.type.code == gdb.TYPE_CODE_PTR:\\n\"\n" + ".ascii \" value = value.dereference()\\n\"\n" + ".ascii \" yield ('%s.%s' % (field.name, sub_field), value)\\n\"\n" ".ascii \" elif field.name == 'u2':\\n\"\n" ".ascii \" yield ('u2', self.val[field.name]['extra'])\\n\"\n" ".ascii \" else:\\n\"\n" @@ -997,14 +999,14 @@ asm( ".ascii \" self.val = val\\n\"\n" ".ascii \"\\n\"\n" ".ascii \" def to_string(self):\\n\"\n" - ".ascii \" return format_zstr(self.val['name'])\\n\"\n" + ".ascii \" return '((zend_class_entry*) 0x%x) %s' % (self.val.address, format_zstr(self.val['name']))\\n\"\n" ".ascii \"\\n\"\n" ".ascii \" def children(self):\\n\"\n" ".ascii \" for field in self.val.type.fields():\\n\"\n" ".ascii \" if field.name is not None:\\n\"\n" ".ascii \" if field.name == 'ce_flags':\\n\"\n" ".ascii \" flags = self.val[field.name]\\n\"\n" - ".ascii \" yield (field.name, '%d = %s' % (flags, ZendAccFlags.format_ce_flags(flags)))\\n\"\n" + ".ascii \" yield (field.name, '%d (%s)' % (flags, ZendAccFlags.format_ce_flags(flags)))\\n\"\n" ".ascii \" else:\\n\"\n" ".ascii \" yield (field.name, format_nested(self.val[field.name]))\\n\"\n" ".ascii \" else:\\n\"\n" @@ -1027,7 +1029,7 @@ asm( ".ascii \" for field in self.val.type.fields():\\n\"\n" ".ascii \" if field.name == 'value':\\n\"\n" ".ascii \" flags = self.val[field.name]['u2']['constant_flags']\\n\"\n" - ".ascii \" yield ('value.u2.constant_flags', '%d = %s' % (flags, ZendAccFlags.format_const_flags(flags)))\\n\"\n" + ".ascii \" yield ('value.u2.constant_flags', '%d (%s)' % (flags, ZendAccFlags.format_const_flags(flags)))\\n\"\n" ".ascii \" yield (field.name, self.val[field.name])\\n\"\n" ".ascii \" else:\\n\"\n" ".ascii \" yield (field.name, format_nested(self.val[field.name]))\\n\"\n" @@ -1044,7 +1046,7 @@ asm( ".ascii \" for field in self.val.type.fields():\\n\"\n" ".ascii \" if field.name == 'flags':\\n\"\n" ".ascii \" flags = self.val[field.name]\\n\"\n" - ".ascii \" yield ('flags', '%d = %s' % (flags, ZendAccFlags.format_prop_flags(flags)))\\n\"\n" + ".ascii \" yield ('flags', '%d (%s)' % (flags, ZendAccFlags.format_prop_flags(flags)))\\n\"\n" ".ascii \" else:\\n\"\n" ".ascii \" yield (field.name, format_nested(self.val[field.name]))\\n\"\n" ".ascii \"\\n\"\n" @@ -1080,7 +1082,7 @@ asm( ".ascii \" if int(self.val['type']) == ZendFnTypes.ZEND_USER_FUNCTION or int(self.val['type']) == ZendFnTypes.ZEND_EVAL_CODE:\\n\"\n" ".ascii \" str = '%s %s:%d' % (str, format_zstr(self.val['op_array']['filename']), int(self.val['op_array']['line_start']))\\n\"\n" ".ascii \"\\n\"\n" - ".ascii \" return str\\n\"\n" + ".ascii \" return '((zend_function*) 0x%x) %s' % (self.val.address, str)\\n\"\n" ".ascii \"\\n\"\n" ".ascii \" def children(self):\\n\"\n" ".ascii \" for field in self.val.type.fields():\\n\"\n" @@ -1117,13 +1119,13 @@ asm( ".ascii \"\\n\"\n" ".ascii \" str = '%s %s:%d' % (str, format_zstr(self.val['filename']), int(self.val['line_start']))\\n\"\n" ".ascii \"\\n\"\n" - ".ascii \" return str\\n\"\n" + ".ascii \" return '((zend_op_array*) 0x%x) %s' % (self.val.address, str)\\n\"\n" ".ascii \"\\n\"\n" ".ascii \" def children(self):\\n\"\n" ".ascii \" for field in self.val.type.fields():\\n\"\n" ".ascii \" if field.name == 'fn_flags':\\n\"\n" ".ascii \" value = self.val[field.name]\\n\"\n" - ".ascii \" yield (field.name, '%d = %s' % (value, ZendAccFlags.format_fn_flags(value)))\\n\"\n" + ".ascii \" yield (field.name, '%d (%s)' % (value, ZendAccFlags.format_fn_flags(value)))\\n\"\n" ".ascii \" else:\\n\"\n" ".ascii \" yield (field.name, format_nested(self.val[field.name]))\\n\"\n" ".ascii \"\\n\"\n" @@ -1139,7 +1141,7 @@ asm( ".ascii \" for field in self.val.type.fields():\\n\"\n" ".ascii \" if field.name == 'opcode':\\n\"\n" ".ascii \" opcode = int(self.val[field.name])\\n\"\n" - ".ascii \" yield (field.name, '%d = %s' % (opcode, ZendOpcodes.name(opcode)))\\n\"\n" + ".ascii \" yield (field.name, '%d (%s)' % (opcode, ZendOpcodes.name(opcode)))\\n\"\n" ".ascii \" else:\\n\"\n" ".ascii \" yield (field.name, format_nested(self.val[field.name]))\\n\"\n" ".ascii \"\\n\"\n" @@ -1162,12 +1164,12 @@ asm( ".ascii \" else:\\n\"\n" ".ascii \" str = 'function %s' % (namestr)\\n\"\n" ".ascii \"\\n\"\n" - ".ascii \" return str\\n\"\n" + ".ascii \" return '((zend_internal_function*) 0x%x) %s' % (self.val.address, str)\\n\"\n" ".ascii \"\\n\"\n" ".ascii \" def children(self):\\n\"\n" ".ascii \" for field in self.val.type.fields():\\n\"\n" ".ascii \" if field.name == 'fn_flags':\\n\"\n" - ".ascii \" yield ('fn_flags', ('%d = %s' % (self.val[field.name], ZendAccFlags.format_fn_flags(self.val[field.name]))))\\n\"\n" + ".ascii \" yield ('fn_flags', ('%d (%s)' % (self.val[field.name], ZendAccFlags.format_fn_flags(self.val[field.name]))))\\n\"\n" ".ascii \" else:\\n\"\n" ".ascii \" yield (field.name, format_nested(self.val[field.name]))\\n\"\n" ".ascii \"\\n\"\n" @@ -1188,7 +1190,7 @@ asm( ".ascii \" for subfield in val.type.fields():\\n\"\n" ".ascii \" if subfield.name == 'type_info':\\n\"\n" ".ascii \" flags = int(val[subfield.name])\\n\"\n" - ".ascii \" yield (('%s.%s' % (field.name, subfield.name)), '%d = %s' % (flags, ZendRefTypeInfo.format(flags)))\\n\"\n" + ".ascii \" yield (('%s.%s' % (field.name, subfield.name)), '%d (%s)' % (flags, ZendRefTypeInfo.format(flags)))\\n\"\n" ".ascii \" else:\\n\"\n" ".ascii \" yield (('%s.%s' % (field.name, subfield.name)), format_nested(val[subfield.name]))\\n\"\n" ".ascii \" else:\\n\"\n" @@ -1633,7 +1635,10 @@ asm( ".ascii \" while type.code == gdb.TYPE_CODE_PTR:\\n\"\n" ".ascii \" addr = int(value)\\n\"\n" ".ascii \" type = type.target()\\n\"\n" - ".ascii \" value = value.dereference()\\n\"\n" + ".ascii \" try:\\n\"\n" + ".ascii \" value = value.dereference()\\n\"\n" + ".ascii \" except:\\n\"\n" + ".ascii \" pass\\n\"\n" ".ascii \"\\n\"\n" ".ascii \" type = gdb.types.get_basic_type(type)\\n\"\n" ".ascii \"\\n\"\n"