Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions elftools/dwarf/datatype_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
cpp_symbols = dict(
pointer = "*",
reference = "&",
const = "const")
const = "const",
volatile = "volatile")

def describe_cpp_datatype(var_die):
return str(parse_cpp_datatype(var_die))
Expand All @@ -36,8 +37,8 @@ def parse_cpp_datatype(var_die):

mods = []
# Unlike readelf, dwarfdump doesn't chase typedefs
while type_die.tag in ('DW_TAG_const_type', 'DW_TAG_pointer_type', 'DW_TAG_reference_type'):
modifier = _strip_type_tag(type_die) # const/reference/pointer
while type_die.tag in ('DW_TAG_const_type', 'DW_TAG_volatile_type', 'DW_TAG_pointer_type', 'DW_TAG_reference_type'):
modifier = _strip_type_tag(type_die) # const/volatile/reference/pointer
mods.insert(0, modifier)
if not 'DW_AT_type' in type_die.attributes: # void* is encoded as a pointer to nothing
t.name = t.tag = "void"
Expand Down Expand Up @@ -145,9 +146,9 @@ def __str__(self):
mods = self.modifiers

parts = []
# Initial const applies to the var ifself, other consts apply to the pointee
if len(mods) and mods[0] == 'const':
parts.append("const")
# Initial const/volatile applies to the var ifself, other consts apply to the pointee
if len(mods) and mods[0] in ('const', 'volatile'):
parts.append(mods[0])
mods = mods[1:]

# ref->const in the end, const goes in front
Expand Down
Binary file not shown.