DWARF expr: clean up more old code and add some comments
authorEli Bendersky <eliben@gmail.com>
Fri, 13 Mar 2020 13:31:41 +0000 (06:31 -0700)
committerEli Bendersky <eliben@users.noreply.github.com>
Sat, 14 Mar 2020 12:24:52 +0000 (05:24 -0700)
elftools/dwarf/descriptions.py
elftools/dwarf/dwarf_expr.py

index 5007a80354069663c0a87d64598f51c51db1038d..08bfccc4c5c3db187c05471a42383c04619ed445 100644 (file)
@@ -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'):
index 4e479347e0c55a30e6b397d8183b056bc9f9ff59..f92d597d550470191d01a7faf434ab7ad3a0339f 100644 (file)
@@ -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)