mirror of
https://github.com/JakeHillion/drgn.git
synced 2024-12-23 09:43:06 +00:00
dwarf: add Die.size()
Instead of having to do die.find_constant(DW_AT.byte_size).
This commit is contained in:
parent
35e6750f5a
commit
2efa9343fb
@ -1434,6 +1434,9 @@ cdef class Die:
|
||||
cpdef str name(self):
|
||||
return self.find_string(DW_AT_name)
|
||||
|
||||
def size(self):
|
||||
return self.find_constant(DW_AT_byte_size)
|
||||
|
||||
cpdef uint64_t address(self):
|
||||
cdef const DieAttrib *low_pc = self.find_attrib(DW_AT_low_pc)
|
||||
if low_pc.form != DW_FORM_addr:
|
||||
|
@ -604,7 +604,7 @@ class TypeFactory:
|
||||
|
||||
if dwarf_type.tag == DW_TAG.base_type:
|
||||
encoding = dwarf_type.find_constant(DW_AT.encoding)
|
||||
size = dwarf_type.find_constant(DW_AT.byte_size)
|
||||
size = dwarf_type.size()
|
||||
if encoding == DW_ATE.boolean:
|
||||
return BoolType(dwarf_type.name(), size, qualifiers)
|
||||
elif encoding == DW_ATE.float:
|
||||
@ -623,7 +623,7 @@ class TypeFactory:
|
||||
size = None
|
||||
members = None
|
||||
else:
|
||||
size = dwarf_type.find_constant(DW_AT.byte_size)
|
||||
size = dwarf_type.size()
|
||||
members = []
|
||||
for child in dwarf_type.children():
|
||||
if child.tag != DW_TAG.member:
|
||||
@ -657,7 +657,7 @@ class TypeFactory:
|
||||
signed = None
|
||||
enumerators = None
|
||||
else:
|
||||
size = dwarf_type.find_constant(DW_AT.byte_size)
|
||||
size = dwarf_type.size()
|
||||
encoding = dwarf_type.find_constant(DW_AT.encoding)
|
||||
if encoding == DW_ATE.signed:
|
||||
signed = True
|
||||
@ -682,7 +682,7 @@ class TypeFactory:
|
||||
self.from_dwarf_type(dwarf_type.type()),
|
||||
qualifiers)
|
||||
elif dwarf_type.tag == DW_TAG.pointer_type:
|
||||
size = dwarf_type.find_constant(DW_AT.byte_size)
|
||||
size = dwarf_type.size()
|
||||
try:
|
||||
deref_type = dwarf_type.type()
|
||||
except DwarfAttribNotFoundError:
|
||||
|
Loading…
Reference in New Issue
Block a user