Reapply r327151 (partially):

For our lldb customizations, instead of commenting out lines, use #ifdef
LLDB_ENABLE_ALL / #endif preprocess directives instead, so our diffs
against upstream only consist of added lines.

(Note that upstream has largely reshuffled the way optional lldb plugins
are handled, so we need a lot less of these #ifdefs. However, not all of
them can be dropped, unless we re-import several sources that we have
always skipped.)
This commit is contained in:
Dimitry Andric 2020-08-06 15:46:39 +00:00
parent 876f11703d
commit 580012d604
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/clang1100-import/; revision=363961
8 changed files with 50 additions and 1 deletions

View File

@ -7,7 +7,9 @@
//===----------------------------------------------------------------------===//
#include "ABIAArch64.h"
#ifdef LLDB_ENABLE_ALL
#include "ABIMacOSX_arm64.h"
#endif // LLDB_ENABLE_ALL
#include "ABISysV_arm64.h"
#include "Utility/ARM64_DWARF_Registers.h"
#include "lldb/Core/PluginManager.h"
@ -16,12 +18,16 @@ LLDB_PLUGIN_DEFINE(ABIAArch64)
void ABIAArch64::Initialize() {
ABISysV_arm64::Initialize();
#ifdef LLDB_ENABLE_ALL
ABIMacOSX_arm64::Initialize();
#endif // LLDB_ENABLE_ALL
}
void ABIAArch64::Terminate() {
ABISysV_arm64::Terminate();
#ifdef LLDB_ENABLE_ALL
ABIMacOSX_arm64::Terminate();
#endif // LLDB_ENABLE_ALL
}
std::pair<uint32_t, uint32_t>

View File

@ -7,7 +7,9 @@
//===----------------------------------------------------------------------===//
#include "ABIARM.h"
#ifdef LLDB_ENABLE_ALL
#include "ABIMacOSX_arm.h"
#endif // LLDB_ENABLE_ALL
#include "ABISysV_arm.h"
#include "lldb/Core/PluginManager.h"
@ -15,10 +17,14 @@ LLDB_PLUGIN_DEFINE(ABIARM)
void ABIARM::Initialize() {
ABISysV_arm::Initialize();
#ifdef LLDB_ENABLE_ALL
ABIMacOSX_arm::Initialize();
#endif // LLDB_ENABLE_ALL
}
void ABIARM::Terminate() {
ABISysV_arm::Terminate();
#ifdef LLDB_ENABLE_ALL
ABIMacOSX_arm::Terminate();
#endif // LLDB_ENABLE_ALL
}

View File

