#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/GSYM/DwarfTransformer.h"
#include "llvm/DebugInfo/GSYM/ExtractRanges.h"
#include "llvm/DebugInfo/GSYM/FileEntry.h"
#include "llvm/DebugInfo/GSYM/FileWriter.h"
#include "llvm/DebugInfo/GSYM/FunctionInfo.h"
#include "llvm/DebugInfo/GSYM/GsymCreator.h"
#include "llvm/DebugInfo/GSYM/GsymReader.h"
#include "llvm/DebugInfo/GSYM/Header.h"
#include "llvm/DebugInfo/GSYM/InlineInfo.h"
#include "llvm/DebugInfo/GSYM/OutputAggregator.h"
#include "llvm/DebugInfo/GSYM/StringTable.h"
#include "llvm/ObjectYAML/DWARFEmitter.h"
#include "llvm/Support/DataExtractor.h"
#include "llvm/Testing/Support/Error.h"
#include "gtest/gtest.h"
#include "gmock/gmock.h"
#include <string>
usingnamespacellvm;
usingnamespacegsym;
void checkError(ArrayRef<std::string> ExpectedMsgs, Error Err) { … }
void checkError(std::string ExpectedMsg, Error Err) { … }
TEST(GSYMTest, TestFileEntry) { … }
TEST(GSYMTest, TestFunctionInfo) { … }
static void TestFunctionInfoDecodeError(llvm::endianness ByteOrder,
StringRef Bytes,
const uint64_t BaseAddr,
std::string ExpectedErrorMsg) { … }
TEST(GSYMTest, TestFunctionInfoDecodeErrors) { … }
static void TestFunctionInfoEncodeError(llvm::endianness ByteOrder,
const FunctionInfo &FI,
std::string ExpectedErrorMsg) { … }
TEST(GSYMTest, TestFunctionInfoEncodeErrors) { … }
static void TestFunctionInfoEncodeDecode(llvm::endianness ByteOrder,
const FunctionInfo &FI) { … }
static void AddLines(uint64_t FuncAddr, uint32_t FileIdx, FunctionInfo &FI) { … }
static void AddInline(uint64_t FuncAddr, uint64_t FuncSize, FunctionInfo &FI) { … }
TEST(GSYMTest, TestFunctionInfoEncoding) { … }
static void TestInlineInfoEncodeDecode(llvm::endianness ByteOrder,
const InlineInfo &Inline) { … }
static void TestInlineInfoDecodeError(llvm::endianness ByteOrder,
StringRef Bytes, const uint64_t BaseAddr,
std::string ExpectedErrorMsg) { … }
static void TestInlineInfoEncodeError(llvm::endianness ByteOrder,
const InlineInfo &Inline,
std::string ExpectedErrorMsg) { … }
TEST(GSYMTest, TestInlineInfo) { … }
TEST(GSYMTest, TestInlineInfoEncodeErrors) { … }
TEST(GSYMTest, TestInlineInfoDecodeErrors) { … }
TEST(GSYMTest, TestLineEntry) { … }
TEST(GSYMTest, TestStringTable) { … }
static void TestFileWriterHelper(llvm::endianness ByteOrder) { … }
TEST(GSYMTest, TestFileWriter) { … }
TEST(GSYMTest, TestAddressRangeEncodeDecode) { … }
static void TestAddressRangeEncodeDecodeHelper(const AddressRanges &Ranges,
const uint64_t BaseAddr) { … }
TEST(GSYMTest, TestAddressRangesEncodeDecode) { … }
static void TestLineTableHelper(llvm::endianness ByteOrder,
const LineTable <) { … }
TEST(GSYMTest, TestLineTable) { … }
static void TestLineTableDecodeError(llvm::endianness ByteOrder,
StringRef Bytes, const uint64_t BaseAddr,
std::string ExpectedErrorMsg) { … }
TEST(GSYMTest, TestLineTableDecodeErrors) { … }
TEST(GSYMTest, TestLineTableEncodeErrors) { … }
static void TestHeaderEncodeError(const Header &H,
std::string ExpectedErrorMsg) { … }
static void TestHeaderDecodeError(StringRef Bytes,
std::string ExpectedErrorMsg) { … }
static void InitHeader(Header &H) { … }
TEST(GSYMTest, TestHeaderEncodeErrors) { … }
TEST(GSYMTest, TestHeaderDecodeErrors) { … }
static void TestHeaderEncodeDecode(const Header &H,
llvm::endianness ByteOrder) { … }
TEST(GSYMTest, TestHeaderEncodeDecode) { … }
static void TestGsymCreatorEncodeError(llvm::endianness ByteOrder,
const GsymCreator &GC,
std::string ExpectedErrorMsg) { … }
TEST(GSYMTest, TestGsymCreatorEncodeErrors) { … }
static void Compare(const GsymCreator &GC, const GsymReader &GR) { … }
static void TestEncodeDecode(const GsymCreator &GC, llvm::endianness ByteOrder,
uint16_t Version, uint8_t AddrOffSize,
uint64_t BaseAddress, uint32_t NumAddresses,
ArrayRef<uint8_t> UUID) { … }
TEST(GSYMTest, TestGsymCreator1ByteAddrOffsets) { … }
TEST(GSYMTest, TestGsymCreator2ByteAddrOffsets) { … }
TEST(GSYMTest, TestGsymCreator4ByteAddrOffsets) { … }
TEST(GSYMTest, TestGsymCreator8ByteAddrOffsets) { … }
static void VerifyFunctionInfo(const GsymReader &GR, uint64_t Addr,
const FunctionInfo &FI) { … }
static void VerifyFunctionInfoError(const GsymReader &GR, uint64_t Addr,
std::string ErrMessage) { … }
TEST(GSYMTest, TestGsymReader) { … }
TEST(GSYMTest, TestGsymLookups) { … }
TEST(GSYMTest, TestDWARFFunctionWithAddresses) { … }
TEST(GSYMTest, TestDWARFFunctionWithAddressAndOffset) { … }
TEST(GSYMTest, TestDWARFStructMethodNoMangled) { … }
TEST(GSYMTest, TestDWARFTextRanges) { … }
TEST(GSYMTest, TestEmptySymbolEndAddressOfTextRanges) { … }
TEST(GSYMTest, TestDWARFInlineInfo) { … }
TEST(GSYMTest, TestDWARFNoLines) { … }
TEST(GSYMTest, TestDWARFDeadStripAddr4) { … }
TEST(GSYMTest, TestDWARFDeadStripAddr8) { … }
TEST(GSYMTest, TestGsymCreatorMultipleSymbolsWithNoSize) { … }
static void AddFunctionInfo(GsymCreator &GC, const char *FuncName,
uint64_t FuncAddr, const char *SourcePath,
const char *HeaderPath) { … }
static Expected<GsymReader> FinalizeEncodeAndDecode(GsymCreator &GC) { … }
TEST(GSYMTest, TestGsymSegmenting) { … }
TEST(GSYMTest, TestGsymSegmentingNoBase) { … }
TEST(GSYMTest, TestDWARFInlineRangeScopes) { … }
TEST(GSYMTest, TestDWARFEmptyInline) { … }
TEST(GSYMTest, TestFinalizeForLineTables) { … }
TEST(GSYMTest, TestRangeWarnings) { … }
TEST(GSYMTest, TestEmptyRangeWarnings) { … }
TEST(GSYMTest, TestEmptyLinkageName) { … }
TEST(GSYMTest, TestLineTablesWithEmptyRanges) { … }
TEST(GSYMTest, TestHandlingOfInvalidFileIndexes) { … }
TEST(GSYMTest, TestLookupsOfOverlappingAndUnequalRanges) { … }