Fix lldb.
authormortimer <mortimer@openbsd.org>
Tue, 9 Feb 2021 21:35:45 +0000 (21:35 +0000)
committermortimer <mortimer@openbsd.org>
Tue, 9 Feb 2021 21:35:45 +0000 (21:35 +0000)
Map deliberately invalid signal to zero when passing to PT_STEP and P_CONTINUE.

Also clean up getting Environment so setting LLDB_DEBUGSERVER env vars works again.

ok patrick@

gnu/llvm/lldb/source/Host/openbsd/Host.cpp
gnu/llvm/lldb/source/Plugins/Process/OpenBSD/NativeProcessOpenBSD.cpp

index c5d4233..776202f 100644 (file)
@@ -41,18 +41,7 @@ namespace lldb_private {
 class ProcessLaunchInfo;
 }
 
-Environment Host::GetEnvironment() {
-  Environment env;
-  char *v;
-  char **var = environ;
-  for (; var != NULL && *var != NULL; ++var) {
-    v = strchr(*var, (int)'-');
-    if (v == NULL)
-      continue;
-    env.insert(v);
-  }
-  return env;
-}
+Environment Host::GetEnvironment() { return Environment(environ); }
 
 static bool
 GetOpenBSDProcessArgs(const ProcessInstanceInfoMatch *match_info_ptr,
index ae58121..c0b0aaa 100644 (file)
@@ -239,12 +239,13 @@ Status NativeProcessOpenBSD::Resume(const ResumeActionList &resume_actions) {
   }
 
   Status error;
+  int signal = action->signal != LLDB_INVALID_SIGNAL_NUMBER ? action->signal : 0;
 
   switch (action->state) {
   case eStateRunning: {
     // Run the thread, possibly feeding it the signal.
     error = NativeProcessOpenBSD::PtraceWrapper(PT_CONTINUE, GetID(), (void *)1,
-                                               action->signal);
+                                               signal);
     if (!error.Success())
       return error;
     for (const auto &thread : m_threads)
@@ -256,7 +257,7 @@ Status NativeProcessOpenBSD::Resume(const ResumeActionList &resume_actions) {
 #ifdef PT_STEP
     // Run the thread, possibly feeding it the signal.
     error = NativeProcessOpenBSD::PtraceWrapper(PT_STEP, GetID(), (void *)1,
-                                               action->signal);
+                                               signal);
     if (!error.Success())
       return error;
     for (const auto &thread : m_threads)