Add basic support for .debug_ranges section to LLVM's DebugInfo library.
[oota-llvm.git] / lib / DebugInfo / DWARFDebugRangeList.h
1 //===-- DWARFDebugRangeList.h -----------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_DEBUGINFO_DWARFDEBUGRANGELIST_H
11 #define LLVM_DEBUGINFO_DWARFDEBUGRANGELIST_H
12
13 #include "llvm/Support/DataExtractor.h"
14 #include <vector>
15
16 namespace llvm {
17
18 class raw_ostream;
19
20 class DWARFDebugRangeList {
21 public:
22   struct RangeListEntry {
23     // A beginning address offset. This address offset has the size of an
24     // address and is relative to the applicable base address of the
25     // compilation unit referencing this range list. It marks the beginning
26     // of an address range.
27     uint64_t StartAddress;
28     // An ending address offset. This address offset again has the size of
29     // an address and is relative to the applicable base address of the
30     // compilation unit referencing this range list. It marks the first
31     // address past the end of the address range. The ending address must
32     // be greater than or equal to the beginning address.
33     uint64_t EndAddress;
34   };
35
36 private:
37   // Offset in .debug_ranges section.
38   uint32_t Offset;
39   uint8_t AddressSize;
40   std::vector<RangeListEntry> Entries;
41
42 public:
43   DWARFDebugRangeList() { clear(); }
44   void clear();
45   void dump(raw_ostream &OS) const;
46   bool extract(DataExtractor data, uint32_t *offset_ptr);
47 };
48
49 }  // namespace llvm
50
51 #endif  // LLVM_DEBUGINFO_DWARFDEBUGRANGELIST_H