Skip to content

Commit

Permalink
Integrate LLVM at llvm/llvm-project@1a9acd786d49
Browse files Browse the repository at this point in the history
Updates LLVM usage to match
[1a9acd786d49](llvm/llvm-project@1a9acd786d49)

PiperOrigin-RevId: 659491151
  • Loading branch information
tensorflower-gardener authored and copybara-github committed Aug 5, 2024
1 parent 881f508 commit f4cb89e
Show file tree
Hide file tree
Showing 6 changed files with 677 additions and 14 deletions.
219 changes: 219 additions & 0 deletions third_party/llvm/generated.patch
Original file line number Diff line number Diff line change
@@ -1 +1,220 @@
Auto generated patch. Do not edit or delete it, even if empty.
diff -ruN --strip-trailing-cr a/lldb/include/lldb/Core/PluginManager.h b/lldb/include/lldb/Core/PluginManager.h
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -194,7 +194,7 @@
GetObjectFileCreateMemoryCallbackForPluginName(llvm::StringRef name);

static Status SaveCore(const lldb::ProcessSP &process_sp,
- lldb_private::SaveCoreOptions &core_options);
+ const lldb_private::SaveCoreOptions &core_options);

// ObjectContainer
static bool RegisterPlugin(
diff -ruN --strip-trailing-cr a/lldb/include/lldb/lldb-private-interfaces.h b/lldb/include/lldb/lldb-private-interfaces.h
--- a/lldb/include/lldb/lldb-private-interfaces.h
+++ b/lldb/include/lldb/lldb-private-interfaces.h
@@ -57,7 +57,7 @@
const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp,
const lldb::ProcessSP &process_sp, lldb::addr_t offset);
typedef bool (*ObjectFileSaveCore)(const lldb::ProcessSP &process_sp,
- lldb_private::SaveCoreOptions &options,
+ const lldb_private::SaveCoreOptions &options,
Status &error);
typedef EmulateInstruction *(*EmulateInstructionCreateInstance)(
const ArchSpec &arch, InstructionType inst_type);
diff -ruN --strip-trailing-cr a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp
--- a/lldb/source/Core/PluginManager.cpp
+++ b/lldb/source/Core/PluginManager.cpp
@@ -702,7 +702,7 @@
}

Status PluginManager::SaveCore(const lldb::ProcessSP &process_sp,
- lldb_private::SaveCoreOptions &options) {
+ const lldb_private::SaveCoreOptions &options) {
Status error;
if (!options.GetOutputFile()) {
error.SetErrorString("No output file specified");
diff -ruN --strip-trailing-cr a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -6351,7 +6351,7 @@
CreateAllImageInfosPayload(const lldb::ProcessSP &process_sp,
offset_t initial_file_offset,
StreamString &all_image_infos_payload,
- lldb_private::SaveCoreOptions &options) {
+ const lldb_private::SaveCoreOptions &options) {
Target &target = process_sp->GetTarget();
ModuleList modules = target.GetImages();

@@ -6522,17 +6522,16 @@
};

bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
- lldb_private::SaveCoreOptions &options,
+ const lldb_private::SaveCoreOptions &options,
Status &error) {
+ auto core_style = options.GetStyle();
+ if (core_style == SaveCoreStyle::eSaveCoreUnspecified)
+ core_style = SaveCoreStyle::eSaveCoreDirtyOnly;
// The FileSpec and Process are already checked in PluginManager::SaveCore.
assert(options.GetOutputFile().has_value());
assert(process_sp);
const FileSpec outfile = options.GetOutputFile().value();

- // MachO defaults to dirty pages
- if (options.GetStyle() == SaveCoreStyle::eSaveCoreUnspecified)
- options.SetStyle(eSaveCoreDirtyOnly);
-
Target &target = process_sp->GetTarget();
const ArchSpec target_arch = target.GetArchitecture();
const llvm::Triple &target_triple = target_arch.GetTriple();
diff -ruN --strip-trailing-cr a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
@@ -62,7 +62,7 @@
lldb_private::ModuleSpecList &specs);

static bool SaveCore(const lldb::ProcessSP &process_sp,
- lldb_private::SaveCoreOptions &options,
+ const lldb_private::SaveCoreOptions &options,
lldb_private::Status &error);

static bool MagicBytesMatch(lldb::DataBufferSP data_sp, lldb::addr_t offset,
diff -ruN --strip-trailing-cr a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
@@ -76,7 +76,7 @@
public:
MinidumpFileBuilder(lldb::FileUP &&core_file,
const lldb::ProcessSP &process_sp,
- lldb_private::SaveCoreOptions &save_core_options)
+ const lldb_private::SaveCoreOptions &save_core_options)
: m_process_sp(process_sp), m_core_file(std::move(core_file)),
m_save_core_options(save_core_options){};

diff -ruN --strip-trailing-cr a/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp b/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp
--- a/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp
@@ -56,15 +56,16 @@
}

