]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp
Merge lldb trunk r366426, resolve conflicts, and update FREEBSD-Xlist.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Plugins / SymbolFile / DWARF / DWARFDataExtractor.cpp
1 //===-- DWARFDataExtractor.cpp ----------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "DWARFDataExtractor.h"
10 #include "llvm/ADT/StringRef.h"
11
12 namespace lldb_private {
13
14 uint64_t
15 DWARFDataExtractor::GetDWARFInitialLength(lldb::offset_t *offset_ptr) const {
16   return GetU32(offset_ptr);
17 }
18
19 dw_offset_t
20 DWARFDataExtractor::GetDWARFOffset(lldb::offset_t *offset_ptr) const {
21   return GetMaxU64(offset_ptr, GetDWARFSizeOfOffset());
22 }
23
24 llvm::DWARFDataExtractor DWARFDataExtractor::GetAsLLVM() const {
25   return llvm::DWARFDataExtractor(
26       llvm::StringRef(reinterpret_cast<const char *>(GetDataStart()),
27                       GetByteSize()),
28       GetByteOrder() == lldb::eByteOrderLittle, GetAddressByteSize());
29 }
30 } // namespace lldb_private