From: Eli Bendersky Date: Fri, 13 Mar 2020 13:31:41 +0000 (-0700) Subject: DWARF expr: clean up more old code and add some comments X-Git-Tag: v0.27~44 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4a98d471c954f4a56fbe9f7907acf27e7a726cea;p=pyelftools.git DWARF expr: clean up more old code and add some comments --- diff --git a/elftools/dwarf/descriptions.py b/elftools/dwarf/descriptions.py index 5007a80..08bfccc 100644 --- a/elftools/dwarf/descriptions.py +++ b/elftools/dwarf/descriptions.py @@ -574,9 +574,6 @@ class ExprDumper(object): self._ops_with_hex_arg = set( ['DW_OP_addr', 'DW_OP_call2', 'DW_OP_call4', 'DW_OP_call_ref']) - def _after_visit(self, opcode, opcode_name, args): - self._str_parts.append(self._dump_to_string(opcode, opcode_name, args)) - def _dump_to_string(self, opcode, opcode_name, args): if len(args) == 0: if opcode_name.startswith('DW_OP_reg'): diff --git a/elftools/dwarf/dwarf_expr.py b/elftools/dwarf/dwarf_expr.py index 4e47934..f92d597 100644 --- a/elftools/dwarf/dwarf_expr.py +++ b/elftools/dwarf/dwarf_expr.py @@ -104,11 +104,15 @@ _generate_dynamic_values(DW_OP_name2opcode, 'DW_OP_breg', 0, 31, 0x70) DW_OP_opcode2name = dict((v, k) for k, v in iteritems(DW_OP_name2opcode)) +# Each parsed DWARF expression is returned as this type with its numeric opcode, +# op name (as a string) and a list of arguments. DwarfExprOp = namedtuple('DwarfExprOp', 'op op_name args') def parse_expr(expr, structs): - """TODO + """ Parses expr (a list of integers) into a list of DwarfExprOp. + + The list can potentially be nested. """ dispatch_table = _init_dispatch_table(structs)