[Lldb-commits] [PATCH] D33426: Introduce new command: thread backtrace unique

2017-06-07 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Cool. Sorry about all the back-and-forth and thanks for the patience.


https://reviews.llvm.org/D33426



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D32022: Fix backtrace of noreturn functions situated at the end of a module

2017-06-07 Thread Pavel Labath via lldb-commits
On 6 June 2017 at 18:41, Jim Ingham  wrote:
> This is WWDC week.  We’ll try to find time to take a look at this, but 
> silence may mean preoccupation more than anything else…
>

I was not trying to imply it means anything else than that. However,
after two months of inactivity, I was running out of ways to push this
forward.

That said, I did not realize WWDC is this week. I can wait until that
passes. This patch is not on my critical path, but I'd hate for it to
stay buried forever.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D33674: Implementation of Intel(R) Processor Trace support for Linux

2017-06-07 Thread Ravitheja Addepally via Phabricator via lldb-commits
ravitheja added inline comments.



Comment at: source/Plugins/Process/Linux/NativeProcessLinux.h:156
+  // -
+  static size_t ReadCyclicBuffer(void *buf, size_t buf_size, void *cyc_buf,
+ size_t cyc_buf_size, size_t cyc_start,

zturner wrote:
> labath wrote:
> > How about ` void ReadCyclicBuffer(ArrayRef buffer, size_t 
> > position, MutableArrayRef &dest)`
> Better yet, drop the `position` argument entirely.  `ReadCyclicBuffer(src, N, 
> dest)` is equivalent to `ReadCyclicBuffer(src.drop_front(N), dest);`
So there are couple of things i would like to mention ->
1) The data and aux buffers allocated are cyclic in nature, so we need to 
consider the cyc_start or starting index in order to correctly read them.
2) The function ReadCyclicBuffer is very generic and is capable of reading a 
certain chunk of memory starting from a certain offset.
3) Now I could have kept this function in the private domain so that the 
cyc_start need not be passed everytime, but then I also wanted to unit test 
this function.

Now keeping these in mind my questions are the following ->
@zturner @labath  I need the offset and cyc_start , both are required so the 
position argument won't suffice ?

Please correct me if i am wrong.



