blob: 09e258a87f23921b7749b9cbb59df4a08d9f8cd8 [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SRC_DEVELOPER_DEBUG_ZXDB_SYMBOLS_DWARF_TEST_UTIL_H_
#define SRC_DEVELOPER_DEBUG_ZXDB_SYMBOLS_DWARF_TEST_UTIL_H_
#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
namespace llvm {
class DWARFContext;
class DWARFDie;
} // namespace llvm
namespace zxdb {
// Returns the unit in the list with a name ending in the given string. The name is normally the
// file name, so searching for "/foo.cc" will find the unit corresponding to foo.cc (the full path
// in the unit name may be more complicated so don't depend on the particulars of that).
llvm::DWARFUnit* GetUnitWithNameEndingIn(llvm::DWARFContext* context, llvm::DWARFUnitVector& units,
const std::string& name);
// Returns the first DIE in the unit with the matching tag and DW_AT_Name attribute. If not found,t
// he returned DIE will be !isValid().
llvm::DWARFDie GetFirstDieOfTagAndName(llvm::DWARFContext* context, llvm::DWARFUnit* unit,
llvm::dwarf::Tag tag, const std::string& name);
} // namespace zxdb
#endif // SRC_DEVELOPER_DEBUG_ZXDB_SYMBOLS_DWARF_TEST_UTIL_H_