[Lldb-commits] [PATCH] D41824: Remove use of private header in LLDB

2018-01-08 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

Opened https://bugs.llvm.org/show_bug.cgi?id=35857


Repository:
  rL LLVM

https://reviews.llvm.org/D41824



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


[Lldb-commits] [PATCH] D41824: Remove use of private header in LLDB

2018-01-08 Thread xoviat via Phabricator via lldb-commits
xoviat added a comment.

Thanks for the quick response! This change was prompted by a failed build using 
the `cmake ..`, `cmake --build .`, `cmake --build . --target install` standard 
workflow. I look forward to the fix in LLVM 7!


Repository:
  rL LLVM

https://reviews.llvm.org/D41824



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


Re: [Lldb-commits] [PATCH] D41725: [lldb] [test] Fix missing HAVE_LIBZ for tests in stand-alone builds

2018-01-08 Thread Jim Ingham via lldb-commits
IIUA, this code is negotiating the best compression to use for communication 
between lldb & the remote stub.  Since there's no guarantee that the remote 
stub has anything to do with llvm, you can't just use whatever llvm uses.

Jim


> On Jan 7, 2018, at 2:11 AM, Michał Górny via Phabricator via lldb-commits 
>  wrote:
> 
> mgorny added a comment.
> 
> I was talking of:
> 
>  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
>  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
>  tools/debugserver/source/RNBRemote.cpp
> 
> 
> https://reviews.llvm.org/D41725
> 
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


[Lldb-commits] [PATCH] D41745: Handle O reply packets during qRcmd

2018-01-08 Thread Owen Shaw via Phabricator via lldb-commits
owenpshaw updated this revision to Diff 128991.
owenpshaw added a comment.

Updated patch with new function name suggested by @clayborg.  Added unit test 
and changed to llvm::function_ref as suggested by @labath.

Based on Greg's comments in the other thread, I've kept the new function 
separate, rather than use a flag in SendPacketAndWaitForResponse.

Is it worth creating a function to share the locking code that's common to 
SendPacketAndWaitForResponse and SendPacketAndReceiveResponseWithOutputSupport? 
 Alternatively, should the lock-related error logging be unique to distinguish 
between the two functions?


https://reviews.llvm.org/D41745

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp

Index: unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp
===
--- unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp
+++ unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp
@@ -339,3 +339,25 @@
   ASSERT_TRUE(async_result.get());
   ASSERT_EQ(eStateInvalid, continue_state.get());
 }
+
+TEST_F(GDBRemoteClientBaseTest, SendPacketAndReceiveResponseWithOutputSupport) {
+  StringExtractorGDBRemote response;
+  StreamString command_output;
+
+  ASSERT_EQ(PacketResult::Success, server.SendPacket("O"));
+  ASSERT_EQ(PacketResult::Success, server.SendPacket("O48656c6c6f2c"));
+  ASSERT_EQ(PacketResult::Success, server.SendPacket("O20"));
+  ASSERT_EQ(PacketResult::Success, server.SendPacket("O"));
+  ASSERT_EQ(PacketResult::Success, server.SendPacket("O776f726c64"));
+  ASSERT_EQ(PacketResult::Success, server.SendPacket("OK"));
+
+  PacketResult result = client.SendPacketAndReceiveResponseWithOutputSupport(
+"qRcmd,test", response, true,
+[&command_output](llvm::StringRef output) {
+  command_output << output;
+});
+
+  ASSERT_EQ(PacketResult::Success, result);
+  ASSERT_EQ("OK", response.GetStringRef());
+  ASSERT_EQ("Hello, world", command_output.GetString().str());
+}
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -5154,10 +5154,13 @@
 
   bool send_async = true;
   StringExtractorGDBRemote response;
-  process->GetGDBRemote().SendPacketAndWaitForResponse(
-  packet.GetString(), response, send_async);
-  result.SetStatus(eReturnStatusSuccessFinishResult);
   Stream &output_strm = result.GetOutputStream();
