]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
FreeBSD: some more clangd refactoring
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 15 Jan 2023 06:20:08 +0000 (07:20 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 15 Jan 2023 06:20:08 +0000 (07:20 +0100)
coregrind/vgdb-invoker-freebsd.c

index 6de80c9071c8ed62a161ff61946eaa691b1231cc..4a8a97cb7c2b6e2b8454fe29392b4a368f943e1c 100644 (file)
@@ -157,8 +157,9 @@ char *status_image (int status)
 
    result[0] = 0;
 
-   if (WIFEXITED(status))
+   if (WIFEXITED(status)) {
       APPEND ("WIFEXITED %d ", WEXITSTATUS(status));
+   }
 
    if (WIFSIGNALED(status)) {
       APPEND ("WIFSIGNALED %d ", WTERMSIG(status));
@@ -258,10 +259,11 @@ Bool waitstopped (pid_t pid, int signal_expected, const char *msg)
          if (res != 0) {
             ERROR(errno, "PT_LWPINFO failed: signal lost !!!!\n");
             signal_queue_sz--;
-         } else
+         } else {
             DEBUG(1, "waitstopped PTRACE_CONT, queuing signal %d"
                   " si_signo %d si_pid %d\n",
                   signal_received, newsiginfo->si_signo, newsiginfo->si_pid);
+         }
          res = ptrace (PT_CONTINUE, pid, (caddr_t)1, 0);
       } else {
          DEBUG(1, "waitstopped PT_CONTINUE with signal %d\n", signal_received);
@@ -314,8 +316,9 @@ Bool attach (pid_t pid, const char *msg)
    if (res != 0) {
       if (output_error || debuglevel > 0) {
          ERROR(errno, "%s PT_ATTACH pid %d %ld\n", msg, pid, res);
-         if (initial_attach)
+         if (initial_attach) {
             output_error = False;
+         }
       }
       return False;
    }
@@ -374,8 +377,9 @@ void restore_and_detach (pid_t pid)
          before resetting the registers. */
       if (pid_of_save_regs_continued) {
          pid_of_save_regs_continued = False;
-         if (!stop(pid_of_save_regs, "sigstop before reset regs"))
+         if (!stop(pid_of_save_regs, "sigstop before reset regs")) {
             DEBUG(0, "Could not sigstop before reset");
+         }
       }
 
       DEBUG(1, "setregs restore registers pid %d\n", pid_of_save_regs);
@@ -392,11 +396,13 @@ void restore_and_detach (pid_t pid)
                   signal_queue[i].si_signo);
             res = ptrace (PT_CONTINUE, pid_of_save_regs, (caddr_t)1,
                           signal_queue[i].si_signo);
-            if (res != 0)
+            if (res != 0) {
                ERROR(errno, "PT_CONTINUE with signal %d\n",
                      signal_queue[i].si_signo);
-            if (!stop(pid_of_save_regs, "sigstop after transmit sig"))
+            }
+            if (!stop(pid_of_save_regs, "sigstop after transmit sig")) {
                DEBUG(0, "Could not sigstop after transmit sig");
+            }
          }
          free (signal_queue);
          signal_queue = NULL;
@@ -406,9 +412,10 @@ void restore_and_detach (pid_t pid)
    } else {
       DEBUG(1, "PTRACE_SETREGS restore registers: no pid\n");
    }
-   if (signal_queue)
+   if (signal_queue) {
       ERROR (0, "One or more signals queued were not delivered. "
              "First signal: %d\n", signal_queue[0].si_signo);
+   }
    detach_from_all_threads(pid);
 }
 
@@ -600,18 +607,18 @@ Bool invoker_invoke_gdbserver (pid_t pid)
       pid_of_save_regs_continued = False;
       restore_and_detach(pid);
       return True;
-   } else {
-      /* Whatever kind of problem happened. We shutdown. */
-      shutting_down = True;
-      return False;
    }
+   /* Whatever kind of problem happened. We shutdown. */
+   shutting_down = True;
+   return False;
 }
 
 void invoker_cleanup_restore_and_detach(void *v_pid)
 {
    DEBUG(1, "invoker_cleanup_restore_and_detach dying: %d\n", dying);
-   if (!dying)
+   if (!dying) {
       restore_and_detach(*(int*)v_pid);
+   }
 }
 
 void invoker_restrictions_msg(void)