pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lldb-netbsd: Backport patch from zturner@google



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Fri Apr 7 20:58:21 2017 +0200
Changeset:	469751abb9e585284b416d51340400130684da41

Modified Files:
	lldb-netbsd/distinfo
Added Files:
	lldb-netbsd/patches/patch-source_Core_ArchSpec.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp

Log Message:
lldb-netbsd: Backport patch from zturner@google

This patch fixes loading of core(5) files generated on NetBSD.

Sponsored by <The NetBSD Foundation>

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=469751abb9e585284b416d51340400130684da41

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 lldb-netbsd/distinfo                               |  2 +
 lldb-netbsd/patches/patch-source_Core_ArchSpec.cpp | 57 ++++++++++++++++++++++
 ...rce_Plugins_Process_elf-core_ProcessElfCore.cpp | 32 ++++++++++++
 3 files changed, 91 insertions(+)

diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index 7931384fd5..f3629a33bb 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -12,3 +12,5 @@ Size (libcxx-3.6.2.src.tar.xz) = 944020 bytes
 SHA1 (llvm-3.6.2.src.tar.xz) = 7a00257eb2bc9431e4c77c3a36b033072c54bc7e
 RMD160 (llvm-3.6.2.src.tar.xz) = 521cbc5fe2925ea3c6e90c7a31f752a04045c972
 Size (llvm-3.6.2.src.tar.xz) = 12802380 bytes
+SHA1 (patch-source_Core_ArchSpec.cpp) = 1585f4ffa707bc69e96f7dd3b5137e00858ed7be
+SHA1 (patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp) = 91575c49560da29d5d83c446012ed04ca957d99c
diff --git a/lldb-netbsd/patches/patch-source_Core_ArchSpec.cpp b/lldb-netbsd/patches/patch-source_Core_ArchSpec.cpp
new file mode 100644
index 0000000000..dbd261fa55
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Core_ArchSpec.cpp
@@ -0,0 +1,57 @@
+$NetBSD$
+
+--- source/Core/ArchSpec.cpp.orig	2017-04-07 18:27:43.313975678 +0000
++++ source/Core/ArchSpec.cpp
+@@ -989,29 +989,34 @@ bool ArchSpec::SetTriple(llvm::StringRef
+ }
+ 
+ void ArchSpec::MergeFrom(const ArchSpec &other) {
+-  if (TripleVendorIsUnspecifiedUnknown() &&
+-      !other.TripleVendorIsUnspecifiedUnknown())
+-    GetTriple().setVendor(other.GetTriple().getVendor());
+-  if (TripleOSIsUnspecifiedUnknown() && !other.TripleOSIsUnspecifiedUnknown())
+-    GetTriple().setOS(other.GetTriple().getOS());
+-  if (GetTriple().getArch() == llvm::Triple::UnknownArch)
+-    GetTriple().setArch(other.GetTriple().getArch());
+-  if (GetTriple().getEnvironment() == llvm::Triple::UnknownEnvironment &&
+-      !TripleVendorWasSpecified()) {
+-    if (other.TripleVendorWasSpecified())
+-      GetTriple().setEnvironment(other.GetTriple().getEnvironment());
+-  }
+   // If this and other are both arm ArchSpecs and this ArchSpec is a generic
+-  // "some kind of arm"
+-  // spec but the other ArchSpec is a specific arm core, adopt the specific arm
+-  // core.
++  // "some kind of arm" spec but the other ArchSpec is a specific arm core, adopt
++  // the specific arm core.
++  bool ShouldOverrideCore = false;
++
++  if (GetCore() == ArchSpec::kCore_invalid && other.GetCore() != ArchSpec::kCore_invalid)
++    ShouldOverrideCore = true;
+   if (GetTriple().getArch() == llvm::Triple::arm &&
+-      other.GetTriple().getArch() == llvm::Triple::arm &&
+-      IsCompatibleMatch(other) && GetCore() == ArchSpec::eCore_arm_generic &&
+-      other.GetCore() != ArchSpec::eCore_arm_generic) {
++    other.GetTriple().getArch() == llvm::Triple::arm &&
++    IsCompatibleMatch(other) && GetCore() == ArchSpec::eCore_arm_generic &&
++    other.GetCore() != ArchSpec::eCore_arm_generic)
++    ShouldOverrideCore = true;
++  if (ShouldOverrideCore) {
+     m_core = other.GetCore();
+     CoreUpdated(true);
+   }
++
++  if (GetTriple().getVendor() == llvm::Triple::UnknownVendor)
++    GetTriple().setVendor(other.GetTriple().getVendor());
++
++  if (GetTriple().getOS() == llvm::Triple::UnknownOS)
++    GetTriple().setOS(other.GetTriple().getOS());
++
++  if (GetTriple().getArch() == llvm::Triple::UnknownArch)
++    GetTriple().setArch(other.GetTriple().getArch());
++
++  if (GetTriple().getEnvironment() == llvm::Triple::UnknownEnvironment)
++    GetTriple().setEnvironment(other.GetTriple().getEnvironment());
+ }
+ 
+ bool ArchSpec::SetArchitecture(ArchitectureType arch_type, uint32_t cpu,
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp
new file mode 100644
index 0000000000..1fe03c6458
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- source/Plugins/Process/elf-core/ProcessElfCore.cpp.orig	2017-04-07 18:43:45.161040278 +0000
++++ source/Plugins/Process/elf-core/ProcessElfCore.cpp
+@@ -220,7 +220,7 @@ Error ProcessElfCore::DoLoadCore() {
+   target_arch.MergeFrom(core_arch);
+   GetTarget().SetArchitecture(target_arch);
+  
+-  SetUnixSignals(UnixSignals::Create(GetArchitecture()));
++  SetUnixSignals(UnixSignals::Create(target_arch));
+ 
+   // Ensure we found at least one thread that was stopped on a signal.
+   bool siginfo_signal_found = false;
+@@ -724,17 +724,7 @@ uint32_t ProcessElfCore::GetNumThreadCon
+ }
+ 
+ ArchSpec ProcessElfCore::GetArchitecture() {
+-  ObjectFileELF *core_file =
+-      (ObjectFileELF *)(m_core_module_sp->GetObjectFile());
+-  ArchSpec arch;
+-  core_file->GetArchitecture(arch);
+-
+-  ArchSpec target_arch = GetTarget().GetArchitecture();
+-  
+-  if (target_arch.IsMIPS())
+-    return target_arch;
+-
+-  return arch;
++  return GetTarget().GetArchitecture();
+ }
+ 
+ const lldb::DataBufferSP ProcessElfCore::GetAuxvData() {


Home | Main Index | Thread Index | Old Index