xref: /openbsd-src/gnu/llvm/lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp (revision f6aab3d83b51b91c24247ad2c2573574de475a82)
1dda28197Spatrick //===-- DWARFDataExtractor.cpp --------------------------------------------===//
2061da546Spatrick //
3061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4061da546Spatrick // See https://llvm.org/LICENSE.txt for license information.
5061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6061da546Spatrick //
7061da546Spatrick //===----------------------------------------------------------------------===//
8061da546Spatrick 
9061da546Spatrick #include "DWARFDataExtractor.h"
10061da546Spatrick #include "llvm/ADT/StringRef.h"
11061da546Spatrick 
12061da546Spatrick namespace lldb_private {
13061da546Spatrick 
14061da546Spatrick uint64_t
GetDWARFInitialLength(lldb::offset_t * offset_ptr) const15061da546Spatrick DWARFDataExtractor::GetDWARFInitialLength(lldb::offset_t *offset_ptr) const {
16061da546Spatrick   return GetU32(offset_ptr);
17061da546Spatrick }
18061da546Spatrick 
19061da546Spatrick dw_offset_t
GetDWARFOffset(lldb::offset_t * offset_ptr) const20061da546Spatrick DWARFDataExtractor::GetDWARFOffset(lldb::offset_t *offset_ptr) const {
21061da546Spatrick   return GetMaxU64(offset_ptr, GetDWARFSizeOfOffset());
22061da546Spatrick }
23061da546Spatrick 
GetAsLLVM() const24061da546Spatrick llvm::DWARFDataExtractor DWARFDataExtractor::GetAsLLVM() const {
25*f6aab3d8Srobert   return llvm::DWARFDataExtractor(llvm::ArrayRef(GetDataStart(), GetByteSize()),
26*f6aab3d8Srobert                                   GetByteOrder() == lldb::eByteOrderLittle,
27*f6aab3d8Srobert                                   GetAddressByteSize());
28061da546Spatrick }
29061da546Spatrick } // namespace lldb_private
30