]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: make catch_syscall_enabled return bool
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 27 Nov 2023 15:45:51 +0000 (15:45 +0000)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 27 Nov 2023 15:48:20 +0000 (10:48 -0500)
Make it return a bool and adjust a few comparisons where it's used.

Change-Id: Ic77d23b0dcfcfc9195dfe65e4c7ff9cf3229f6fb

gdb/break-catch-syscall.c
gdb/breakpoint.h
gdb/i386-linux-nat.c
gdb/inf-ptrace.c
gdb/infrun.c
gdb/netbsd-nat.c

index a00ecebebbd802fae36eaa3ee8bd6d8dbdb5226d..bc0d5ca0eb3c44c1d75e0f46307a1fa5699b503d 100644 (file)
@@ -465,8 +465,10 @@ is_syscall_catchpoint_enabled (struct breakpoint *bp)
     return 0;
 }
 
-int
-catch_syscall_enabled (void)
+/* See breakpoint.h.  */
+
+bool
+catch_syscall_enabled ()
 {
   struct catch_syscall_inferior_data *inf_data
     = get_catch_syscall_inferior_data (current_inferior ());
index e75efc90495b2a821a28e4d4ce92763441ba6d8b..feb798224c0a0d959e06d757bf7c3d1499e9b814 100644 (file)
@@ -1868,9 +1868,8 @@ extern void set_breakpoint_condition (struct breakpoint *b, const char *exp,
 extern void set_breakpoint_condition (int bpnum, const char *exp,
                                      int from_tty, bool force);
 
-/* Checks if we are catching syscalls or not.
-   Returns 0 if not, greater than 0 if we are.  */
-extern int catch_syscall_enabled (void);
+/* Checks if we are catching syscalls or not.  */
+extern bool catch_syscall_enabled ();
 
 /* Checks if we are catching syscalls with the specific
    syscall_number.  Used for "filtering" the catchpoints.
index 7e0572e19070250ef7b0db95e0ef64b022844ac8..43a0a8a58a387a1f2bdb294d3be62a9c85725c66 100644 (file)
@@ -652,7 +652,7 @@ i386_linux_nat_target::low_resume (ptid_t ptid, int step, enum gdb_signal signal
   int pid = ptid.lwp ();
   int request;
 
-  if (catch_syscall_enabled () > 0)
+  if (catch_syscall_enabled ())
    request = PTRACE_SYSCALL;
   else
     request = PTRACE_CONT;
index ececf0e94986bd14339240c203be556dde62b52e..407bffb74d68fb9d896a5c23442152d1f24de32b 100644 (file)
@@ -262,7 +262,7 @@ inf_ptrace_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
        single-threaded processes, so simply resume the inferior.  */
     ptid = ptid_t (inferior_ptid.pid ());
 
-  if (catch_syscall_enabled () > 0)
+  if (catch_syscall_enabled ())
     request = PT_SYSCALL;
   else
     request = PT_CONTINUE;
index a1543ab2443c938d0c460d1ac30365322d7ff7eb..cc6b2033eaf9b80689116f516bcb6e4b1f87ba4d 100644 (file)
@@ -5080,7 +5080,7 @@ handle_syscall_event (struct execution_control_state *ecs)
   syscall_number = ecs->ws.syscall_number ();
   ecs->event_thread->set_stop_pc (regcache_read_pc (regcache));
 
-  if (catch_syscall_enabled () > 0
+  if (catch_syscall_enabled ()
       && catching_syscall_number (syscall_number))
     {
       infrun_debug_printf ("syscall number=%d", syscall_number);
index 0cfcb45038ccb80f8a317006cb1a7038ef263c73..7ef200b8936c2d2ca001fda2eca19d06d21fb2b3 100644 (file)
@@ -509,7 +509,7 @@ nbsd_resume(nbsd_nat_target *target, ptid_t ptid, int step,
          perror_with_name (("ptrace"));
     }
 
-  if (catch_syscall_enabled () > 0)
+  if (catch_syscall_enabled ())
     request = PT_SYSCALL;
   else
     request = PT_CONTINUE;