a bit progress on locationlists
authorEli Bendersky <eliben@gmail.com>
Tue, 27 Dec 2011 04:51:20 +0000 (06:51 +0200)
committerEli Bendersky <eliben@gmail.com>
Tue, 27 Dec 2011 04:51:20 +0000 (06:51 +0200)
elftools/dwarf/locationlists.py

index 4ea88774380d3d4279b83e9e217921cd62138754..afe12e3333a5879c5624a208f3903f8ddf9bd160 100644 (file)
@@ -11,8 +11,34 @@ from collections import namedtuple
 from ..common.utils import struct_parse
 
 
+LocationEntry = namedtuple('LocationEntry', 'begin_offset end_offset loc_expr')
+BaseAddressEntry = namedtuple('BaseAddressEntry', 'base_address')
+
+
 class LocationLists(object):
     def __init__(self, stream, structs):
+        self._max_addr = 2 ** (self.structs.address_size * 8) - 1
+        
+    def get_location_list_at_offset(self, offset):
         pass
+
+    def iter_location_lists(self):
+        pass
+
+    def _parse_location_list_from_stream(self):
+        lst = []
+        while True:
+            begin_offset = struct_parse(
+                self.structs.Dwarf_target_addr(''), self.stream)
+            end_offset = struct_parse(
+                self.structs.Dwarf_target_addr(''), self.stream)
+            if begin_offset == 0 and end_offset == 0:
+                # End of list - we're done.
+                break
+            elif begin_offset == self._max_addr:
+                # base
+            else: 
+                # entry...
         
 
+