xref: /trueos/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp (revision 958843c32b7a29741f2e45996b5b3e89f9e108b0)
1 //===-- DWARFDataExtractor.cpp ----------------------------------*- 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 #include "DWARFDataExtractor.h"
11 
12 namespace lldb_private {
13 
14 uint64_t
GetDWARFInitialLength(lldb::offset_t * offset_ptr) const15 DWARFDataExtractor::GetDWARFInitialLength(lldb::offset_t *offset_ptr) const
16 {
17     uint64_t length = GetU32(offset_ptr);
18     m_is_dwarf64 = (length == UINT32_MAX);
19     if (m_is_dwarf64)
20         length = GetU64(offset_ptr);
21     return length;
22 }
23 
24 dw_offset_t
GetDWARFOffset(lldb::offset_t * offset_ptr) const25 DWARFDataExtractor::GetDWARFOffset(lldb::offset_t *offset_ptr) const
26 {
27     return GetMaxU64(offset_ptr, m_is_dwarf64 ? 8 : 4);
28 }
29 
30 }
31