Comment at: source/Plugins/Process/Linux/NativeProcessLinux.h:160
+  enum PTErrorCode {
+FileNotFound = 0x23,
+ThreadNotTraced,

labath wrote:
> This seems suspicious. How did you come to choose this number?
Sometime ago I asked in the devlist about the error codes in lldb and got the 
answer that they were completely arbitrary, so 0x23 has no special meaning. The 
question that I would like to ask is do u think these error codes should be 
here ? coz in https://reviews.llvm.org/D33035 it was suggested by @clayborg 
that tools working on top of the SB API's should only receive Error Strings and 
not codes.

Currently anyone who would encounter these codes would have to refer here for 
their meaning. Also the remote packets don't allow me to send Error Strings 
instead of error codes.



Comment at: source/Plugins/Process/Linux/NativeProcessLinux.h:319-320
+int m_fd;
+void *m_mmap_data;
+void *m_mmap_aux;
+void *m_mmap_base;

zturner wrote:
> Instead of having 
> ```
> void *m_mmap_data;
> void *m_mmap_aux;
> void *m_mmap_base;
> ```
> 
> and then doing some ugly casting every time someone calls `getAuxBufferSize` 
> or `getDataBufferSize`, instead just write:
> 
> ```
> MutableArrayRef m_mmap_data;
> MutableArrayRef m_mmap_aux;
> ```
> 
> and initializing these array refs up front using the size from the header.  
> This way you don't have to worry about anyone using the buffers incorrectly, 
> and the `ReadPerfTraceAux(size_t offset)` function no longer needs to return 
> a `Status`, but instead it can just return `MutableArrayRef` since 
> nothing can go wrong.
As mentioned in my previous comments, the m_mmap_data and m_mmap_aux are cyclic 
buffers and unfortunately the kernel keeps overwriting the buffer in a cyclic 
manner. The last position written by the kernel can only be obtained by 
inspecting the data_head and aux_head fields in the  perf_event_mmap_page 
structure (pointed by m_mmap_base).

Because of this scenario you see the ugly type casting. Now regarding the 
casting in getAuxBufferSize and getDataBufferSize I did not want to store the 
buffer sizes as even if store them since they are not the biggest contributors 
to the total type casting ugliness. plus if the correct sizes are already store 
in the perf_event_mmap_page structure why store them myself ?.

Now regarding ReadPerfTraceAux(size_t offset) , i still need the size argument 
coz what if the user does not want to read the complete data from offset to the 
end and just wants a chunk in between the offset and the end ?


https://reviews.llvm.org/D33674



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D33674: Implementation of Intel(R) Processor Trace support for Linux

2017-06-07 Thread Ravitheja Addepally via Phabricator via lldb-commits
ravitheja added inline comments.



Comment at: source/Plugins/Process/Linux/NativeProcessLinux.cpp:3009-3010
+  errno = 0;
+  m_mmap_base =
+  mmap(NULL, (metabufsize + page_size), PROT_WRITE, MAP_SHARED, m_fd, 0);
+  if (m_mmap_base == MAP_FAILED) {

zturner wrote:
> Perhaps you can use `llvm::MemoryBuffer` here?  It mmaps internally
In my case, I only want to allocate it using mmap with the options i use here, 
with 
`llvm::MemoryBuffer` I see no option to force it to only use mmap and with the 
options i need ?


https://reviews.llvm.org/D33674



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D33674: Implementation of Intel(R) Processor Trace support for Linux

2017-06-07 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: source/Plugins/Process/Linux/NativeProcessLinux.h:156
+  // -
+  static size_t ReadCyclicBuffer(void *buf, size_t buf_size, void *cyc_buf,
+ size_t cyc_buf_size, size_t cyc_start,

ravitheja wrote:
> zturner wrote:
> > labath wrote:
> > > How about ` void ReadCyclicBuffer(ArrayRef buffer, size_t 
> > > position, MutableArrayRef &dest)`
> > Better yet, drop the `position` argument entirely.  `ReadCyclicBuffer(src, 
> > N, dest)` is equivalent to `ReadCyclicBuffer(src.drop_front(N), dest);`
> So there are couple of things i would like to mention ->
> 1) The data and aux buffers allocated are cyclic in nature, so we need to 
> consider the cyc_start or starting index in order to correctly read them.
> 2) The function ReadCyclicBuffer is very generic and is capable of reading a 
> certain chunk of memory starting from a certain offset.
> 3) Now I could have kept this function in the private domain so that the 
> cyc_start need not be passed everytime, but then I also wanted to unit test 
> this function.
> 
> Now keeping these in mind my questions are the following ->
> @zturner @labath  I need the offset and cyc_start , both are required so the 
> position argument won't suffice ?
> 
> Please correct me if i am wrong.
I believe zachary did not understand what the function does. The position is 
indeed necessary. However, I believe the prototype I suggested will work for 
you.

As for the function itself, I think it is way over-engineered. More than half 
of the function is sanity-checking, and more than half of the tests are tests 
of the sanity checks.

With ArrayRef, the function could be implemented as:
```
auto remaining = buffer.drop_front(position);
if(remaining.size() > dest.size())
  std::copy(remaining.begin(), dest.size(), dest.begin());
else
  std::copy_n(buffer.begin(), remaining.size() - dest.size(), 
std::copy(remaining.begin(), remaining.end(), dest.begin());
```
(this will be slightly more complicated if you need to handle the `dest.size() 
> buffer.size()` case, which I am not sure if you need)




