pkgsrc-WIP-changes archive

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

lldb-netbsd: clang-format over elf-core plugin



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Wed Mar 29 04:48:35 2017 +0200
Changeset:	4e977b30af757cf9b688ac8be9babb00176d3fba

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

Log Message:
lldb-netbsd: clang-format over elf-core plugin

This is preparation for upstream.

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=4e977b30af757cf9b688ac8be9babb00176d3fba

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

diffstat:
 lldb-netbsd/distinfo                               |   4 +-
 ...rce_Plugins_Process_elf-core_ProcessElfCore.cpp | 104 ++++++++++++++++-----
 ...urce_Plugins_Process_elf-core_ThreadElfCore.cpp |  44 +++++++--
 3 files changed, 121 insertions(+), 31 deletions(-)

diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index 7fc8ebf121..30f5c3640d 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -21,5 +21,5 @@ SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.c
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h) = 4717298b6ce2923218f99042d8369639f5665c6a
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = bd6777974a75faf1c98683e838d1048eceac3e57
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = 66782e7dce1533d4ccce1ab7518f9760c50ec675
-SHA1 (patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp) = 0a64e526ed3eca089ee54d3bb54385f4d26fc7d1
-SHA1 (patch-source_Plugins_Process_elf-core_ThreadElfCore.cpp) = 3427bd2e2de3cd2947123c2f20ed8d5082a16ace
+SHA1 (patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp) = d85c0f49758438a2541567ad6a9972e40d076d6e
+SHA1 (patch-source_Plugins_Process_elf-core_ThreadElfCore.cpp) = 6dcdcb75bc4a97244e13d3419450c8aae9f7989a
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
index f6369d7e3e..67b1a7a916 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp
@@ -1,44 +1,77 @@
 $NetBSD$
 
---- source/Plugins/Process/elf-core/ProcessElfCore.cpp.orig	2017-03-27 00:48:38.266378385 +0000
+--- source/Plugins/Process/elf-core/ProcessElfCore.cpp.orig	2017-03-26 19:17:32.000000000 +0000
 +++ source/Plugins/Process/elf-core/ProcessElfCore.cpp