bool ObjectFileMinidump::SaveCore(const lldb::ProcessSP &process_sp,
- lldb_private::SaveCoreOptions &options,
+ const lldb_private::SaveCoreOptions &options,
lldb_private::Status &error) {
// Output file and process_sp are both checked in PluginManager::SaveCore.
assert(options.GetOutputFile().has_value());
assert(process_sp);

// Minidump defaults to stacks only.
- if (options.GetStyle() == SaveCoreStyle::eSaveCoreUnspecified)
- options.SetStyle(SaveCoreStyle::eSaveCoreStackOnly);
+ SaveCoreStyle core_style = options.GetStyle();
+ if (core_style == SaveCoreStyle::eSaveCoreUnspecified)
+ core_style = SaveCoreStyle::eSaveCoreStackOnly;

llvm::Expected<lldb::FileUP> maybe_core_file = FileSystem::Instance().Open(
options.GetOutputFile().value(),
diff -ruN --strip-trailing-cr a/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h b/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h
--- a/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h
+++ b/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h
@@ -55,7 +55,7 @@

// Saves dump in Minidump file format
static bool SaveCore(const lldb::ProcessSP &process_sp,
- lldb_private::SaveCoreOptions &options,
+ const lldb_private::SaveCoreOptions &options,
lldb_private::Status &error);

private:
diff -ruN --strip-trailing-cr a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -355,7 +355,7 @@
}

bool ObjectFilePECOFF::SaveCore(const lldb::ProcessSP &process_sp,
- lldb_private::SaveCoreOptions &options,
+ const lldb_private::SaveCoreOptions &options,
lldb_private::Status &error) {
// Outfile and process_sp are validated by PluginManager::SaveCore
assert(options.GetOutputFile().has_value());
diff -ruN --strip-trailing-cr a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
@@ -82,7 +82,7 @@
lldb_private::ModuleSpecList &specs);

static bool SaveCore(const lldb::ProcessSP &process_sp,
- lldb_private::SaveCoreOptions &options,
+ const lldb_private::SaveCoreOptions &options,
lldb_private::Status &error);

static bool MagicBytesMatch(lldb::DataBufferSP data_sp);
diff -ruN --strip-trailing-cr a/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
--- a/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
@@ -21,7 +21,8 @@
namespace lldb_private {

bool SaveMiniDump(const lldb::ProcessSP &process_sp,
- SaveCoreOptions &core_options, lldb_private::Status &error) {
+ const SaveCoreOptions &core_options,
+ lldb_private::Status &error) {
if (!process_sp)
return false;
#ifdef _WIN32
diff -ruN --strip-trailing-cr a/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.h b/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.h
--- a/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.h
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.h
@@ -14,7 +14,8 @@
namespace lldb_private {

bool SaveMiniDump(const lldb::ProcessSP &process_sp,
- SaveCoreOptions &core_options, lldb_private::Status &error);
+ const SaveCoreOptions &core_options,
+ lldb_private::Status &error);

} // namespace lldb_private

diff -ruN --strip-trailing-cr a/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py b/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py
--- a/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py
+++ b/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py
@@ -10,11 +10,6 @@


class ProcessSaveCoreTestCase(TestBase):
- def validate_core_pid(self, pid, core_path):
- target = self.dbg.CreateTarget(None)
- process = target.LoadCore(core_path)
- return process.GetProcessID() == pid
-
@skipIfRemote
@skipUnlessWindows
def test_cannot_save_core_unless_process_stopped(self):
@@ -93,24 +88,3 @@
os.unlink(core)
except OSError:
pass
-
- @skipUnlessPlatform(["linux"])
- def test_save_core_default_values_for_style_minidump(self):
- """Test we can still save a core for minidump when no
- core style is specified."""
- self.build()
- exe = self.getBuildArtifact("a.out")
- core = self.getBuildArtifact("core.dmp")
- target = self.dbg.CreateTarget(exe)
- target.BreakpointCreateByName("bar")
- process = target.LaunchSimple(None, None, self.get_process_working_directory())
- self.assertState(process.GetState(), lldb.eStateStopped)
- pid = process.GetProcessID()
- options = lldb.SBSaveCoreOptions()
- minidump_path = core + ".minidump"
- options.SetOutputFile(lldb.SBFileSpec(minidump_path))
- options.SetPluginName("minidump")
- error = process.SaveCore(options)
- self.assertSuccess(error, error.GetCString())
- self.assertTrue(os.path.isfile(minidump_path))
- self.assertTrue(self.validate_core_pid(pid, minidump_path))
4 changes: 2 additions & 2 deletions third_party/llvm/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ load("//third_party:repo.bzl", "tf_http_archive")

def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "a0a9bf5152507beacd2a72dda42d054391494c4a"
LLVM_SHA256 = "0ffb2aae087c2648f6bf5afc015fad84d2e2be834d5d359a0e52a6c5b60e6258"
LLVM_COMMIT = "1a9acd786d493b00c08d1611f51420d421b74cf1"
LLVM_SHA256 = "98c2979eac2524f2cf156150867a190357668266b82708655dcbf6ec7c483465"

tf_http_archive(
name = name,
Expand Down
Loading

0 comments on commit f4cb89e

Please sign in to comment.