From: Eli Bendersky Date: Wed, 7 Dec 2011 12:46:03 +0000 (+0200) Subject: renamed 'location expression' to the more general 'dwarf expression' X-Git-Tag: v0.10~50 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5f56c21498ff5e9d4df9227cb0663fd53b4c0738;p=pyelftools.git renamed 'location expression' to the more general 'dwarf expression' --- diff --git a/elftools/dwarf/dwarf_expr.py b/elftools/dwarf/dwarf_expr.py index 6140d20..7e1f65f 100644 --- a/elftools/dwarf/dwarf_expr.py +++ b/elftools/dwarf/dwarf_expr.py @@ -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 diff --git a/tests/test_dwarf_expr.py b/tests/test_dwarf_expr.py index 4202633..67cfc48 100644 --- a/tests/test_dwarf_expr.py +++ b/tests/test_dwarf_expr.py @@ -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()