basic preparations for parsing location lists
authorEli Bendersky <eliben@gmail.com>
Tue, 27 Dec 2011 03:25:35 +0000 (05:25 +0200)
committerEli Bendersky <eliben@gmail.com>
Tue, 27 Dec 2011 03:25:35 +0000 (05:25 +0200)
elftools/dwarf/dwarfinfo.py
elftools/dwarf/locationlists.py [new file with mode: 0644]
elftools/elf/elffile.py

index c530b4320d3639bedd9e0011301a24ccb56f96a1..cc2a7b902fcbeaf4aae1fa97bfee060a546effe9 100644 (file)
@@ -58,18 +58,22 @@ class DWARFInfo(object):
             debug_abbrev_sec,
             debug_frame_sec,
             debug_str_sec,
+            debug_loc_sec,
             debug_line_sec):
         """ config:
                 A DwarfConfig object
 
             debug_*_sec:
-                DebugSectionDescriptor for a section
+                DebugSectionDescriptor for a section. Pass None for sections
+                that don't exist. These arguments are best given with 
+                keyword syntax.
         """
         self.config = config
         self.debug_info_sec = debug_info_sec
         self.debug_abbrev_sec = debug_abbrev_sec
         self.debug_frame_sec = debug_frame_sec
         self.debug_str_sec = debug_str_sec
+        self.debug_loc_sec = debug_loc_sec
         self.debug_line_sec = debug_line_sec
 
         # This is the DWARFStructs the context uses, so it doesn't depend on 
diff --git a/elftools/dwarf/locationlists.py b/elftools/dwarf/locationlists.py
new file mode 100644 (file)
index 0000000..4ea8877
--- /dev/null
@@ -0,0 +1,18 @@
+#-------------------------------------------------------------------------------
+# elftools: dwarf/locationlists.py
+#
+# DWARF location lists section decoding
+#
+# Eli Bendersky (eliben@gmail.com)
+# This code is in the public domain
+#-------------------------------------------------------------------------------
+from collections import namedtuple
+
+from ..common.utils import struct_parse
+
+
+class LocationLists(object):
+    def __init__(self, stream, structs):
+        pass
+        
+
index 0f642da765d88375447febea7911d0c9ae517867..57b213bfc1ba042e11f60e8edfd35f3050d21016 100644 (file)
@@ -118,12 +118,12 @@ class ELFFile(object):
             are looked up and applied.
         """
         # Expect that has_dwarf_info was called, so at least .debug_info is 
-        # present. Check also the presence of other must-have debug sections.
+        # present. 
         # Sections that aren't found will be passed as None to DWARFInfo.
         #
         debug_sections = {}
         for secname in ('.debug_info', '.debug_abbrev', '.debug_str', 
-                        '.debug_line', '.debug_frame'):
+                        '.debug_line', '.debug_frame', '.debug_loc'):
             section = self.get_section_by_name(secname)
             if section is None:
                 debug_sections[secname] = None
@@ -141,6 +141,7 @@ class ELFFile(object):
                 debug_abbrev_sec=debug_sections['.debug_abbrev'],
                 debug_frame_sec=debug_sections['.debug_frame'],
                 debug_str_sec=debug_sections['.debug_str'],
+                debug_loc_sec=debug_sections['.debug_loc'],
                 debug_line_sec=debug_sections['.debug_line'])
 
     def get_machine_arch(self):