Skip to content

Commit 38a3fc3

Browse files
Merge pull request #9844 from swiftlang/revert-9787-dl/lldb-Introduce-backtracing-of-Swift-Tasks
Revert "[lldb] Introduce backtracing of Swift Tasks"
2 parents 29770a5 + 394ddf6 commit 38a3fc3

File tree

10 files changed

+0
-306
lines changed

10 files changed

+0
-306
lines changed

lldb/source/Plugins/Language/Swift/SwiftFormatters.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "Plugins/Language/Swift/SwiftStringIndex.h"
1515
#include "Plugins/LanguageRuntime/Swift/ReflectionContextInterface.h"
1616
#include "Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.h"
17-
#include "Plugins/LanguageRuntime/Swift/SwiftTask.h"
1817
#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
1918
#include "lldb/DataFormatters/FormattersHelpers.h"
2019
#include "lldb/DataFormatters/StringPrinter.h"
@@ -24,7 +23,6 @@
2423
#include "lldb/Utility/LLDBLog.h"
2524
#include "lldb/Utility/Log.h"
2625
#include "lldb/Utility/Status.h"
27-
#include "lldb/Utility/StreamString.h"
2826
#include "lldb/Utility/Timer.h"
2927
#include "lldb/ValueObject/ValueObject.h"
3028
#include "lldb/lldb-enumerations.h"

lldb/source/Plugins/LanguageRuntime/Swift/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ add_lldb_library(lldbPluginSwiftLanguageRuntime PLUGIN
66
SwiftLanguageRuntimeNames.cpp
77
SwiftLanguageRuntimeRemoteAST.cpp
88
SwiftMetadataCache.cpp
9-
SwiftTask.cpp
109

1110
LINK_LIBS
1211
swiftAST

lldb/source/Plugins/LanguageRuntime/Swift/ReflectionContext.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,6 @@ class TargetReflectionContext : public ReflectionContextInterface {
401401
result.hasIsRunning = task_info.HasIsRunning;
402402
result.isRunning = task_info.IsRunning;
403403
result.isEnqueued = task_info.IsEnqueued;
404-
result.id = task_info.Id;
405-
result.resumeAsyncContext = task_info.ResumeAsyncContext;
406404
return result;
407405
}
408406

lldb/source/Plugins/LanguageRuntime/Swift/ReflectionContextInterface.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
#include <mutex>
1717

18-
#include "lldb/lldb-defines.h"
1918
#include "lldb/lldb-types.h"
2019
#include "swift/ABI/ObjectFile.h"
2120
#include "swift/Remote/RemoteAddress.h"
@@ -164,8 +163,6 @@ class ReflectionContextInterface {
164163
bool hasIsRunning = false;
165164
bool isRunning = false;
166165
bool isEnqueued = false;
167-
uint64_t id = 0;
168-
lldb::addr_t resumeAsyncContext = LLDB_INVALID_ADDRESS;
169166
};
170167
// The default limits are copied from swift-inspect.
171168
virtual llvm::Expected<AsyncTaskInfo>

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "SwiftMetadataCache.h"
1717

1818
#include "Plugins/ExpressionParser/Swift/SwiftPersistentExpressionState.h"
19-
#include "Plugins/LanguageRuntime/Swift/SwiftTask.h"
2019
#include "Plugins/Process/Utility/RegisterContext_x86.h"
2120
#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
2221
#include "Plugins/TypeSystem/Swift/SwiftDemangle.h"
@@ -2084,89 +2083,6 @@ class CommandObjectSwift_RefCount : public CommandObjectRaw {
20842083
}
20852084
};
20862085

