renamed 'location expression' to the more general 'dwarf expression'
authorEli Bendersky <eliben@gmail.com>
Wed, 7 Dec 2011 12:46:03 +0000 (14:46 +0200)
committerEli Bendersky <eliben@gmail.com>
Wed, 7 Dec 2011 12:46:03 +0000 (14:46 +0200)
elftools/dwarf/dwarf_expr.py
tests/test_dwarf_expr.py

index 6140d205f764bfb30228ac3c7115d66f31077bb7..7e1f65f84071eb24121ed0c00fc611d65fd5e2b5 100644 (file)
@@ -98,19 +98,11 @@ class GenericExprVisitor(object):
         self._cur_opcode_name = None
         self._cur_args = []
 
-    def process_expr(self, loc_expr):
-        """ Process (visit) a DWARF expression. Currently two possible
-            types are supported for expr:
-
-            1. File-like stream object
-            2. List of byte values (the result of parsed DW_FORM_block*
-               attributes).
+    def process_expr(self, expr):
+        """ Process (visit) a DWARF expression. expr should be a list of
+            (integer) byte values.
         """
-        if hasattr(loc_expr, 'read') and hasattr(loc_expr, 'seek'):
-            # looks like a stream
-            self.stream = loc_expr
-        else:
-            self.stream = StringIO(bytelist2string(loc_expr))
+        self.stream = StringIO(bytelist2string(expr))
 
         while True:
             # Get the next opcode from the stream. If nothing is left in the
index 42026331613dd600ed5a48b46ea8abe78b1ab950..67cfc484f5042aebd5c8fd7471ca6fe182a04a71 100644 (file)
@@ -50,11 +50,6 @@ class TestExprDumper(unittest.TestCase):
         self.assertEqual(self.visitor.get_str(),
             'DW_OP_mod; DW_OP_mul; DW_OP_mod; DW_OP_mul; DW_OP_mod; DW_OP_mul')
 
-    def test_stream_input(self):
-        self.visitor.process_expr(StringIO('\x1b'))
-        self.assertEqual(self.visitor.get_str(),
-            'DW_OP_div')
-
 
 if __name__ == '__main__':
     unittest.main()