1259698Sdim//===-- DWARFDebugLoc.h -----------------------------------------*- C++ -*-===// 2259698Sdim// 3259698Sdim// The LLVM Compiler Infrastructure 4259698Sdim// 5259698Sdim// This file is distributed under the University of Illinois Open Source 6259698Sdim// License. See LICENSE.TXT for details. 7259698Sdim// 8259698Sdim//===----------------------------------------------------------------------===// 9259698Sdim 10259698Sdim#ifndef LLVM_DEBUGINFO_DWARFDEBUGLOC_H 11259698Sdim#define LLVM_DEBUGINFO_DWARFDEBUGLOC_H 12259698Sdim 13259698Sdim#include "DWARFRelocMap.h" 14259698Sdim#include "llvm/ADT/SmallVector.h" 15259698Sdim#include "llvm/Support/DataExtractor.h" 16259698Sdim 17259698Sdimnamespace llvm { 18259698Sdim 19259698Sdimclass raw_ostream; 20259698Sdim 21259698Sdimclass DWARFDebugLoc { 22259698Sdim /// A single location within a location list. 23259698Sdim struct Entry { 24259698Sdim /// The beginning address of the instruction range. 25259698Sdim uint64_t Begin; 26259698Sdim /// The ending address of the instruction range. 27259698Sdim uint64_t End; 28259698Sdim /// The location of the variable within the specified range. 29259698Sdim SmallVector<unsigned char, 4> Loc; 30259698Sdim }; 31259698Sdim 32259698Sdim /// A list of locations that contain one variable. 33259698Sdim struct LocationList { 34259698Sdim /// The beginning offset where this location list is stored in the debug_loc 35259698Sdim /// section. 36259698Sdim unsigned Offset; 37259698Sdim /// All the locations in which the variable is stored. 38259698Sdim SmallVector<Entry, 2> Entries; 39259698Sdim }; 40259698Sdim 41259698Sdim typedef SmallVector<LocationList, 4> LocationLists; 42259698Sdim 43259698Sdim /// A list of all the variables in the debug_loc section, each one describing 44259698Sdim /// the locations in which the variable is stored. 45259698Sdim LocationLists Locations; 46259698Sdim 47259698Sdim /// A map used to resolve binary relocations. 48259698Sdim const RelocAddrMap &RelocMap; 49259698Sdim 50259698Sdimpublic: 51259698Sdim DWARFDebugLoc(const RelocAddrMap &LocRelocMap) : RelocMap(LocRelocMap) {} 52259698Sdim /// Print the location lists found within the debug_loc section. 53259698Sdim void dump(raw_ostream &OS) const; 54259698Sdim /// Parse the debug_loc section accessible via the 'data' parameter using the 55259698Sdim /// specified address size to interpret the address ranges. 56259698Sdim void parse(DataExtractor data, unsigned AddressSize); 57259698Sdim}; 58259698Sdim} 59259698Sdim 60259698Sdim#endif 61