[lldb] Group ABI plugins

Summary:
There's a fair amount of code duplication between the different ABI plugins for
the same architecture (e.g. ABIMacOSX_arm & ABISysV_arm). Deduplicating this
code is not very easy at the moment because there is no good place where to put
the common code.

Instead of creating more plugins, this patch reduces their number by grouping
similar plugins into a single folder/plugin. This makes it easy to extract
common code to a (e.g.) base class, which can then live in the same folder.

The grouping is done based on the underlying llvm target for that architecture,
because the plugins already require this for their operation.

Reviewers: JDevlieghere, jasonmolenda, jfb

Subscribers: sdardis, nemanjai, mgorny, kristof.beyls, fedor.sergeev, kbarton, jrtc27, atanasyan, jsji, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74138
This commit is contained in:
Pavel Labath 2020-02-02 08:48:51 +01:00
parent 2e005c64f3
commit e21b39a86d
48 changed files with 51 additions and 141 deletions

View File

@ -24,21 +24,21 @@
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Utility/Timer.h"
#include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
#include "Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h"
#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
#include "Plugins/ABI/SysV-arc/ABISysV_arc.h"
#include "Plugins/ABI/SysV-arm/ABISysV_arm.h"
#include "Plugins/ABI/SysV-arm64/ABISysV_arm64.h"
#include "Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h"
#include "Plugins/ABI/SysV-i386/ABISysV_i386.h"
#include "Plugins/ABI/SysV-mips/ABISysV_mips.h"
#include "Plugins/ABI/SysV-mips64/ABISysV_mips64.h"
#include "Plugins/ABI/SysV-ppc/ABISysV_ppc.h"
#include "Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h"
#include "Plugins/ABI/SysV-s390x/ABISysV_s390x.h"
#include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
#include "Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h"
#include "Plugins/ABI/AArch64/ABIMacOSX_arm64.h"
#include "Plugins/ABI/AArch64/ABISysV_arm64.h"
#include "Plugins/ABI/ARC/ABISysV_arc.h"
#include "Plugins/ABI/ARM/ABIMacOSX_arm.h"
#include "Plugins/ABI/ARM/ABISysV_arm.h"
#include "Plugins/ABI/Hexagon/ABISysV_hexagon.h"
#include "Plugins/ABI/Mips/ABISysV_mips.h"
#include "Plugins/ABI/Mips/ABISysV_mips64.h"
#include "Plugins/ABI/PowerPC/ABISysV_ppc.h"
#include "Plugins/ABI/PowerPC/ABISysV_ppc64.h"
#include "Plugins/ABI/SystemZ/ABISysV_s390x.h"
#include "Plugins/ABI/X86/ABIMacOSX_i386.h"
#include "Plugins/ABI/X86/ABISysV_i386.h"
#include "Plugins/ABI/X86/ABISysV_x86_64.h"
#include "Plugins/ABI/X86/ABIWindows_x86_64.h"
#include "Plugins/Architecture/Arm/ArchitectureArm.h"
#include "Plugins/Architecture/Mips/ArchitectureMips.h"
#include "Plugins/Architecture/PPC64/ArchitecturePPC64.h"

View File

@ -1,6 +1,7 @@
add_lldb_library(lldbPluginABIMacOSX_arm64 PLUGIN
add_lldb_library(lldbPluginABIAArch64 PLUGIN
ABIMacOSX_arm64.cpp
ABISysV_arm64.cpp
LINK_LIBS
lldbCore
lldbSymbol

View File

@ -1,4 +1,4 @@
add_lldb_library(lldbPluginABISysV_arc PLUGIN
add_lldb_library(lldbPluginABIARC PLUGIN
ABISysV_arc.cpp
LINK_LIBS

View File

@ -1,5 +1,6 @@
add_lldb_library(lldbPluginABIMacOSX_arm PLUGIN
add_lldb_library(lldbPluginABIARM PLUGIN
ABIMacOSX_arm.cpp
ABISysV_arm.cpp
LINK_LIBS
lldbCore

View File

@ -1,31 +1,5 @@
if ("AArch64" IN_LIST LLVM_TARGETS_TO_BUILD)
add_subdirectory(MacOSX-arm64)
add_subdirectory(SysV-arm64)
endif()
if ("ARM" IN_LIST LLVM_TARGETS_TO_BUILD)
add_subdirectory(MacOSX-arm)
add_subdirectory(SysV-arm)
endif()
if ("ARC" IN_LIST LLVM_TARGETS_TO_BUILD)
add_subdirectory(SysV-arc)
endif()
if ("Hexagon" IN_LIST LLVM_TARGETS_TO_BUILD)
add_subdirectory(SysV-hexagon)
endif()
if ("Mips" IN_LIST LLVM_TARGETS_TO_BUILD)
add_subdirectory(SysV-mips)
add_subdirectory(SysV-mips64)
endif()
if ("PowerPC" IN_LIST LLVM_TARGETS_TO_BUILD)
add_subdirectory(SysV-ppc)
add_subdirectory(SysV-ppc64)
endif()
if ("SystemZ" IN_LIST LLVM_TARGETS_TO_BUILD)
add_subdirectory(SysV-s390x)
endif()
if ("X86" IN_LIST LLVM_TARGETS_TO_BUILD)
add_subdirectory(SysV-i386)
add_subdirectory(SysV-x86_64)
add_subdirectory(MacOSX-i386)
add_subdirectory(Windows-x86_64)
endif()
foreach(target AArch64 ARM ARC Hexagon Mips PowerPC SystemZ X86)
if (${target} IN_LIST LLVM_TARGETS_TO_BUILD)
add_subdirectory(${target})
endif()
endforeach()

View File

@ -1,4 +1,4 @@
add_lldb_library(lldbPluginABISysV_hexagon PLUGIN
add_lldb_library(lldbPluginABIHexagon PLUGIN
ABISysV_hexagon.cpp
LINK_LIBS

View File

@ -1,10 +0,0 @@
add_lldb_library(lldbPluginABIMacOSX_i386 PLUGIN
ABIMacOSX_i386.cpp
LINK_LIBS
lldbCore
lldbSymbol
lldbTarget
LINK_COMPONENTS
Support
)

View File

@ -1,4 +1,5 @@
add_lldb_library(lldbPluginABISysV_mips64 PLUGIN
add_lldb_library(lldbPluginABIMips PLUGIN
ABISysV_mips.cpp
ABISysV_mips64.cpp
LINK_LIBS

View File

@ -1,4 +1,5 @@
add_lldb_library(lldbPluginABISysV_ppc64 PLUGIN
add_lldb_library(lldbPluginABIPowerPC PLUGIN
ABISysV_ppc.cpp
ABISysV_ppc64.cpp
LINK_LIBS

View File

@ -1,11 +0,0 @@
add_lldb_library(lldbPluginABISysV_arm PLUGIN
ABISysV_arm.cpp
LINK_LIBS
lldbCore
lldbSymbol
lldbTarget
lldbPluginProcessUtility
LINK_COMPONENTS
Support
)

View File

@ -1,10 +0,0 @@
add_lldb_library(lldbPluginABISysV_arm64 PLUGIN
ABISysV_arm64.cpp
LINK_LIBS
lldbCore
lldbSymbol
lldbTarget
LINK_COMPONENTS
Support
)

View File

@ -1,10 +0,0 @@
add_lldb_library(lldbPluginABISysV_i386 PLUGIN
ABISysV_i386.cpp
LINK_LIBS
lldbCore
lldbSymbol
lldbTarget
LINK_COMPONENTS
Support
)

View File

@ -1,10 +0,0 @@
add_lldb_library(lldbPluginABISysV_mips PLUGIN
ABISysV_mips.cpp
LINK_LIBS
lldbCore
lldbSymbol
lldbTarget
LINK_COMPONENTS
Support
)

View File

@ -1,10 +0,0 @@
add_lldb_library(lldbPluginABISysV_ppc PLUGIN
ABISysV_ppc.cpp
LINK_LIBS
lldbCore
lldbSymbol
lldbTarget
LINK_COMPONENTS
Support
)

View File

@ -1,10 +0,0 @@
add_lldb_library(lldbPluginABISysV_x86_64 PLUGIN
ABISysV_x86_64.cpp
LINK_LIBS
lldbCore
lldbSymbol
lldbTarget
LINK_COMPONENTS
Support
)

View File

@ -1,4 +1,4 @@
add_lldb_library(lldbPluginABISysV_s390x PLUGIN
add_lldb_library(lldbPluginABISystemZ PLUGIN
ABISysV_s390x.cpp
LINK_LIBS

View File

@ -1,4 +1,7 @@
add_lldb_library(lldbPluginABIWindows_x86_64 PLUGIN
add_lldb_library(lldbPluginABIX86 PLUGIN
ABIMacOSX_i386.cpp
ABISysV_i386.cpp
ABISysV_x86_64.cpp
ABIWindows_x86_64.cpp
LINK_LIBS

View File

@ -14,21 +14,21 @@
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Utility/Timer.h"
#include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
#include "Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h"
#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
#include "Plugins/ABI/SysV-arc/ABISysV_arc.h"
#include "Plugins/ABI/SysV-arm/ABISysV_arm.h"
#include "Plugins/ABI/SysV-arm64/ABISysV_arm64.h"
#include "Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h"
#include "Plugins/ABI/SysV-i386/ABISysV_i386.h"
#include "Plugins/ABI/SysV-mips/ABISysV_mips.h"
#include "Plugins/ABI/SysV-mips64/ABISysV_mips64.h"
#include "Plugins/ABI/SysV-ppc/ABISysV_ppc.h"
#include "Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h"
#include "Plugins/ABI/SysV-s390x/ABISysV_s390x.h"
#include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
#include "Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h"
#include "Plugins/ABI/AArch64/ABIMacOSX_arm64.h"
#include "Plugins/ABI/AArch64/ABISysV_arm64.h"
#include "Plugins/ABI/ARC/ABISysV_arc.h"
#include "Plugins/ABI/ARM/ABIMacOSX_arm.h"
#include "Plugins/ABI/ARM/ABISysV_arm.h"
#include "Plugins/ABI/Hexagon/ABISysV_hexagon.h"
#include "Plugins/ABI/Mips/ABISysV_mips.h"
#include "Plugins/ABI/Mips/ABISysV_mips64.h"
#include "Plugins/ABI/PowerPC/ABISysV_ppc.h"
#include "Plugins/ABI/PowerPC/ABISysV_ppc64.h"
#include "Plugins/ABI/SystemZ/ABISysV_s390x.h"
#include "Plugins/ABI/X86/ABIMacOSX_i386.h"
#include "Plugins/ABI/X86/ABISysV_i386.h"
#include "Plugins/ABI/X86/ABISysV_x86_64.h"
#include "Plugins/ABI/X86/ABIWindows_x86_64.h"
#include "Plugins/Architecture/Arm/ArchitectureArm.h"
#include "Plugins/Architecture/Mips/ArchitectureMips.h"
#include "Plugins/Architecture/PPC64/ArchitecturePPC64.h"