summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile/DWARF/DIERef.cpp
blob: 6837700a8e88174ca8996c0c094e7d554b10354d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//===-- DIERef.cpp ----------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "DIERef.h"
#include "DWARFUnit.h"
#include "DWARFDebugInfo.h"
#include "DWARFFormValue.h"
#include "SymbolFileDWARF.h"
#include "SymbolFileDWARFDebugMap.h"

DIERef::DIERef(const DWARFFormValue &form_value) {
  if (form_value.IsValid()) {
    DWARFDIE die = form_value.Reference();
    die_offset = die.GetOffset();
    if (die) {
      section = die.GetCU()->GetDebugSection();
      if (die.GetCU()->GetBaseObjOffset() != DW_INVALID_OFFSET)
        cu_offset = die.GetCU()->GetBaseObjOffset();
      else
        cu_offset = die.GetCU()->GetOffset();
    }
  }
}
OpenPOWER on IntegriCloud