| 1 |
//===- YAMLModuleTester.h ---------------------------------------*- 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 |
#ifndef LLDB_UNITTESTS_TESTINGSUPPORT_SYMBOL_YAMLMODULETESTER_H |
| 10 |
#define LLDB_UNITTESTS_TESTINGSUPPORT_SYMBOL_YAMLMODULETESTER_H |
| 11 |
|
| 12 |
#include "Plugins/ObjectFile/ELF/ObjectFileELF.h" |
| 13 |
#include "Plugins/SymbolFile/DWARF/DWARFUnit.h" |
| 14 |
#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h" |
| 15 |
#include "Plugins/TypeSystem/Clang/TypeSystemClang.h" |
| 16 |
#include "TestingSupport/SubsystemRAII.h" |
| 17 |
#include "TestingSupport/TestUtilities.h" |
| 18 |
#include "lldb/Core/Module.h" |
| 19 |
#include "lldb/Host/HostInfo.h" |
| 20 |
#include <optional> |
| 21 |
|
| 22 |
namespace lldb_private { |
| 23 |
|
| 24 |
/// Helper class that can construct a module from YAML and evaluate |
| 25 |
/// DWARF expressions on it. |
| 26 |
class YAMLModuleTester { |
| 27 |
protected: |
| 28 |
SubsystemRAII<FileSystem, HostInfo, TypeSystemClang, ObjectFileELF, |
| 29 |
SymbolFileDWARF> |
| 30 |
subsystems; |
| 31 |
std::optional<TestFile> m_file; |
| 32 |
lldb::ModuleSP m_module_sp; |
| 33 |
DWARFUnit *m_dwarf_unit; |
| 34 |
|
| 35 |
public: |
| 36 |
/// Parse the debug info sections from the YAML description. |
| 37 |
YAMLModuleTester(llvm::StringRef yaml_data, size_t cu_index = 0); |
| 38 |
DWARFUnit *GetDwarfUnit() const { return m_dwarf_unit; } |
| 39 |
lldb::ModuleSP GetModule() const { return m_module_sp; } |
| 40 |
}; |
| 41 |
|
| 42 |
} // namespace lldb_private |
| 43 |
|
| 44 |
#endif // LLDB_UNITTESTS_TESTINGSUPPORT_SYMBOL_YAMLMODULETESTER_H |