diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-08-30 16:10:41 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-08-31 09:55:31 -0400 |
commit | 9fe3819e83a442f1bd563000120121e5518f7d53 (patch) | |
tree | 460f1bcd0c4c163581170e926f48e15b01d12d66 /gdb/break-catch-syscall.c | |
parent | 88ae41e17980533927f98339bcb40015522f06c4 (diff) | |
download | gdb-9fe3819e83a442f1bd563000120121e5518f7d53.zip gdb-9fe3819e83a442f1bd563000120121e5518f7d53.tar.gz gdb-9fe3819e83a442f1bd563000120121e5518f7d53.tar.bz2 |
gdb: remove breakpoint_find_if
Remove breakpoint_find_if, replace its sole usage with using
all_breakpoints directly instead. At the same time, change return
types to use bool.
Change-Id: I9ec392236b4804b362d16ab563330b9c07311106
Diffstat (limited to 'gdb/break-catch-syscall.c')
-rw-r--r-- | gdb/break-catch-syscall.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c index 78e7079..32736f0 100644 --- a/gdb/break-catch-syscall.c +++ b/gdb/break-catch-syscall.c @@ -486,15 +486,12 @@ catch_syscall_enabled (void) return inf_data->total_syscalls_count != 0; } -/* Helper function for catching_syscall_number. If B is a syscall - catchpoint for SYSCALL_NUMBER, return 1 (which will make - 'breakpoint_find_if' return). Otherwise, return 0. */ +/* Helper function for catching_syscall_number. return true if B is a syscall + catchpoint for SYSCALL_NUMBER, else false. */ -static int -catching_syscall_number_1 (struct breakpoint *b, - void *data) +static bool +catching_syscall_number_1 (struct breakpoint *b, int syscall_number) { - int syscall_number = (int) (uintptr_t) data; if (is_syscall_catchpoint_enabled (b)) { @@ -504,22 +501,23 @@ catching_syscall_number_1 (struct breakpoint *b, { for (int iter : c->syscalls_to_be_caught) if (syscall_number == iter) - return 1; + return true; } else - return 1; + return true; } - return 0; + return false; } -int +bool catching_syscall_number (int syscall_number) { - struct breakpoint *b = breakpoint_find_if (catching_syscall_number_1, - (void *) (uintptr_t) syscall_number); + for (breakpoint *b : all_breakpoints ()) + if (catching_syscall_number_1 (b, syscall_number)) + return true; - return b != NULL; + return false; } /* Complete syscall names. Used by "catch syscall". */ |