Comment at: source/Plugins/Process/Linux/NativeProcessLinux.h:160
+  enum PTErrorCode {
+FileNotFound = 0x23,
+ThreadNotTraced,

ravitheja wrote:
> labath wrote:
> > This seems suspicious. How did you come to choose this number?
> Sometime ago I asked in the devlist about the error codes in lldb and got the 
> answer that they were completely arbitrary, so 0x23 has no special meaning. 
> The question that I would like to ask is do u think these error codes should 
> be here ? coz in https://reviews.llvm.org/D33035 it was suggested by 
> @clayborg that tools working on top of the SB API's should only receive Error 
> Strings and not codes.
> 
> Currently anyone who would encounter these codes would have to refer here for 
> their meaning. Also the remote packets don't allow me to send Error Strings 
> instead of error codes.
If they're completely arbitrary, then how about starting with number one?

Not being able to send complex error messages across the gdb-protocol is a bit 
of a drag. I would not be opposed to adding such a facility, as I wished for 
that a couple of times in past. If you wish to do that, then we should start a 
separate discussion.



Comment at: source/Plugins/Process/Linux/NativeProcessLinux.h:319-320
+int m_fd;
+void *m_mmap_data;
+void *m_mmap_aux;
+void *m_mmap_base;

ravitheja wrote:
> zturner wrote:
> > Instead of having 
> > ```
> > void *m_mmap_data;
> > void *m_mmap_aux;
> > void *m_mmap_base;
> > ```
> > 
> > and then doing some ugly casting every time someone calls 
> > `getAuxBufferSize` or `getDataBufferSize`, instead just write:
> > 
> > ```
> > MutableArrayRef m_mmap_data;
> > MutableArrayRef m_mmap_aux;
> > ```
> > 
> > and initializing these array refs up front using the size from the header.  
> > This way you don't have to worry about anyone using the buffers 
> > incorrectly, and the `ReadPerfTraceAux(size_t offset)` function no longer 
> > needs to return a `Status`, but instead it can just return 
> > `MutableArrayRef` since nothing can go wrong.
> As mentioned in my previous comments, the m_mmap_data and m_mmap_aux are 
> cyclic buffers and unfortunately the kernel keeps overwriting the buffer in a 
> cyclic manner. The last position written by the kernel can only be obtained 
> by inspecting the data_head and aux_head fields in the  perf_event_mmap_page 
> structure (pointed by m_mmap_base).
> 
> Because of this scenario you see the ugly type casting. Now regarding the 
> casting in getAuxBufferSize and getDataBufferSize I did not want to store the 
> buffer sizes as even if store them since they are not the biggest 
> contributors to the total type casting ugliness. plus if the correct siz

[Lldb-commits] [lldb] r304924 - Switch TaskMapOverInt to llvm::function_ref

2017-06-07 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Jun  7 11:28:08 2017
New Revision: 304924

URL: http://llvm.org/viewvc/llvm-project?rev=304924&view=rev
Log:
Switch TaskMapOverInt to llvm::function_ref

The function does not persist the callback, so using a lighter-weight
asbtraction seems appropriate.

Also tweak the signatures of the lambdas to match what the TaskMap
interface expects.

Modified:
lldb/trunk/include/lldb/Utility/TaskPool.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Utility/TaskPool.cpp

Modified: lldb/trunk/include/lldb/Utility/TaskPool.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/TaskPool.h?rev=304924&r1=304923&r2=304924&view=diff
==
--- lldb/trunk/include/lldb/Utility/TaskPool.h (original)
+++ lldb/trunk/include/lldb/Utility/TaskPool.h Wed Jun  7 11:28:08 2017
@@ -10,6 +10,7 @@
 #ifndef utility_TaskPool_h_
 #define utility_TaskPool_h_
 
+#include "llvm/ADT/STLExtras.h"
 #include  // for bind, function
 #include 
 #include 
@@ -86,6 +87,6 @@ template <> struct TaskPool::RunTaskImpl
 // 'batch_size' numbers at a time to work on, so for very fast functions, batch
 // should be large enough to avoid too much cache line contention.
 void TaskMapOverInt(size_t begin, size_t end,
-std::function const &func);
+const llvm::function_ref &func);
 
 #endif // #ifndef utility_TaskPool_h_

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=304924&r1=304923&r2=304924&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Jun  7 
11:28:08 2017
@@ -1958,7 +1958,7 @@ void SymbolFileDWARF::Index() {
   &function_fullname_index, &function_method_index,
   &function_selector_index, &objc_class_selectors_index,
   &global_index, &type_index,
-  &namespace_index](uint32_t cu_idx) {
+  &namespace_index](size_t cu_idx) {
   DWARFCompileUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx);
   if (dwarf_cu) {
 dwarf_cu->Index(
@@ -1967,10 +1967,9 @@ void SymbolFileDWARF::Index() {
 objc_class_selectors_index[cu_idx], global_index[cu_idx],
 type_index[cu_idx], namespace_index[cu_idx]);
   }
-  return cu_idx;
 };
 
