LLVM API Documentation
00001 //===-- DWARFDebugLoc.h -----------------------------------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 00010 #ifndef LLVM_LIB_DEBUGINFO_DWARFDEBUGLOC_H 00011 #define LLVM_LIB_DEBUGINFO_DWARFDEBUGLOC_H 00012 00013 #include "DWARFRelocMap.h" 00014 #include "llvm/ADT/SmallVector.h" 00015 #include "llvm/Support/DataExtractor.h" 00016 00017 namespace llvm { 00018 00019 class raw_ostream; 00020 00021 class DWARFDebugLoc { 00022 /// A single location within a location list. 00023 struct Entry { 00024 /// The beginning address of the instruction range. 00025 uint64_t Begin; 00026 /// The ending address of the instruction range. 00027 uint64_t End; 00028 /// The location of the variable within the specified range. 00029 SmallVector<unsigned char, 4> Loc; 00030 }; 00031 00032 /// A list of locations that contain one variable. 00033 struct LocationList { 00034 /// The beginning offset where this location list is stored in the debug_loc 00035 /// section. 00036 unsigned Offset; 00037 /// All the locations in which the variable is stored. 00038 SmallVector<Entry, 2> Entries; 00039 }; 00040 00041 typedef SmallVector<LocationList, 4> LocationLists; 00042 00043 /// A list of all the variables in the debug_loc section, each one describing 00044 /// the locations in which the variable is stored. 00045 LocationLists Locations; 00046 00047 /// A map used to resolve binary relocations. 00048 const RelocAddrMap &RelocMap; 00049 00050 public: 00051 DWARFDebugLoc(const RelocAddrMap &LocRelocMap) : RelocMap(LocRelocMap) {} 00052 /// Print the location lists found within the debug_loc section. 00053 void dump(raw_ostream &OS) const; 00054 /// Parse the debug_loc section accessible via the 'data' parameter using the 00055 /// specified address size to interpret the address ranges. 00056 void parse(DataExtractor data, unsigned AddressSize); 00057 }; 00058 00059 class DWARFDebugLocDWO { 00060 struct Entry { 00061 uint64_t Start; 00062 uint32_t Length; 00063 SmallVector<unsigned char, 4> Loc; 00064 }; 00065 00066 struct LocationList { 00067 unsigned Offset; 00068 SmallVector<Entry, 2> Entries; 00069 }; 00070 00071 typedef SmallVector<LocationList, 4> LocationLists; 00072 00073 LocationLists Locations; 00074 00075 public: 00076 void parse(DataExtractor data); 00077 void dump(raw_ostream &OS) const; 00078 }; 00079 } 00080 00081 #endif