@ -7,26 +7,38 @@
//===----------------------------------------------------------------------===//
#include "ABIX86.h"
#ifdef LLDB_ENABLE_ALL
#include "ABIMacOSX_i386.h"
#endif // LLDB_ENABLE_ALL
#include "ABISysV_i386.h"
#include "ABISysV_x86_64.h"
#ifdef LLDB_ENABLE_ALL
#include "ABIWindows_x86_64.h"
#endif // LLDB_ENABLE_ALL
#include "lldb/Core/PluginManager.h"
LLDB_PLUGIN_DEFINE(ABIX86)
void ABIX86::Initialize() {
#ifdef LLDB_ENABLE_ALL
ABIMacOSX_i386::Initialize();
#endif // LLDB_ENABLE_ALL
ABISysV_i386::Initialize();
ABISysV_x86_64::Initialize();
#ifdef LLDB_ENABLE_ALL
ABIWindows_x86_64::Initialize();
#endif // LLDB_ENABLE_ALL
}
void ABIX86::Terminate() {
#ifdef LLDB_ENABLE_ALL
ABIMacOSX_i386::Terminate();
#endif // LLDB_ENABLE_ALL
ABISysV_i386::Terminate();
ABISysV_x86_64::Terminate();
#ifdef LLDB_ENABLE_ALL
ABIWindows_x86_64::Terminate();
#endif // LLDB_ENABLE_ALL
}
uint32_t ABIX86::GetGenericNum(llvm::StringRef name) {

View File

@ -7,7 +7,9 @@
//===----------------------------------------------------------------------===//
#include "JITLoaderGDB.h"
#ifdef LLDB_ENABLE_ALL
#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
#endif // LLDB_ENABLE_ALL
#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
@ -338,6 +340,7 @@ bool JITLoaderGDB::ReadJITDescriptorImpl(bool all_entries) {
module_sp->GetObjectFile()->GetSymtab();
m_jit_objects.insert(std::make_pair(symbolfile_addr, module_sp));
#ifdef LLDB_ENABLE_ALL
if (auto image_object_file =
llvm::dyn_cast<ObjectFileMachO>(module_sp->GetObjectFile())) {
const SectionList *section_list = image_object_file->GetSectionList();
@ -349,7 +352,9 @@ bool JITLoaderGDB::ReadJITDescriptorImpl(bool all_entries) {
symbolfile_size, vmaddrheuristic, lower,
upper);
}
} else {
} else
#endif // LLDB_ENABLE_ALL
{
bool changed = false;
module_sp->SetLoadAddress(target, 0, true, changed);
}

View File

@ -20,7 +20,9 @@
#include "Plugins/Process/Utility/RegisterContextLinux_i386.h"
#include "Plugins/Process/Utility/RegisterContextLinux_mips.h"
#include "Plugins/Process/Utility/RegisterContextLinux_mips64.h"
#ifdef LLDB_ENABLE_ALL
#include "Plugins/Process/Utility/RegisterContextLinux_s390x.h"
#endif // LLDB_ENABLE_ALL
#include "Plugins/Process/Utility/RegisterContextLinux_x86_64.h"
#include "Plugins/Process/Utility/RegisterContextNetBSD_x86_64.h"
#include "Plugins/Process/Utility/RegisterContextOpenBSD_i386.h"
@ -34,7 +36,9 @@
#include "RegisterContextPOSIXCore_mips64.h"
#include "RegisterContextPOSIXCore_powerpc.h"
#include "RegisterContextPOSIXCore_ppc64le.h"
#ifdef LLDB_ENABLE_ALL
#include "RegisterContextPOSIXCore_s390x.h"
#endif // LLDB_ENABLE_ALL
#include "RegisterContextPOSIXCore_x86_64.h"
#include "ThreadElfCore.h"
@ -138,9 +142,11 @@ ThreadElfCore::CreateRegisterContextForFrame(StackFrame *frame) {
case llvm::Triple::ppc64le:
reg_interface = new RegisterInfoPOSIX_ppc64le(arch);
break;
#ifdef LLDB_ENABLE_ALL
case llvm::Triple::systemz:
reg_interface = new RegisterContextLinux_s390x(arch);
break;
#endif // LLDB_ENABLE_ALL
case llvm::Triple::x86:
reg_interface = new RegisterContextLinux_i386(arch);
break;
@ -211,10 +217,12 @@ ThreadElfCore::CreateRegisterContextForFrame(StackFrame *frame) {
m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_ppc64le>(
*this, reg_interface, m_gpregset_data, m_notes);
break;
#ifdef LLDB_ENABLE_ALL
case llvm::Triple::systemz:
m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_s390x>(
*this, reg_interface, m_gpregset_data, m_notes);
break;
#endif // LLDB_ENABLE_ALL
case llvm::Triple::x86:
case llvm::Triple::x86_64:
m_thread_reg_ctx_sp = std::make_shared<RegisterContextCorePOSIX_x86_64>(

View File

@ -73,7 +73,9 @@
#include "lldb/Utility/Timer.h"
#include "GDBRemoteRegisterContext.h"
#ifdef LLDB_ENABLE_ALL
#include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
#endif // LLDB_ENABLE_ALL
#include "Plugins/Process/Utility/GDBRemoteSignals.h"
#include "Plugins/Process/Utility/InferiorCallPOSIX.h"
#include "Plugins/Process/Utility/StopInfoMachException.h"
@ -2424,6 +2426,7 @@ Status ProcessGDBRemote::DoDestroy() {
Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
LLDB_LOGF(log, "ProcessGDBRemote::DoDestroy()");
#ifdef LLDB_ENABLE_ALL // XXX Currently no iOS target support on FreeBSD
// There is a bug in older iOS debugservers where they don't shut down the
// process they are debugging properly. If the process is sitting at a
// breakpoint or an exception, this can cause problems with restarting. So
@ -2527,6 +2530,7 @@ Status ProcessGDBRemote::DoDestroy() {
}
}
}
#endif // LLDB_ENABLE_ALL
// Interrupt if our inferior is running...
int exit_status = SIGABRT;

View File

@ -9092,11 +9092,13 @@ DWARFASTParser *TypeSystemClang::GetDWARFParser() {
return m_dwarf_ast_parser_up.get();
}
#ifdef LLDB_ENABLE_ALL
PDBASTParser *TypeSystemClang::GetPDBParser() {
if (!m_pdb_ast_parser_up)
m_pdb_ast_parser_up = std::make_unique<PDBASTParser>(*this);
return m_pdb_ast_parser_up.get();
}
#endif // LLDB_ENABLE_ALL
bool TypeSystemClang::LayoutRecordType(
const clang::RecordDecl *record_decl, uint64_t &bit_size,
@ -9109,8 +9111,10 @@ bool TypeSystemClang::LayoutRecordType(
lldb_private::ClangASTImporter *importer = nullptr;
if (m_dwarf_ast_parser_up)
importer = &m_dwarf_ast_parser_up->GetClangASTImporter();
#ifdef LLDB_ENABLE_ALL
if (!importer && m_pdb_ast_parser_up)
importer = &m_pdb_ast_parser_up->GetClangASTImporter();
#endif // LLDB_ENABLE_ALL
if (!importer)
return false;

View File

@ -465,7 +465,9 @@ class TypeSystemClang : public TypeSystem {
// TypeSystem methods
DWARFASTParser *GetDWARFParser() override;
#ifdef LLDB_ENABLE_ALL
PDBASTParser *GetPDBParser() override;
#endif // LLDB_ENABLE_ALL
// TypeSystemClang callbacks for external source lookups.
void CompleteTagDecl(clang::TagDecl *);
@ -1084,7 +1086,9 @@ class TypeSystemClang : public TypeSystem {
std::unique_ptr<clang::HeaderSearch> m_header_search_up;
std::unique_ptr<clang::ModuleMap> m_module_map_up;
std::unique_ptr<DWARFASTParserClang> m_dwarf_ast_parser_up;
#ifdef LLDB_ENABLE_ALL
std::unique_ptr<PDBASTParser> m_pdb_ast_parser_up;
#endif // LLDB_ENABLE_ALL
std::unique_ptr<clang::MangleContext> m_mangle_ctx_up;
uint32_t m_pointer_byte_size = 0;
bool m_ast_owned = false;