-auto extract_fn = [debug_info, &clear_cu_dies](uint32_t cu_idx) {
+auto extract_fn = [debug_info, &clear_cu_dies](size_t cu_idx) {
   DWARFCompileUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx);
   if (dwarf_cu) {
 // dwarf_cu->ExtractDIEsIfNeeded(false) will return zero if the

Modified: lldb/trunk/source/Utility/TaskPool.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/TaskPool.cpp?rev=304924&r1=304923&r2=304924&view=diff
==
--- lldb/trunk/source/Utility/TaskPool.cpp (original)
+++ lldb/trunk/source/Utility/TaskPool.cpp Wed Jun  7 11:28:08 2017
@@ -75,7 +75,7 @@ void TaskPoolImpl::Worker(TaskPoolImpl *
 }
 
 void TaskMapOverInt(size_t begin, size_t end,
-std::function const &func) {
+const llvm::function_ref &func) {
   std::atomic idx{begin};
   size_t num_workers =
   std::min(end, std::thread::hardware_concurrency());


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D33998: Add pretty-printer for wait(2) statuses and modernize the code handling them

2017-06-07 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
Herald added a subscriber: mgorny.

A number of places were trying to decode the result of wait(). Add a simple
utility function that does that and a struct that encapsulates the
decoded result. Then also provide a pretty-printer for that class.


https://reviews.llvm.org/D33998

Files:
  include/lldb/Host/Host.h
  include/lldb/Host/common/NativeProcessProtocol.h
  include/lldb/lldb-private-enumerations.h
  source/Host/common/Host.cpp
  source/Host/common/NativeProcessProtocol.cpp
  source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.h
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  unittests/Host/CMakeLists.txt
  unittests/Host/HostTest.cpp

Index: unittests/Host/HostTest.cpp
===
--- /dev/null
+++ unittests/Host/HostTest.cpp
@@ -0,0 +1,22 @@
+//===-- HostTest.cpp *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "lldb/Host/Host.h"
+#include "gtest/gtest.h"
+
+using namespace lldb_private;
+using namespace llvm;
+
+TEST(Host, WaitStatusFormat) {
+  EXPECT_EQ("W01", formatv("{0:g}", WaitStatus{WaitStatus::Exit, 1}).str());
+  EXPECT_EQ("X02", formatv("{0:g}", WaitStatus{WaitStatus::Signal, 2}).str());
+  EXPECT_EQ("S03", formatv("{0:g}", WaitStatus{WaitStatus::Stop, 3}).str());
+  EXPECT_EQ("Exited with status 4",
+formatv("{0}", WaitStatus{WaitStatus::Exit, 4}).str());
+}
Index: unittests/Host/CMakeLists.txt
===
--- unittests/Host/CMakeLists.txt
+++ unittests/Host/CMakeLists.txt
@@ -1,6 +1,7 @@
 set (FILES
   FileSpecTest.cpp
   FileSystemTest.cpp
+  HostTest.cpp
   MainLoopTest.cpp
   SocketAddressTest.cpp
   SocketTest.cpp
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -370,53 +370,23 @@
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
 
   // send W notification
-  ExitType exit_type = ExitType::eExitTypeInvalid;
-  int return_code = 0;
-  std::string exit_description;
-
-  const bool got_exit_info =
-  process->GetExitStatus(&exit_type, &return_code, exit_description);
-  if (!got_exit_info) {
-if (log)
-  log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
-  ", failed to retrieve process exit status",
-  __FUNCTION__, process->GetID());
+  auto wait_status = process->GetExitStatus();
+  if (!wait_status) {
+LLDB_LOG(log, "pid = {0}, failed to retrieve process exit status",
+ process->GetID());
 
 StreamGDBRemote response;
 response.PutChar('E');
 response.PutHex8(GDBRemoteServerError::eErrorExitStatus);
 return SendPacketNoLock(response.GetString());
-  } else {
-if (log)
-  log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
-  ", returning exit type %d, return code %d [%s]",
-  __FUNCTION__, process->GetID(), exit_type, return_code,
-  exit_description.c_str());
-
-StreamGDBRemote response;
-
-char return_type_code;
-switch (exit_type) {
-case ExitType::eExitTypeExit:
-  return_type_code = 'W';
-  break;
-case ExitType::eExitTypeSignal:
-  return_type_code = 'X';
-  break;
-case ExitType::eExitTypeStop:
-  return_type_code = 'S';
-  break;
-case ExitType::eExitTypeInvalid:
-  return_type_code = 'E';
-  break;
-}
-response.PutChar(return_type_code);
+  }
 
-// POSIX exit status limited to unsigned 8 bits.
-response.PutHex8(return_code);
+  LLDB_LOG(log, "pid = {0}, returning exit type {1}", process->GetID(),
+   *wait_status);
 
-return SendPacketNoLock(response.GetString());
-  }
+  StreamGDBRemote response;
+  response.Format("{0:g}", *wait_status);
+  return SendPacketNoLock(response.GetString());
 }
 
 static void AppendHexValue(StreamString &response, const uint8_t *buf,
Index: source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
===
--- source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
+++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
@@ -123,7 +123,7 @@
   void AttachToInferior(MainLoop &mainloop, lldb::pid_t pid, Status &error);
 
   vo

[Lldb-commits] [PATCH] D33998: Add pretty-printer for wait(2) statuses and modernize the code handling them

2017-06-07 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 101759.
labath added a comment.

Fix typo


https://reviews.llvm.org/D33998

Files:
  include/lldb/Host/Host.h
  include/lldb/Host/common/NativeProcessProtocol.h
  include/lldb/lldb-private-enumerations.h
  source/Host/common/Host.cpp
  source/Host/common/NativeProcessProtocol.cpp
  source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.h
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  unittests/Host/CMakeLists.txt
  unittests/Host/HostTest.cpp

Index: unittests/Host/HostTest.cpp
===
--- /dev/null
+++ unittests/Host/HostTest.cpp
@@ -0,0 +1,22 @@
+//===-- HostTest.cpp *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "lldb/Host/Host.h"
+#include "gtest/gtest.h"
+
+using namespace lldb_private;
+using namespace llvm;
+
+TEST(Host, WaitStatusFormat) {
+  EXPECT_EQ("W01", formatv("{0:g}", WaitStatus{WaitStatus::Exit, 1}).str());
+  EXPECT_EQ("X02", formatv("{0:g}", WaitStatus{WaitStatus::Signal, 2}).str());
+  EXPECT_EQ("S03", formatv("{0:g}", WaitStatus{WaitStatus::Stop, 3}).str());
+  EXPECT_EQ("Exited with status 4",
+formatv("{0}", WaitStatus{WaitStatus::Exit, 4}).str());
+}
Index: unittests/Host/CMakeLists.txt
===
--- unittests/Host/CMakeLists.txt
+++ unittests/Host/CMakeLists.txt
@@ -1,6 +1,7 @@
 set (FILES
   FileSpecTest.cpp
   FileSystemTest.cpp
+  HostTest.cpp
   MainLoopTest.cpp
   SocketAddressTest.cpp
   SocketTest.cpp
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -370,53 +370,23 @@
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
 
   // send W notification
-  ExitType exit_type = ExitType::eExitTypeInvalid;
-  int return_code = 0;
-  std::string exit_description;
-
-  const bool got_exit_info =
-  process->GetExitStatus(&exit_type, &return_code, exit_description);
-  if (!got_exit_info) {
-if (log)
-  log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
-  ", failed to retrieve process exit status",
-  __FUNCTION__, process->GetID());
+  auto wait_status = process->GetExitStatus();
+  if (!wait_status) {
+LLDB_LOG(log, "pid = {0}, failed to retrieve process exit status",
+ process->GetID());
 
 StreamGDBRemote response;
 response.PutChar('E');
 response.PutHex8(GDBRemoteServerError::eErrorExitStatus);
 return SendPacketNoLock(response.GetString());
-  } else {
-if (log)
-  log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
-  ", returning exit type %d, return code %d [%s]",
-  __FUNCTION__, process->GetID(), exit_type, return_code,
-  exit_description.c_str());
-
-StreamGDBRemote response;
-
-char return_type_code;
-switch (exit_type) {
-case ExitType::eExitTypeExit:
-  return_type_code = 'W';
-  break;
-case ExitType::eExitTypeSignal:
-  return_type_code = 'X';
-  break;
-case ExitType::eExitTypeStop:
-  return_type_code = 'S';
-  break;
-case ExitType::eExitTypeInvalid:
-  return_type_code = 'E';
-  break;
-}
-response.PutChar(return_type_code);
+  }
 
-// POSIX exit status limited to unsigned 8 bits.
-response.PutHex8(return_code);
+  LLDB_LOG(log, "pid = {0}, returning exit type {1}", process->GetID(),
+   *wait_status);
 
-return SendPacketNoLock(response.GetString());
-  }
+  StreamGDBRemote response;
+  response.Format("{0:g}", *wait_status);
+  return SendPacketNoLock(response.GetString());
 }
 
 static void AppendHexValue(StreamString &response, const uint8_t *buf,
Index: source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
===
--- source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
+++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
@@ -123,7 +123,7 @@
   void AttachToInferior(MainLoop &mainloop, lldb::pid_t pid, Status &error);
 
   void MonitorCallback(lldb::pid_t pid, int signal);
-  void MonitorExited(lldb::pid_t pid, int signal, int status);
+  void MonitorExited(lldb::pid_t pid, WaitStatus status);
   void MonitorSIGSTOP(ll

[Lldb-commits] [PATCH] D33998: Add pretty-printer for wait(2) statuses and modernize the code handling them

2017-06-07 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added inline comments.



Comment at: source/Host/common/Host.cpp:1001
+return {Stop, uint8_t(WSTOPSIG(wstatus))};
+  llvm_unreachable("Unknown wait status");
+}

`WIFCONTINUED()`?


https://reviews.llvm.org/D33998



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D33998: Add pretty-printer for wait(2) statuses and modernize the code handling them

2017-06-07 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: source/Host/common/Host.cpp:1001
+return {Stop, uint8_t(WSTOPSIG(wstatus))};
+  llvm_unreachable("Unknown wait status");
+}

