Skip to content

Revert "[dsymutil] Avoid copying binary swiftmodules built from textual" #134872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions lldb/source/Core/Statusline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "lldb/Host/StreamFile.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Utility/AnsiTerminal.h"
#include "lldb/Utility/StreamString.h"
Expand Down Expand Up @@ -127,23 +126,19 @@ void Statusline::Redraw(bool update) {
return;
}

ExecutionContext exe_ctx = m_debugger.GetSelectedExecutionContext();
StreamString stream;
ExecutionContext exe_ctx =
m_debugger.GetCommandInterpreter().GetExecutionContext();

// For colors and progress events, the format entity needs access to the
// debugger, which requires a target in the execution context.
if (!exe_ctx.HasTargetScope())
exe_ctx.SetTargetPtr(&m_debugger.GetSelectedOrDummyTarget());

SymbolContext symbol_ctx;
if (ProcessSP process_sp = exe_ctx.GetProcessSP()) {
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process_sp->GetRunLock())) {
if (auto frame_sp = exe_ctx.GetFrameSP())
symbol_ctx = frame_sp->GetSymbolContext(eSymbolContextEverything);
}
}
if (auto frame_sp = exe_ctx.GetFrameSP())
symbol_ctx = frame_sp->GetSymbolContext(eSymbolContextEverything);

StreamString stream;
if (auto *format = m_debugger.GetStatuslineFormat())
FormatEntity::Format(*format, stream, &symbol_ctx, &exe_ctx, nullptr,
nullptr, false, false);
Expand Down
Binary file removed llvm/test/tools/dsymutil/Inputs/Binary.swiftmodule
Binary file not shown.
Binary file not shown.
29 changes: 0 additions & 29 deletions llvm/test/tools/dsymutil/swiftmodule.test

This file was deleted.

3 changes: 0 additions & 3 deletions llvm/test/tools/dsymutil/yaml-object-address-rewrite.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
# CHECK-NEXT: objects:
# CHECK-NEXT: filename:{{.*}}/Inputs/basic1.macho.x86_64.o
# CHECK-NEXT: timestamp: 0
# CHECK-NEXT: type: 102
# CHECK-NEXT: symbols:
# CHECK-NEXT: sym: _main, objAddr: 0x0, binAddr: 0x100000EA0, size: 0x24
# CHECK-NEXT: filename:{{.*}}/Inputs/./libbasic.a(basic2.macho.x86_64.o)'
# CHECK-NEXT: timestamp: 0
# CHECK-NEXT: type: 102
# CHECK-NEXT: symbols:
# CHECK-DAG: sym: _foo, objAddr: 0x20, binAddr: 0x100000ED0, size: 0x50
# CHECK-DAG: sym: _private_int, objAddr: 0x560, binAddr: 0x100001004, size: 0x0
Expand All @@ -26,7 +24,6 @@
# CHECK-NOT: { sym:
# CHECK-NEXT: filename:{{.*}}/Inputs/./libbasic.a(basic3.macho.x86_64.o)'
# CHECK-NEXT: timestamp: 0
# CHECK-NEXT: type: 102
# CHECK-NEXT: symbols:
# CHECK-DAG: sym: _val, binAddr: 0x100001008, size: 0x0
# CHECK-DAG: sym: _bar, objAddr: 0x20, binAddr: 0x100000F40, size: 0x50
Expand Down
1 change: 0 additions & 1 deletion llvm/tools/dsymutil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ add_llvm_tool(dsymutil
MachOUtils.cpp
Reproducer.cpp
RelocationMap.cpp
SwiftModule.cpp

DEPENDS
intrinsics_gen
Expand Down
8 changes: 3 additions & 5 deletions llvm/tools/dsymutil/DebugMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,12 @@ namespace yaml {

// Normalize/Denormalize between YAML and a DebugMapObject.
struct MappingTraits<dsymutil::DebugMapObject>::YamlDMO {
YamlDMO(IO &io) {}
YamlDMO(IO &io) { Timestamp = 0; }
YamlDMO(IO &io, dsymutil::DebugMapObject &Obj);
dsymutil::DebugMapObject denormalize(IO &IO);

std::string Filename;
int64_t Timestamp = 0;
uint8_t Type = MachO::N_OSO;
int64_t Timestamp;
std::vector<dsymutil::DebugMapObject::YAMLSymbolMapping> Entries;
};

Expand All @@ -184,7 +183,6 @@ void MappingTraits<dsymutil::DebugMapObject>::mapping(
MappingNormalization<YamlDMO, dsymutil::DebugMapObject> Norm(io, DMO);
io.mapRequired("filename", Norm->Filename);
io.mapOptional("timestamp", Norm->Timestamp);
io.mapOptional("type", Norm->Type);
io.mapRequired("symbols", Norm->Entries);
}

Expand Down Expand Up @@ -238,7 +236,6 @@ MappingTraits<dsymutil::DebugMapObject>::YamlDMO::YamlDMO(
IO &io, dsymutil::DebugMapObject &Obj) {
Filename = Obj.Filename;
Timestamp = sys::toTimeT(Obj.getTimestamp());
Type = Obj.getType();
Entries.reserve(Obj.Symbols.size());
for (auto &Entry : Obj.Symbols)
Entries.push_back(
Expand Down Expand Up @@ -289,6 +286,7 @@ MappingTraits<dsymutil::DebugMapObject>::YamlDMO::denormalize(IO &IO) {
}
}

uint8_t Type = MachO::N_OSO;
if (Path.ends_with(".dylib")) {
// FIXME: find a more resilient way
Type = MachO::N_LIB;
Expand Down
16 changes: 0 additions & 16 deletions llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "BinaryHolder.h"
#include "DebugMap.h"
#include "MachOUtils.h"
#include "SwiftModule.h"
#include "dsymutil.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
Expand Down Expand Up @@ -784,21 +783,6 @@ bool DwarfLinkerForBinary::linkImpl(
reportWarning("Could not open '" + File + "'");
continue;
}
auto FromInterfaceOrErr =
IsBuiltFromSwiftInterface((*ErrorOrMem)->getBuffer());
if (!FromInterfaceOrErr) {
reportWarning("Could not parse binary Swift module: " +
toString(FromInterfaceOrErr.takeError()),
Obj->getObjectFilename());
// Only skip swiftmodules that could be parsed and are
// positively identified as textual.
} else if (*FromInterfaceOrErr) {
if (Options.Verbose)
outs() << "Skipping compiled textual Swift interface: "
<< Obj->getObjectFilename() << "\n";
continue;
}

sys::fs::file_status Stat;
if (auto Err = sys::fs::status(File, Stat)) {
reportWarning(Err.message());
Expand Down
1 change: 0 additions & 1 deletion llvm/tools/dsymutil/RelocationMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ struct SymbolMapping {
std::optional<yaml::Hex64> ObjectAddress;
yaml::Hex64 BinaryAddress;
yaml::Hex32 Size;
yaml::Hex8 Type;

SymbolMapping(std::optional<uint64_t> ObjectAddr, uint64_t BinaryAddress,
uint32_t Size)
Expand Down
192 changes: 0 additions & 192 deletions llvm/tools/dsymutil/SwiftModule.cpp

This file was deleted.

15 changes: 0 additions & 15 deletions llvm/tools/dsymutil/SwiftModule.h

This file was deleted.