+  process->GetGDBRemote().SendPacketAndReceiveResponseWithOutputSupport(
+  packet.GetString(), response, send_async,
+  [&output_strm](llvm::StringRef output) {
+output_strm << output;
+  });
+  result.SetStatus(eReturnStatusSuccessFinishResult);
   output_strm.Printf("  packet: %s\n", packet.GetData());
   const std::string &response_str = response.GetStringRef();
 
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
@@ -232,6 +232,10 @@
   PacketResult ReadPacket(StringExtractorGDBRemote &response,
   Timeout timeout, bool sync_on_timeout);
 
+  PacketResult ReadPacketWithOutputSupport(StringExtractorGDBRemote &response,
+  Timeout timeout, bool sync_on_timeout,
+  std::function output_callback);
+
   // Pop a packet from the queue in a thread safe manner
   PacketResult PopPacketFromQueue(StringExtractorGDBRemote &response,
   Timeout timeout);
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -274,6 +274,24 @@
   return result;
 }
 
+GDBRemoteCommunication::PacketResult
+GDBRemoteCommunication::ReadPacketWithOutputSupport(
+StringExtractorGDBRemote &response,
+Timeout timeout,
+bool sync_on_timeout,
+std::function output_callback) {
+  auto result = ReadPacket(response, timeout, sync_on_timeout);
+  while (result == PacketResult::Success && response.IsNormalResponse() &&
+ response.PeekChar() == 'O') {
+response.GetChar();
+std::string output;
+if (response.GetHexByteString(output))
+  output_callback(output);
+result = ReadPacket(response, timeout, sync_on_timeout);

[Lldb-commits] [PATCH] D41745: Handle O reply packets during qRcmd

2018-01-08 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.



In https://reviews.llvm.org/D41745#970362, @owenpshaw wrote:

> Updated patch with new function name suggested by @clayborg.  Added unit test 
> and changed to llvm::function_ref as suggested by @labath.


Looks great.

> Based on Greg's comments in the other thread, I've kept the new function 
> separate, rather than use a flag in SendPacketAndWaitForResponse.

Yeah, it doesn't seem like any other commands will us it, so this is best just 
so people don't think it is normal.

> Is it worth creating a function to share the locking code that's common to 
> SendPacketAndWaitForResponse and 
> SendPacketAndReceiveResponseWithOutputSupport?

I don't think so since it is so simple.

> Alternatively, should the lock-related error logging be unique to distinguish 
> between the two functions?

I am not sure it matters since this only affects the rCmd, and the packet 
reception stuff is still the same.


https://reviews.llvm.org/D41745



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


[Lldb-commits] [PATCH] D41745: Handle O reply packets during qRcmd

2018-01-08 Thread Owen Shaw via Phabricator via lldb-commits
owenpshaw added a comment.

Thanks!  I don't have commit access, so someone needs to commit this for me, 
right?


https://reviews.llvm.org/D41745



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


[Lldb-commits] [PATCH] D41533: Advanced guessing of rendezvous breakpoint

2018-01-08 Thread Eugene Zemtsov via Phabricator via lldb-commits
eugene updated this revision to Diff 129002.
eugene edited the summary of this revision.
eugene added a reviewer: tberghammer.
eugene added a project: LLDB.
eugene added a subscriber: lldb-commits.
eugene added a comment.

Fix tests.


https://reviews.llvm.org/D41533

Files:
  
packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py
  packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
  source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
  source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h

Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
+++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
@@ -85,13 +85,17 @@
   /// mapped to the address space
   lldb::addr_t m_vdso_base;
 
+  /// Contains AT_BASE, which means a dynamic loader has been
+  /// mapped to the address space
+  lldb::addr_t m_interpreter_base;
+
   /// Loaded module list. (link map for each module)
   std::map>
   m_loaded_modules;
 
-  /// Enables a breakpoint on a function called by the runtime
+  /// If possible sets a breakpoint on a function called by the runtime
   /// linker each time a module is loaded or unloaded.
-  virtual void SetRendezvousBreakpoint();
+  bool SetRendezvousBreakpoint();
 
   /// Callback routine which updates the current list of loaded modules based
   /// on the information supplied by the runtime linker.
@@ -138,7 +142,11 @@
   /// of all dependent modules.
   virtual void LoadAllCurrentModules();
 
-  void LoadVDSO(lldb_private::ModuleList &modules);
+  void LoadVDSO();
+
+  // Loading an interpreter module (if present) assumming m_interpreter_base
+  // already points to its base address.
+  lldb::ModuleSP LoadInterpreterModule();
 
   /// Computes a value for m_load_offset returning the computed address on
   /// success and LLDB_INVALID_ADDRESS on failure.
@@ -148,9 +156,10 @@
   /// success and LLDB_INVALID_ADDRESS on failure.
   lldb::addr_t GetEntryPoint();
 
-  /// Evaluate if Aux vectors contain vDSO information
+  /// Evaluate if Aux vectors contain vDSO and LD information
   /// in case they do, read and assign the address to m_vdso_base
-  void EvalVdsoStatus();
+  /// and m_interpreter_base.
+  void EvalSpecialModulesStatus();
 
   /// Loads Module from inferior process.
   void ResolveExecutableModule(lldb::ModuleSP &module_sp);
Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -79,7 +79,8 @@
 : DynamicLoader(process), m_rendezvous(process),
   m_load_offset(LLDB_INVALID_ADDRESS), m_entry_point(LLDB_INVALID_ADDRESS),
   m_auxv(), m_dyld_bid(LLDB_INVALID_BREAK_ID),
-  m_vdso_base(LLDB_INVALID_ADDRESS) {}
+  m_vdso_base(LLDB_INVALID_ADDRESS),
+  m_interpreter_base(LLDB_INVALID_ADDRESS) {}
 
 DynamicLoaderPOSIXDYLD::~DynamicLoaderPOSIXDYLD() {
   if (m_dyld_bid != LLDB_INVALID_BREAK_ID) {
@@ -117,7 +118,7 @@
   : "",
 load_offset);
 
-  EvalVdsoStatus();
+  EvalSpecialModulesStatus();
 
   // if we dont have a load address we cant re-base
   bool rebase_exec = (load_offset == LLDB_INVALID_ADDRESS) ? false : true;
@@ -207,7 +208,7 @@
 
   executable = GetTargetExecutable();
   load_offset = ComputeLoadOffset();
-  EvalVdsoStatus();
+  EvalSpecialModulesStatus();
 
   if (executable.get() && load_offset != LLDB_INVALID_ADDRESS) {
 ModuleList module_list;
@@ -217,7 +218,12 @@
 if (log)
   log->Printf("DynamicLoaderPOSIXDYLD::%s about to call ProbeEntry()",
   __FUNCTION__);
-ProbeEntry();
+
+if (!SetRendezvousBreakpoint()) {
+  // If we cannot establish rendezvous breakpoint right now
+  // we'll try again at enty point.
+  ProbeEntry();
+}
 
 m_process->GetTarget().ModulesDidLoad(module_list);
   }
@@ -329,38 +335,72 @@
   return false; // Continue running.
 }
 
-void DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint() {
+bool DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint() {
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
+  if (m_dyld_bid != LLDB_INVALID_BREAK_ID) {
+LLDB_LOG(log,
+ "Rendezvous breakpoint breakpoint id {0} for pid {1}"
+ "is already set.",
+ m_dyld_bid,
+ m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
+return true;
+  }
 
-  addr_t break_addr = m_rendezvous.GetBreakAddress();
+  addr_t break_addr;
   Target &target = m_process->GetTarget();
 
-  if (m_dyld_bid == LLDB_INVALID_BREAK_ID) {
-if (log)
-  log->Printf("DynamicLoaderPOSIXDYLD::%s pid %" PRI

[Lldb-commits] [lldb] r322054 - Cut and paste error - I wasn't actually running both tests...

2018-01-08 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Mon Jan  8 19:03:20 2018
New Revision: 322054

URL: http://llvm.org/viewvc/llvm-project?rev=322054&view=rev
Log:
Cut and paste error - I wasn't actually running both tests...

Modified:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py?rev=322054&r1=322053&r2=322054&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py 
Mon Jan  8 19:03:20 2018
@@ -40,7 +40,7 @@ class ExecTestCase(TestBase):
 @expectedFailureAll(archs=['i386'], bugnumber="rdar://28656532")
 @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], 
bugnumber="rdar://problem/34559552") # this exec test has problems on ios 
systems
 def test_skipping_exec (self):
-self.do_test(False)
+self.do_test(True)
 
 def do_test(self, skip_exec):
 if self.getArchitecture() == 'x86_64':


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