krytarowski wrote:
> `WIFCONTINUED()`?
I'm deliberately ignoring that, as we don't have a use for it yet. On linux you 
have to pass the a special flag to waitpid to receive those notifications, and 
we don't do that. Does it work the same way on netbsd? If it possible to get 
those during normal interaction (without WCONTINUED), then I need to add it 
(and probably netbsd code needs to handle it), but otherwise I propose to skip 
it for the time being.


https://reviews.llvm.org/D33998



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D33998: Add pretty-printer for wait(2) statuses and modernize the code handling them

2017-06-07 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added inline comments.



Comment at: source/Host/common/Host.cpp:1001
+return {Stop, uint8_t(WSTOPSIG(wstatus))};
+  llvm_unreachable("Unknown wait status");
+}

labath wrote:
> krytarowski wrote:
> > `WIFCONTINUED()`?
> I'm deliberately ignoring that, as we don't have a use for it yet. On linux 
> you have to pass the a special flag to waitpid to receive those 
> notifications, and we don't do that. Does it work the same way on netbsd? If 
> it possible to get those during normal interaction (without WCONTINUED), then 
> I need to add it (and probably netbsd code needs to handle it), but otherwise 
> I propose to skip it for the time being.
I see, we need `WCONTINUED` too. We can skip it now.


https://reviews.llvm.org/D33998



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D33426: Introduce new command: thread backtrace unique

2017-06-07 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

This looks fine to me.


https://reviews.llvm.org/D33426



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D32022: Fix backtrace of noreturn functions situated at the end of a module

2017-06-07 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.
This revision is now accepted and ready to land.

Pavel, my apologies for not following up on this, we had a big push to get 
ready for a beta release/conference this week, but it wasn't fair to leave you 
hanging with this change.  Please commit.  I'd like to play with this a little 
when I get free time (hahahaha) to see if I can't isolate the change a little 
more, but it'll be on me to play with the corefile test case on my own time 
instead of blocking you.


https://reviews.llvm.org/D32022



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits