mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
php_gdb: Print some numeric fields as hexadecimal (#18925)
* php_gdb: Print `zend_string*`’s `h` field as hexadecimal A decimal representation of a hash value is not particularly meaningful and makes it harder to compare hash values. * php_gdb: Print `HashTable*`’s `nTableMask` field as hexadecimal
This commit is contained in:
parent
537ae4f990
commit
39cf27689b
2 changed files with 12 additions and 10 deletions
|
@ -49,6 +49,8 @@ class ZendStringPrettyPrinter(gdb.printing.PrettyPrinter):
|
|||
for field in self.val.type.fields():
|
||||
if field.name == 'val':
|
||||
yield ('val', format_zstr(self.val))
|
||||
elif field.name == 'h':
|
||||
yield (field.name, "0x%x" % self.val[field.name])
|
||||
else:
|
||||
yield (field.name, format_nested(self.val[field.name]))
|
||||
|
||||
|
@ -81,12 +83,11 @@ class ZendArrayPrettyPrinter(gdb.printing.PrettyPrinter):
|
|||
def children(self):
|
||||
for field in self.val.type.fields():
|
||||
if field.name is None:
|
||||
name = '<anonymous>'
|
||||
val = self.val[field]
|
||||
yield ('<anonymous>', format_nested(self.val[field]))
|
||||
elif field.name == 'nTableMask':
|
||||
yield (field.name, "0x%x" % self.val[field.name])
|
||||
else:
|
||||
name = field.name
|
||||
val = self.val[field.name]
|
||||
yield (name, format_nested(val))
|
||||
yield (field.name, format_nested(self.val[field.name]))
|
||||
|
||||
pp_set.add_printer('zend_array', '^_zend_array$', ZendArrayPrettyPrinter)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue