Skip to content

Commit

Permalink
Merged master:79809f58b024 into amd-gfx:42dde2b449a6
Browse files Browse the repository at this point in the history
Local branch amd-gfx 42dde2b Merged master:e547b1e2431f into amd-gfx:314f7fcdbcd3
Remote branch master 79809f5 [LLDB] On Windows, fix tests
  • Loading branch information
Sw authored and Sw committed Oct 8, 2020
2 parents 42dde2b + 79809f5 commit 9423a91
Show file tree
Hide file tree
Showing 35 changed files with 3,343 additions and 170 deletions.
11 changes: 7 additions & 4 deletions clang/lib/Sema/UsedDeclVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,13 @@ class UsedDeclVisitor : public EvaluatedExprVisitor<Derived> {
void VisitCXXDeleteExpr(CXXDeleteExpr *E) {
if (E->getOperatorDelete())
asImpl().visitUsedDecl(E->getBeginLoc(), E->getOperatorDelete());
QualType Destroyed = S.Context.getBaseElementType(E->getDestroyedType());
if (const RecordType *DestroyedRec = Destroyed->getAs<RecordType>()) {
CXXRecordDecl *Record = cast<CXXRecordDecl>(DestroyedRec->getDecl());
asImpl().visitUsedDecl(E->getBeginLoc(), S.LookupDestructor(Record));
QualType DestroyedOrNull = E->getDestroyedType();
if (!DestroyedOrNull.isNull()) {
QualType Destroyed = S.Context.getBaseElementType(DestroyedOrNull);
if (const RecordType *DestroyedRec = Destroyed->getAs<RecordType>()) {
CXXRecordDecl *Record = cast<CXXRecordDecl>(DestroyedRec->getDecl());
asImpl().visitUsedDecl(E->getBeginLoc(), S.LookupDestructor(Record));
}
}

Inherited::VisitCXXDeleteExpr(E);
Expand Down
2 changes: 1 addition & 1 deletion lld/ELF/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1992,7 +1992,7 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) {
// Handle -u/--undefined before input files. If both a.a and b.so define foo,
// -u foo a.a b.so will fetch a.a.
for (StringRef name : config->undefined)
addUnusedUndefined(name);
addUnusedUndefined(name)->referenced = true;

// Add all files to the symbol table. This will add almost all
// symbols that we need to the symbol table. This process might
Expand Down
11 changes: 11 additions & 0 deletions lld/test/ELF/weak-undef-lib.s
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@
# CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: Undefined

## -u specifies a STB_DEFAULT undefined symbol, so the definition from %t2.o is
## fetched.
# RUN: ld.lld -u foo %t1.o --start-lib %t2.o -o %t1
# RUN: llvm-readobj --syms %t1 | FileCheck %s --check-prefix=CHECK-U

# CHECK-U: Name: foo
# CHECK-U: Binding:
# CHECK-U-SAME: Global
# CHECK-U: Section:
# CHECK-U-SAME: .text

.weak foo
call foo@PLT

Expand Down
13 changes: 13 additions & 0 deletions lldb/packages/Python/lldbsuite/test/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# System modules
from distutils.version import LooseVersion
from functools import wraps
import ctypes
import locale
import os
import platform
import re
Expand Down Expand Up @@ -592,6 +594,17 @@ def skipIfWindows(func):
"""Decorate the item to skip tests that should be skipped on Windows."""
return skipIfPlatform(["windows"])(func)

def skipIfWindowsAndNonEnglish(func):
"""Decorate the item to skip tests that should be skipped on non-English locales on Windows."""
def is_Windows_NonEnglish(self):
if lldbplatformutil.getPlatform() != "windows":
return None
kernel = ctypes.windll.kernel32
if locale.windows_locale[ kernel.GetUserDefaultUILanguage() ] == "en_US":
return None
return "skipping non-English Windows locale"
return skipTestIfFn(is_Windows_NonEnglish)(func)

def skipUnlessWindows(func):
"""Decorate the item to skip tests that should be skipped on any non-Windows platform."""
return skipUnlessPlatform(["windows"])(func)
Expand Down
3 changes: 3 additions & 0 deletions lldb/packages/Python/lldbsuite/test/dotest.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ def is_exe(fpath):
"""Returns true if fpath is an executable."""
if fpath == None:
return False
if sys.platform == 'win32':
if not fpath.endswith(".exe"):
fpath += ".exe"
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ def __str__(self):
@staticmethod
def format_build_error(command, command_output):
return "Error when building test subject.\n\nBuild Command:\n{}\n\nBuild Command Output:\n{}".format(
command, command_output.decode("utf-8"))
command, command_output.decode("utf-8", errors='ignore'))
57 changes: 7 additions & 50 deletions lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,58 +246,15 @@ PlatformFreeBSD::GetSoftwareBreakpointTrapOpcode(Target &target,
}
}

Status PlatformFreeBSD::LaunchProcess(ProcessLaunchInfo &launch_info) {
Status error;
if (IsHost()) {
error = Platform::LaunchProcess(launch_info);
} else {
if (m_remote_platform_sp)
error = m_remote_platform_sp->LaunchProcess(launch_info);
else
error.SetErrorString("the platform is not currently connected");
}
return error;
}

lldb::ProcessSP PlatformFreeBSD::Attach(ProcessAttachInfo &attach_info,
Debugger &debugger, Target *target,
Status &error) {
lldb::ProcessSP process_sp;
if (IsHost()) {
if (target == nullptr) {
TargetSP new_target_sp;
ArchSpec emptyArchSpec;

error = debugger.GetTargetList().CreateTarget(
debugger, "", emptyArchSpec, eLoadDependentsNo, m_remote_platform_sp,
new_target_sp);
target = new_target_sp.get();
} else
error.Clear();

if (target && error.Success()) {
debugger.GetTargetList().SetSelectedTarget(target);
// The freebsd always currently uses the GDB remote debugger plug-in so
// even when debugging locally we are debugging remotely! Just like the
// darwin plugin.
process_sp = target->CreateProcess(
attach_info.GetListenerForProcess(debugger), "gdb-remote", nullptr);

if (process_sp)
error = process_sp->Attach(attach_info);
bool PlatformFreeBSD::CanDebugProcess() {
if (getenv("FREEBSD_REMOTE_PLUGIN")) {
if (IsHost()) {
return true;
} else {
// If we're connected, we can debug.
return IsConnected();
}
} else {
if (m_remote_platform_sp)
process_sp =
m_remote_platform_sp->Attach(attach_info, debugger, target, error);
else
error.SetErrorString("the platform is not currently connected");
}
return process_sp;
}

// FreeBSD processes cannot yet be launched by spawning and attaching.
bool PlatformFreeBSD::CanDebugProcess() {
return false;
}

Expand Down
5 changes: 0 additions & 5 deletions lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ class PlatformFreeBSD : public PlatformPOSIX {
size_t GetSoftwareBreakpointTrapOpcode(Target &target,
BreakpointSite *bp_site) override;

Status LaunchProcess(ProcessLaunchInfo &launch_info) override;

lldb::ProcessSP Attach(ProcessAttachInfo &attach_info, Debugger &debugger,
Target *target, Status &error) override;

void CalculateTrapHandlerSymbolNames() override;

MmapArgList GetMmapArgumentList(const ArchSpec &arch, lldb::addr_t addr,
Expand Down
1 change: 1 addition & 0 deletions lldb/source/Plugins/Process/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux|Android")
add_subdirectory(Linux)
add_subdirectory(POSIX)
elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
add_subdirectory(FreeBSDRemote)
add_subdirectory(FreeBSD)
add_subdirectory(POSIX)
elseif (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
Expand Down
12 changes: 7 additions & 5 deletions lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,14 @@ ProcessFreeBSD::CreateInstance(lldb::TargetSP target_sp,
}

void ProcessFreeBSD::Initialize() {
static llvm::once_flag g_once_flag;
if (!getenv("FREEBSD_REMOTE_PLUGIN")) {
static llvm::once_flag g_once_flag;

llvm::call_once(g_once_flag, []() {
PluginManager::RegisterPlugin(GetPluginNameStatic(),
GetPluginDescriptionStatic(), CreateInstance);
});
llvm::call_once(g_once_flag, []() {
PluginManager::RegisterPlugin(GetPluginNameStatic(),
GetPluginDescriptionStatic(), CreateInstance);
});
}
}

lldb_private::ConstString ProcessFreeBSD::GetPluginNameStatic() {
Expand Down
16 changes: 16 additions & 0 deletions lldb/source/Plugins/Process/FreeBSDRemote/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
add_lldb_library(lldbPluginProcessFreeBSDRemote
NativeProcessFreeBSD.cpp
NativeRegisterContextFreeBSD.cpp
NativeRegisterContextFreeBSD_x86_64.cpp
NativeThreadFreeBSD.cpp

LINK_LIBS
lldbHost
lldbSymbol
lldbTarget
lldbUtility
lldbPluginProcessPOSIX
lldbPluginProcessUtility
LINK_COMPONENTS
Support
)
Loading

0 comments on commit 9423a91

Please sign in to comment.