2087-
class CommandObjectLanguageSwiftTaskBacktrace final
2088-
: public CommandObjectParsed {
2089-
public:
2090-
CommandObjectLanguageSwiftTaskBacktrace(CommandInterpreter &interpreter)
2091-
: CommandObjectParsed(interpreter, "backtrace",
2092-
"Show the backtrace of Swift tasks. See `thread "
2093-
"backtrace` for customizing backtrace output.",
2094-
"language swift task backtrace <variable-name>") {
2095-
AddSimpleArgumentList(eArgTypeVarName);
2096-
}
2097-
2098-
private:
2099-
void DoExecute(Args &command, CommandReturnObject &result) override {
2100-
if (!m_exe_ctx.GetFramePtr()) {
2101-
result.AppendError("no active frame selected");
2102-
return;
2103-
}
2104-
2105-
if (command.empty() || command[0].ref().empty()) {
2106-
result.AppendError("no task variable");
2107-
return;
2108-
}
2109-
2110-
StackFrame &frame = m_exe_ctx.GetFrameRef();
2111-
uint32_t path_options =
2112-
StackFrame::eExpressionPathOptionsAllowDirectIVarAccess;
2113-
VariableSP var_sp;
2114-
Status status;
2115-
ValueObjectSP valobj_sp = frame.GetValueForVariableExpressionPath(
2116-
command[0].c_str(), eDynamicDontRunTarget, path_options, var_sp,
2117-
status);
2118-
if (!valobj_sp) {
2119-
result.AppendError(status.AsCString());
2120-
return;
2121-
}
2122-
2123-
addr_t task_ptr = LLDB_INVALID_ADDRESS;
2124-
ThreadSafeReflectionContext reflection_ctx;
2125-
if (ValueObjectSP task_obj_sp =
2126-
valobj_sp->GetChildMemberWithName("_task")) {
2127-
task_ptr = task_obj_sp->GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
2128-
if (task_ptr != LLDB_INVALID_ADDRESS)
2129-
if (auto *runtime = SwiftLanguageRuntime::Get(m_exe_ctx.GetProcessSP()))
2130-
reflection_ctx = runtime->GetReflectionContext();
2131-
}
2132-
if (task_ptr == LLDB_INVALID_ADDRESS || !reflection_ctx) {
2133-
result.AppendError("failed to access Task data from runtime");
2134-
return;
2135-
}
2136-
2137-
llvm::Expected<ReflectionContextInterface::AsyncTaskInfo> task_info =
2138-
reflection_ctx->asyncTaskInfo(task_ptr);
2139-
if (auto error = task_info.takeError()) {
2140-
result.AppendError(toString(std::move(error)));
2141-
return;
2142-
}
2143-
2144-
auto thread_task = ThreadTask::Create(
2145-
task_info->id, task_info->resumeAsyncContext, m_exe_ctx);
2146-
if (auto error = thread_task.takeError()) {
2147-
result.AppendError(toString(std::move(error)));
2148-
return;
2149-
}
2150-
2151-
// GetStatus prints the backtrace.
2152-
thread_task.get()->GetStatus(result.GetOutputStream(), 0, UINT32_MAX, 0,
2153-
false, true);
2154-
result.SetStatus(lldb::eReturnStatusSuccessFinishResult);
2155-
}
2156-
};
2157-
2158-
class CommandObjectLanguageSwiftTask final : public CommandObjectMultiword {
2159-
public:
2160-
CommandObjectLanguageSwiftTask(CommandInterpreter &interpreter)
2161-
: CommandObjectMultiword(
2162-
interpreter, "task", "Commands for inspecting Swift Tasks.",
2163-
"language swift task <subcommand> [<subcommand-options>]") {
2164-
LoadSubCommand("backtrace",
2165-
CommandObjectSP(new CommandObjectLanguageSwiftTaskBacktrace(
2166-
interpreter)));
2167-
}
2168-
};
2169-
21702086
class CommandObjectMultiwordSwift : public CommandObjectMultiword {
21712087
public:
21722088
CommandObjectMultiwordSwift(CommandInterpreter &interpreter)
@@ -2178,8 +2094,6 @@ class CommandObjectMultiwordSwift : public CommandObjectMultiword {
21782094
interpreter)));
21792095
LoadSubCommand("refcount", CommandObjectSP(new CommandObjectSwift_RefCount(
21802096
interpreter)));
2181-
LoadSubCommand("task", CommandObjectSP(new CommandObjectLanguageSwiftTask(
2182-
interpreter)));
21832097
}
21842098

21852099
virtual ~CommandObjectMultiwordSwift() {}

lldb/source/Plugins/LanguageRuntime/Swift/SwiftTask.cpp

Lines changed: 0 additions & 74 deletions
This file was deleted.

lldb/source/Plugins/LanguageRuntime/Swift/SwiftTask.h

Lines changed: 0 additions & 97 deletions
This file was deleted.

lldb/test/API/lang/swift/async/tasks/Makefile

Lines changed: 0 additions & 3 deletions
This file was deleted.

lldb/test/API/lang/swift/async/tasks/TestSwiftTaskBacktrace.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

lldb/test/API/lang/swift/async/tasks/main.swift

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)