pkgsrc-WIP-changes archive

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

lldb-netbsd: Polish the core(5) patch before sending upstream



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Tue Apr 18 03:16:06 2017 +0200
Changeset:	856f9bbf0701a6e452117e2421bc39ada940e4de

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

Log Message:
lldb-netbsd: Polish the core(5) patch before sending upstream

$ lldb -c rtorrent.core /usr/pkg/bin/rtorrent
(lldb) target create "/usr/pkg/bin/rtorrent" --core "rtorrent.core"
Core file '/public/lldb_devel/rtorrent.core' (x86_64) was loaded.
(lldb) thread list
Process 0 stopped
* thread #1: tid = 3, 0x00007a59d623b51a libc.so.12`_sys___kevent50 + 10, stop reason = signal SIGSTOP
  thread #2: tid = 2, 0x00007a59d623b51a libc.so.12`_sys___kevent50 + 10, stop reason = signal SIGSTOP
  thread #3: tid = 1, 0x00007a59d623b21a libc.so.12`__select50 + 10, stop reason = signal SIGSTOP
(lldb) thread select 2
* thread #2, stop reason = signal SIGSTOP
    frame #0: 0x00007a59d623b51a libc.so.12`_sys___kevent50 + 10
libc.so.12`_sys___kevent50:
->  0x7a59d623b51a <+10>: addb   %al, (%rax)
    0x7a59d623b51c <+12>: addb   %al, (%rax)
    0x7a59d623b51e <+14>: addb   %al, (%rax)
    0x7a59d623b520 <+16>: addb   %al, (%rax)

[......]

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=856f9bbf0701a6e452117e2421bc39ada940e4de

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

diffstat:
 lldb-netbsd/distinfo                               |  2 +-
 ...rce_Plugins_Process_elf-core_ProcessElfCore.cpp | 26 +++++++++++++---------
 2 files changed, 16 insertions(+), 12 deletions(-)

diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index b728e2154b..b2b9204160 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -21,5 +21,5 @@ SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = d788ea7d92ffa31f2d6477e11129fc9b9fd0b8eb
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = d2586e2ecdc2c979c59fc1a6a569e7870d3334ba
 SHA1 (patch-source_Plugins_Process_Utility_RegisterInfos__x86__64.h) = 47d7dc03b7da83ff7f02b684b2188da53bf269d3
-SHA1 (patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp) = e3b3db37a016aa6c5d7b36158575a230f35bbc8d
+SHA1 (patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp) = e8609042fb407f3507ac7cbe00494bbad5a2ca14
 SHA1 (patch-source_Plugins_Process_elf-core_ProcessElfCore.h) = 902ce5e0187aa2649986db08c79af7291b852727
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 efed2a90f4..05204a338e 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
@@ -45,7 +45,7 @@ $NetBSD$
  // Parse a FreeBSD NT_PRSTATUS note - see FreeBSD sys/procfs.h for details.
  static void ParseFreeBSDPrStatus(ThreadData &thread_data, DataExtractor &data,
                                   ArchSpec &arch) {
-@@ -497,15 +504,27 @@ static void ParseFreeBSDThrMisc(ThreadDa
+@@ -497,15 +504,29 @@ static void ParseFreeBSDThrMisc(ThreadDa
    thread_data.name = data.GetCStr(&offset, 20);
  }
  
@@ -58,13 +58,15 @@ $NetBSD$
 +  uint32_t version = data.GetU32(&offset);
    if (version != 1)
 -    return;
-+    return Error("Unsupported procinfo version");
++    return Error(
++        "Error parsing NetBSD core(5) notes: Unsupported procinfo version");
  
 -  offset += 4;
 -  thread_data.signo = data.GetU32(&offset);
 +  uint32_t cpisize = data.GetU32(&offset);
 +  if (cpisize != NETBSD::NT_PROCINFO_SIZE)
-+    return Error("Unsupported procinfo version");
++    return Error(
++        "Error parsing NetBSD core(5) notes: Unsupported procinfo size");
 +
 +  cpi_signo = data.GetU32(&offset); /* killing signal */
 +
@@ -78,7 +80,7 @@ $NetBSD$
  }
  
  static void ParseOpenBSDProcInfo(ThreadData &thread_data, DataExtractor &data) {
-@@ -524,12 +543,28 @@ static void ParseOpenBSDProcInfo(ThreadD
+@@ -524,12 +545,28 @@ static void ParseOpenBSDProcInfo(ThreadD
  /// 1) A PT_NOTE segment is composed of one or more NOTE entries.
  /// 2) NOTE Entry contains a standard header followed by variable size data.
  ///   (see ELFNote structure)
@@ -110,7 +112,7 @@ $NetBSD$
  /// forms
  ///    a) Each thread context(2 or more NOTE entries) contained in its own
  ///    segment (PT_NOTE)
-@@ -540,8 +575,9 @@ static void ParseOpenBSDProcInfo(ThreadD
+@@ -540,8 +577,9 @@ static void ParseOpenBSDProcInfo(ThreadD
  ///        new thread when it finds NT_PRSTATUS or NT_PRPSINFO NOTE entry.
  ///    For case (b) there may be either one NT_PRPSINFO per thread, or a single
  ///    one that applies to all threads (depending on the platform type).
@@ -121,7 +123,7 @@ $NetBSD$
    assert(segment_header && segment_header->p_type == llvm::ELF::PT_NOTE);
  
    lldb::offset_t offset = 0;
-@@ -607,21 +643,6 @@ Error ProcessElfCore::ParseThreadContext
+@@ -607,21 +645,6 @@ Error ProcessElfCore::ParseThreadContext
        default:
          break;
        }
@@ -143,7 +145,7 @@ $NetBSD$
      } 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.
-@@ -659,7 +680,7 @@ Error ProcessElfCore::ParseThreadContext
+@@ -659,7 +682,7 @@ Error ProcessElfCore::ParseThreadContext
          // The result from FXSAVE is in NT_PRXFPREG for i386 core files
          if (arch.GetCore() == ArchSpec::eCore_x86_64_x86_64)
            thread_data->fpregset = note_data;
@@ -152,7 +154,7 @@ $NetBSD$
            thread_data->fpregset = note_data;
          break;
        case NT_PRPSINFO:
-@@ -717,6 +738,132 @@ Error ProcessElfCore::ParseThreadContext
+@@ -717,6 +740,134 @@ Error ProcessElfCore::ParseThreadContext
    return error;
  }
  
@@ -210,7 +212,9 @@ $NetBSD$
 +
 +    if ((note.n_name == "NetBSD-CORE") &&
 +        (note.n_type == NETBSD::NT_PROCINFO)) {
-+      ParseNetBSDProcInfo(note_data, nlwps, signo, siglwp);
++      Error error = ParseNetBSDProcInfo(note_data, nlwps, signo, siglwp);
++      if (error.Fail())
++        return error;
 +    } else if ((note.n_name == "NetBSD-CORE") &&
 +               (note.n_type == NETBSD::NT_AUXV)) {
 +      m_auxv = DataExtractor(note_data);
@@ -225,7 +229,7 @@ $NetBSD$
 +          m_thread_data.back().tid = StringConvert::ToUInt32(
 +              note.n_name.substr(12).c_str(), UINT32_MAX, 0, &success);
 +          if (!success)
-+            return Error("Error parsing NetBSD core(5) notes: cannot convert "
++            return Error("Error parsing NetBSD core(5) notes: Cannot convert "
 +                         "LWP ID to integer");
 +        } else if (note.n_type == NETBSD::AMD64::NT_FPREGS) {
 +          if (m_thread_data.empty())
@@ -285,7 +289,7 @@ $NetBSD$
  uint32_t ProcessElfCore::GetNumThreadContexts() {
    if (!m_thread_data_valid)
      DoLoadCore();
-@@ -730,7 +877,7 @@ ArchSpec ProcessElfCore::GetArchitecture
+@@ -730,7 +881,7 @@ ArchSpec ProcessElfCore::GetArchitecture
    core_file->GetArchitecture(arch);
  
    ArchSpec target_arch = GetTarget().GetArchitecture();


Home | Main Index | Thread Index | Old Index