From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [pushed] gdb: make catch_syscall_enabled return bool
Date: Mon, 27 Nov 2023 10:48:44 -0500 [thread overview]
Message-ID: <20231127154847.12655-1-simon.marchi@efficios.com> (raw)
Make it return a bool and adjust a few comparisons where it's used.
Change-Id: Ic77d23b0dcfcfc9195dfe65e4c7ff9cf3229f6fb
---
gdb/break-catch-syscall.c | 6 ++++--
gdb/breakpoint.h | 5 ++---
gdb/i386-linux-nat.c | 2 +-
gdb/inf-ptrace.c | 2 +-
gdb/infrun.c | 2 +-
gdb/netbsd-nat.c | 2 +-
6 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c
index a00ecebebbd8..bc0d5ca0eb3c 100644
--- a/gdb/break-catch-syscall.c
+++ b/gdb/break-catch-syscall.c
@@ -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 ());
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index e75efc90495b..feb798224c0a 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -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.
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index 7e0572e19070..43a0a8a58a38 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -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;
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index ececf0e94986..407bffb74d68 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -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;
diff --git a/gdb/infrun.c b/gdb/infrun.c
index a1543ab2443c..cc6b2033eaf9 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -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);
diff --git a/gdb/netbsd-nat.c b/gdb/netbsd-nat.c
index 0cfcb45038cc..7ef200b8936c 100644
--- a/gdb/netbsd-nat.c
+++ b/gdb/netbsd-nat.c
@@ -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;
base-commit: 935dc9ff652ca256c10672412c1df3da95cadbfb
--
2.43.0
reply other threads:[~2023-11-27 15:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231127154847.12655-1-simon.marchi@efficios.com \
--to=simon.marchi@efficios.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).