From 5f29bb8a675e8f96452b632e7129113f7dec850e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 20 Aug 2019 20:51:52 +0000 Subject: Vendor import of stripped lldb trunk r366426 (just before the release_90 branch point): https://llvm.org/svn/llvm-project/lldb/trunk@366426 --- source/Symbol/UnwindTable.cpp | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'source/Symbol/UnwindTable.cpp') diff --git a/source/Symbol/UnwindTable.cpp b/source/Symbol/UnwindTable.cpp index 4f0b875c5c6f..a8f451dc4643 100644 --- a/source/Symbol/UnwindTable.cpp +++ b/source/Symbol/UnwindTable.cpp @@ -1,9 +1,8 @@ //===-- UnwindTable.cpp -----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -19,6 +18,7 @@ #include "lldb/Symbol/FuncUnwinders.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Symbol/SymbolVendor.h" // There is one UnwindTable object per ObjectFile. It contains a list of Unwind // objects -- one per function, populated lazily -- for the ObjectFile. Each @@ -27,8 +27,8 @@ using namespace lldb; using namespace lldb_private; -UnwindTable::UnwindTable(ObjectFile &objfile) - : m_object_file(objfile), m_unwinds(), m_initialized(false), m_mutex(), +UnwindTable::UnwindTable(Module &module) + : m_module(module), m_unwinds(), m_initialized(false), m_mutex(), m_eh_frame_up(), m_compact_unwind_up(), m_arm_unwind_up() {} // We can't do some of this initialization when the ObjectFile is running its @@ -43,33 +43,36 @@ void UnwindTable::Initialize() { if (m_initialized) // check again once we've acquired the lock return; m_initialized = true; + ObjectFile *object_file = m_module.GetObjectFile(); + if (!object_file) + return; - SectionList *sl = m_object_file.GetSectionList(); + SectionList *sl = m_module.GetSectionList(); if (!sl) return; SectionSP sect = sl->FindSectionByType(eSectionTypeEHFrame, true); if (sect.get()) { m_eh_frame_up.reset( - new DWARFCallFrameInfo(m_object_file, sect, DWARFCallFrameInfo::EH)); + new DWARFCallFrameInfo(*object_file, sect, DWARFCallFrameInfo::EH)); } sect = sl->FindSectionByType(eSectionTypeDWARFDebugFrame, true); if (sect) { m_debug_frame_up.reset( - new DWARFCallFrameInfo(m_object_file, sect, DWARFCallFrameInfo::DWARF)); + new DWARFCallFrameInfo(*object_file, sect, DWARFCallFrameInfo::DWARF)); } sect = sl->FindSectionByType(eSectionTypeCompactUnwind, true); if (sect) { - m_compact_unwind_up.reset(new CompactUnwindInfo(m_object_file, sect)); + m_compact_unwind_up.reset(new CompactUnwindInfo(*object_file, sect)); } sect = sl->FindSectionByType(eSectionTypeARMexidx, true); if (sect) { SectionSP sect_extab = sl->FindSectionByType(eSectionTypeARMextab, true); if (sect_extab.get()) { - m_arm_unwind_up.reset(new ArmUnwindInfo(m_object_file, sect, sect_extab)); + m_arm_unwind_up.reset(new ArmUnwindInfo(*object_file, sect, sect_extab)); } } } @@ -149,8 +152,7 @@ UnwindTable::GetUncachedFuncUnwindersContainingAddress(const Address &addr, void UnwindTable::Dump(Stream &s) { std::lock_guard guard(m_mutex); - s.Printf("UnwindTable for '%s':\n", - m_object_file.GetFileSpec().GetPath().c_str()); + s.Format("UnwindTable for '{0}':\n", m_module.GetFileSpec()); const_iterator begin = m_unwinds.begin(); const_iterator end = m_unwinds.end(); for (const_iterator pos = begin; pos != end; ++pos) { @@ -180,10 +182,16 @@ ArmUnwindInfo *UnwindTable::GetArmUnwindInfo() { return m_arm_unwind_up.get(); } -ArchSpec UnwindTable::GetArchitecture() { - return m_object_file.GetArchitecture(); +SymbolFile *UnwindTable::GetSymbolFile() { + if (SymbolVendor *vendor = m_module.GetSymbolVendor()) + return vendor->GetSymbolFile(); + return nullptr; } +ArchSpec UnwindTable::GetArchitecture() { return m_module.GetArchitecture(); } + bool UnwindTable::GetAllowAssemblyEmulationUnwindPlans() { - return m_object_file.AllowAssemblyEmulationUnwindPlans(); + if (ObjectFile *object_file = m_module.GetObjectFile()) + return object_file->AllowAssemblyEmulationUnwindPlans(); + return false; } -- cgit v1.2.3