[Lldb-commits] [PATCH] D90525: [lldb] [Process/FreeBSDRemote] Fix attaching via lldb-server

2020-10-31 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: krytarowski, emaste, labath.
Herald added a subscriber: arichardson.
mgorny requested review of this revision.

Fix two bugs that caused attaching to a process in a pre-connected
lldb-server to fail.  These are:

1. Prematurely reporting status in NativeProcessFreeBSD::Attach(). The 
SetState() call defaulted to notify the process, and LLGS tried to send the 
stopped packet before the process instance was assigned to it.  While at it, 
add an assert for that in LLGS.

2. Duplicate call to ReinitializeThreads() (via SetupTrace()) that overwrote 
the stopped status in threads.  Now SetupTrace() is called directly by 
NativeProcessFreeBSD::Attach() (not the Factory) in place of 
ReinitializeThreads().

This fixes at least commands/process/attach/TestProcessAttach.py
and python_api/hello_world/TestHelloWorld.py.


https://reviews.llvm.org/D90525

Files:
  lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp


Index: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -1728,6 +1728,7 @@
   case eStateSuspended:
   case eStateStopped:
   case eStateCrashed: {
+assert(m_debugged_process_up != nullptr);
 lldb::tid_t tid = m_debugged_process_up->GetCurrentThreadID();
 // Make sure we set the current thread so g and p packets return the data
 // the gdb will expect.
Index: lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
===
--- lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
+++ lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
@@ -125,10 +125,6 @@
   if (!status.Success())
 return status.ToError();
 
-  status = process_up->SetupTrace();
-  if (status.Fail())
-return status.ToError();
-
   return std::move(process_up);
 }
 
@@ -698,8 +694,9 @@
   0)
 return Status(errno, eErrorTypePOSIX);
 
-  /* Initialize threads */
-  status = ReinitializeThreads();
+  // Initialize threads and tracing status
+  // NB: this needs to be called before we set thread state
+  status = SetupTrace();
   if (status.Fail())
 return status;
 
@@ -707,7 +704,8 @@
 static_cast(*thread).SetStoppedBySignal(SIGSTOP);
 
   // Let our process instance know the thread has stopped.
-  SetState(StateType::eStateStopped);
+  SetCurrentThreadID(m_threads.front()->GetID());
+  SetState(StateType::eStateStopped, false);
   return Status();
 }
 


Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -1728,6 +1728,7 @@
   case eStateSuspended:
   case eStateStopped:
   case eStateCrashed: {
+assert(m_debugged_process_up != nullptr);
 lldb::tid_t tid = m_debugged_process_up->GetCurrentThreadID();
 // Make sure we set the current thread so g and p packets return the data
 // the gdb will expect.
Index: lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
===
--- lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
+++ lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
@@ -125,10 +125,6 @@
   if (!status.Success())
 return status.ToError();
 
-  status = process_up->SetupTrace();
-  if (status.Fail())
-return status.ToError();
-
   return std::move(process_up);
 }
 
@@ -698,8 +694,9 @@
   0)
 return Status(errno, eErrorTypePOSIX);
 
-  /* Initialize threads */
-  status = ReinitializeThreads();
+  // Initialize threads and tracing status
+  // NB: this needs to be called before we set thread state
+  status = SetupTrace();
   if (status.Fail())
 return status;
 
@@ -707,7 +704,8 @@
 static_cast(*thread).SetStoppedBySignal(SIGSTOP);
 
   // Let our process instance know the thread has stopped.
-  SetState(StateType::eStateStopped);
+  SetCurrentThreadID(m_threads.front()->GetID());
+  SetState(StateType::eStateStopped, false);
   return Status();
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D78807: Fix gendered documentation

2020-10-31 Thread Sylvestre Ledru via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG43e451f9f316: Fix gendered documentation (authored by 
pedro.gonnet, committed by sylvestre.ledru).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78807/new/

https://reviews.llvm.org/D78807

Files:
  
clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
  lldb/docs/use/variable.rst


Index: lldb/docs/use/variable.rst
===
--- lldb/docs/use/variable.rst
+++ lldb/docs/use/variable.rst
@@ -993,7 +993,7 @@
 user to see.
 
 A filter will solve this issue by only letting the user see those member
-variables he cares about. Of course, the equivalent of a filter can be
+variables they care about. Of course, the equivalent of a filter can be
 implemented easily using synthetic children, but a filter lets you get the job
 done without having to write Python code.
 
Index: 
clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
===
--- 
clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
+++ 
clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
@@ -44,4 +44,4 @@
   static NSString* __anotherString = @"world";
 
 The check will give a warning message but will not be able to suggest a fix. 
The
-user need to fix it on his own.
+user needs to fix it on their own.


Index: lldb/docs/use/variable.rst
===
--- lldb/docs/use/variable.rst
+++ lldb/docs/use/variable.rst
@@ -993,7 +993,7 @@
 user to see.
 
 A filter will solve this issue by only letting the user see those member
-variables he cares about. Of course, the equivalent of a filter can be
+variables they care about. Of course, the equivalent of a filter can be
 implemented easily using synthetic children, but a filter lets you get the job
 done without having to write Python code.
 
Index: clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
+++ clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
@@ -44,4 +44,4 @@
   static NSString* __anotherString = @"world";
 
 The check will give a warning message but will not be able to suggest a fix. The
-user need to fix it on his own.
+user needs to fix it on their own.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 43e451f - Fix gendered documentation

2020-10-31 Thread Sylvestre Ledru via lldb-commits

Author: Pedro Gonnet
Date: 2020-10-31T12:17:19+01:00
New Revision: 43e451f9f316fd224d88899d45313a73ff11291e

URL: 
https://github.com/llvm/llvm-project/commit/43e451f9f316fd224d88899d45313a73ff11291e
DIFF: 
https://github.com/llvm/llvm-project/commit/43e451f9f316fd224d88899d45313a73ff11291e.diff

LOG: Fix gendered documentation

Changed two references to developers as "he" or "him" to the more neutral 
"they".

Reviewed By: JDevlieghere, sylvestre.ledru

Differential Revision: https://reviews.llvm.org/D78807

Added: 


Modified: 

clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
lldb/docs/use/variable.rst

Removed: 




diff  --git 
a/clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
 
b/clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
index 15b59996e3d3..84c97767f18f 100644
--- 
a/clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
+++ 
b/clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst
@@ -44,4 +44,4 @@ However for code that prefixed with non-alphabetical 
characters like:
   static NSString* __anotherString = @"world";
 
 The check will give a warning message but will not be able to suggest a fix. 
The
-user need to fix it on his own.
+user needs to fix it on their own.

diff  --git a/lldb/docs/use/variable.rst b/lldb/docs/use/variable.rst
index 5b1fef7b06c3..ae6dbf2f4e5e 100644
--- a/lldb/docs/use/variable.rst
+++ b/lldb/docs/use/variable.rst
@@ -993,7 +993,7 @@ have many member variables but not all of these are 
actually necessary for the
 user to see.
 
 A filter will solve this issue by only letting the user see those member
-variables he cares about. Of course, the equivalent of a filter can be
+variables they care about. Of course, the equivalent of a filter can be
 implemented easily using synthetic children, but a filter lets you get the job
 done without having to write Python code.
 



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