-@@ -449,6 +449,16 @@ enum {
+@@ -62,8 +62,8 @@ lldb::ProcessSP ProcessElfCore::CreateIn
+     // to ignore possible presence of the header extension.
+     const size_t header_size = sizeof(llvm::ELF::Elf64_Ehdr);
+ 
+-    auto data_sp =
+-        DataBufferLLVM::CreateSliceFromPath(crash_file->GetPath(), header_size, 0);
++    auto data_sp = DataBufferLLVM::CreateSliceFromPath(crash_file->GetPath(),
++                                                       header_size, 0);
+     if (data_sp && data_sp->GetByteSize() == header_size &&
+         elf::ELFHeader::MagicBytesMatch(data_sp->GetBytes())) {
+       elf::ELFHeader elf_header;
+@@ -223,7 +223,7 @@ Error ProcessElfCore::DoLoadCore() {
+   bool siginfo_signal_found = false;
+   bool prstatus_signal_found = false;
+   // Check we found a signal in a SIGINFO note.
+-  for (const auto &thread_data: m_thread_data) {
++  for (const auto &thread_data : m_thread_data) {
+     if (thread_data.signo != 0)
+       siginfo_signal_found = true;
+     if (thread_data.prstatus_sig != 0)
+@@ -233,7 +233,7 @@ Error ProcessElfCore::DoLoadCore() {
+     // If we don't have signal from SIGINFO use the signal from each threads
+     // PRSTATUS note.
+     if (prstatus_signal_found) {
+-      for (auto &thread_data: m_thread_data)
++      for (auto &thread_data : m_thread_data)
+         thread_data.signo = thread_data.prstatus_sig;
+     } else if (m_thread_data.size() > 0) {
+       // If all else fails force the first thread to be SIGSTOP
+@@ -449,6 +449,11 @@ enum {
  };
  }
  
 +namespace NETBSD {
 +
-+enum {
-+  NT_PROCINFO = 1,
-+  NT_AUXV,
-+  NT_AMD64_REGS = 33,
-+  NT_AMD64_FPREGS = 35
-+};
++enum { NT_PROCINFO = 1, NT_AUXV, NT_AMD64_REGS = 33, NT_AMD64_FPREGS = 35 };
 +}
 +
  // Parse a FreeBSD NT_PRSTATUS note - see FreeBSD sys/procfs.h for details.
  static void ParseFreeBSDPrStatus(ThreadData &thread_data, DataExtractor &data,
                                   ArchSpec &arch) {
-@@ -485,6 +495,18 @@ static void ParseFreeBSDThrMisc(ThreadDa
+@@ -485,13 +490,23 @@ static void ParseFreeBSDThrMisc(ThreadDa
    thread_data.name = data.GetCStr(&offset, 20);
  }
  
-+static void ParseNetBSDProcInfo(ThreadData &thread_data, DataExtractor &data)
-+{
+-static void ParseOpenBSDProcInfo(ThreadData &thread_data, DataExtractor &data)
+-{
++static void ParseNetBSDProcInfo(ThreadData &thread_data, DataExtractor &data) {
 +  lldb::offset_t offset = 0;
-+  
++
 +  int version = data.GetU32(&offset);
 +  if (version != 1)
-+	  return;
++    return;
 +
 +  offset += 4;
 +  thread_data.signo = data.GetU32(&offset);
 +}
 +
- static void ParseOpenBSDProcInfo(ThreadData &thread_data, DataExtractor &data)
- {
++static void ParseOpenBSDProcInfo(ThreadData &thread_data, DataExtractor &data) {
    lldb::offset_t offset = 0;
-@@ -585,6 +607,19 @@ Error ProcessElfCore::ParseThreadContext
+-  
++
+   int version = data.GetU32(&offset);
+   if (version != 1)
+-	  return;
++    return;
+ 
+   offset += 4;
+   thread_data.signo = data.GetU32(&offset);
+@@ -585,23 +600,38 @@ Error ProcessElfCore::ParseThreadContext
        default:
          break;
        }
@@ -47,14 +80,41 @@ $NetBSD$
 +      // "NetBSD-CORE@nnn" so match on the initial part of the string.
 +      m_os = llvm::Triple::NetBSD;
 +      if (note.n_type == NETBSD::NT_PROCINFO) {
-+	 ParseNetBSDProcInfo(*thread_data, note_data);
++        ParseNetBSDProcInfo(*thread_data, note_data);
 +      } else if (note.n_type == NETBSD::NT_AUXV) {
-+         m_auxv = DataExtractor(note_data);
-+      } else if (arch.GetMachine() == llvm::Triple::x86_64 && note.n_type == NETBSD::NT_AMD64_REGS) {
-+	thread_data->gpregset = note_data;
-+      } else if (arch.GetMachine() == llvm::Triple::x86_64 && note.n_type == NETBSD::NT_AMD64_FPREGS) {
-+	thread_data->fpregset = note_data;
++        m_auxv = DataExtractor(note_data);
++      } else if (arch.GetMachine() == llvm::Triple::x86_64 &&
++                 note.n_type == NETBSD::NT_AMD64_REGS) {
++        thread_data->gpregset = note_data;
++      } else if (arch.GetMachine() == llvm::Triple::x86_64 &&
++                 note.n_type == NETBSD::NT_AMD64_FPREGS) {
++        thread_data->fpregset = note_data;
 +      }
      } else if (note.n_name.substr(0, 7) == "OpenBSD") {
        // OpenBSD per-thread information is stored in notes named
        // "OpenBSD@nnn" so match on the initial part of the string.
+       m_os = llvm::Triple::OpenBSD;
+       switch (note.n_type) {
+       case NT_OPENBSD_PROCINFO:
+-	ParseOpenBSDProcInfo(*thread_data, note_data);
+-	break;
++        ParseOpenBSDProcInfo(*thread_data, note_data);
++        break;
+       case NT_OPENBSD_AUXV:
+-	m_auxv = DataExtractor(note_data);
+-	break;
++        m_auxv = DataExtractor(note_data);
++        break;
+       case NT_OPENBSD_REGS:
+-	thread_data->gpregset = note_data;
+-	break;
++        thread_data->gpregset = note_data;
++        break;
+       case NT_OPENBSD_FPREGS:
+-	thread_data->fpregset = note_data;
+-	break;
++        thread_data->fpregset = note_data;
++        break;
+       }
+     } else if (note.n_name == "CORE") {
+       switch (note.n_type) {
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_elf-core_ThreadElfCore.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_elf-core_ThreadElfCore.cpp
index 466d39fd74..2fa2f6130c 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_elf-core_ThreadElfCore.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_elf-core_ThreadElfCore.cpp
@@ -1,16 +1,16 @@
 $NetBSD$
 
---- source/Plugins/Process/elf-core/ThreadElfCore.cpp.orig	2017-02-27 20:47:52.000000000 +0000
+--- source/Plugins/Process/elf-core/ThreadElfCore.cpp.orig	2017-03-26 19:17:32.000000000 +0000
 +++ source/Plugins/Process/elf-core/ThreadElfCore.cpp
-@@ -18,6 +18,7 @@
- #include "Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h"
- #include "Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.h"
- #include "Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.h"
-+#include "Plugins/Process/Utility/RegisterContextNetBSD_x86_64.h"
+@@ -21,6 +21,7 @@
  #include "Plugins/Process/Utility/RegisterContextLinux_i386.h"
  #include "Plugins/Process/Utility/RegisterContextLinux_s390x.h"
  #include "Plugins/Process/Utility/RegisterContextLinux_x86_64.h"
-@@ -110,6 +111,17 @@ ThreadElfCore::CreateRegisterContextForF
++#include "Plugins/Process/Utility/RegisterContextNetBSD_x86_64.h"
+ #include "Plugins/Process/Utility/RegisterContextOpenBSD_i386.h"
+ #include "Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.h"
+ #include "Plugins/Process/Utility/RegisterInfoPOSIX_arm.h"
+@@ -112,6 +113,17 @@ ThreadElfCore::CreateRegisterContextForF
        break;
      }
  
@@ -28,3 +28,33 @@ $NetBSD$
      case llvm::Triple::Linux: {
        switch (arch.GetMachine()) {
        case llvm::Triple::arm:
+@@ -144,8 +156,8 @@ ThreadElfCore::CreateRegisterContextForF
+         reg_interface = new RegisterInfoPOSIX_arm(arch);
+         break;
+       case llvm::Triple::x86:
+-	reg_interface = new RegisterContextOpenBSD_i386(arch);
+-	break;
++        reg_interface = new RegisterContextOpenBSD_i386(arch);
++        break;
+       case llvm::Triple::x86_64:
+         reg_interface = new RegisterContextOpenBSD_x86_64(arch);
+         break;
+@@ -260,7 +272,6 @@ Error ELFLinuxPrStatus::Parse(DataExtrac
+   pr_cstime.tv_sec = data.GetPointer(&offset);
+   pr_cstime.tv_usec = data.GetPointer(&offset);
+ 
+-
+   return error;
+ }
+ 
+@@ -317,9 +328,7 @@ Error ELFLinuxPrPsInfo::Parse(DataExtrac
+ //----------------------------------------------------------------
+ // Parse SIGINFO from NOTE entry
+ //----------------------------------------------------------------
+-ELFLinuxSigInfo::ELFLinuxSigInfo() {
+-  memset(this, 0, sizeof(ELFLinuxSigInfo));
+-}
++ELFLinuxSigInfo::ELFLinuxSigInfo() { memset(this, 0, sizeof(ELFLinuxSigInfo)); }
+ 
+ Error ELFLinuxSigInfo::Parse(DataExtractor &data, const ArchSpec &arch) {
+   Error error;


Home | Main Index | Thread Index | Old Index