41 std::vector<int> &&calls)
166 int syscall_number = 0;
178 if (syscall_number == iter)
210 uiout->
text (
"Temporary catchpoint ");
212 uiout->
text (
"Catchpoint ");
224 uiout->
text (
" (call to syscall ");
226 uiout->
text (
" (returned from syscall ");
251 if (opts.addressprint)
256 uiout->
text (
"syscalls \"");
258 uiout->
text (
"syscall \"");
277 text += std::to_string (iter);
357 std::unique_ptr<syscall_catchpoint> c
365static std::vector<int>
368 std::vector<int> result;
373 int i, syscall_number;
379 arg = skip_spaces (arg);
381 for (i = 0; i < 127 && arg[i] && !isspace (arg[i]); ++i)
382 cur_name[i] = arg[i];
387 syscall_number = (int) strtol (cur_name, &endptr, 0);
390 if (syscall_number < 0)
391 error (_(
"Unknown syscall number '%d'."), syscall_number);
393 result.push_back (s.
number);
395 else if (startswith (cur_name,
"g:")
396 || startswith (cur_name,
"group:"))
400 const char *group_name;
403 group_name = strchr (cur_name,
':') + 1;
406 error (_(
"Unknown syscall group '%s'."), group_name);
416 error (_(
"Unknown syscall name '%s'."), cur_name);
430 std::vector<int> filter;
436 error (_(
"The feature 'catch syscall' is not supported on \
437this architecture yet."));
441 arg = skip_spaces (arg);
498 if (syscall_number == iter)
523 const char *text,
const char *word)
526 gdb::unique_xmalloc_ptr<const char *> group_list;
535 if (startswith (
prefix,
"g:") || startswith (
prefix,
"group:"))
539 if (group_list != NULL)
545 gdb::unique_xmalloc_ptr<const char *> syscall_list
549 const char **group_ptr = group_list.get ();
552 std::vector<std::string> holders;
555 for (
int i = 0; group_ptr[i] != NULL; i++)
556 holders.push_back (string_printf (
"group:%s", group_ptr[i]));
558 for (
int i = 0; group_ptr[i] != NULL; i++)
559 group_ptr[i] = holders[i].c_str ();
561 if (syscall_list != NULL)
563 if (group_list != NULL)
584 "break-catch-syscall");
587Catch system calls by their names, groups and/or numbers.\n\
588Arguments say which system calls to catch. If no arguments are given,\n\
589every system call will be caught. Arguments, if given, should be one\n\
590or more system call names (if your system supports that), system call\n\
591groups or system call numbers."),
void annotate_field(int num)
void annotate_catchpoint(int num)
struct gdbarch * get_current_arch(void)
struct gdbarch * target_gdbarch(void)
static std::vector< int > catch_syscall_split_args(const char *arg)
static bool catching_syscall_number_1(struct breakpoint *b, int syscall_number)
static void catch_syscall_command_1(const char *arg, int from_tty, struct cmd_list_element *command)
static void clear_syscall_counts(struct inferior *inf)
static int syscall_catchpoint_p(struct breakpoint *b)
int catch_syscall_enabled(void)
static void catch_syscall_completer(struct cmd_list_element *cmd, completion_tracker &tracker, const char *text, const char *word)
static int is_syscall_catchpoint_enabled(struct breakpoint *bp)
bool catching_syscall_number(int syscall_number)
static struct catch_syscall_inferior_data * get_catch_syscall_inferior_data(struct inferior *inf)
void _initialize_break_catch_syscall()
static void create_syscall_event_catchpoint(int tempflag, std::vector< int > &&filter)
void add_catch_command(const char *name, const char *docstring, cmd_func_ftype *func, completer_ftype *completer, void *user_data_catch, void *user_data_tcatch)
const char * bpdisp_text(enum bpdisp disp)
void print_num_locno(const bpstat *bs, struct ui_out *uiout)
void install_breakpoint(int internal, std::unique_ptr< breakpoint > &&arg, int update_gll)
breakpoint_range all_breakpoints()
void maybe_print_thread_hit_breakpoint(struct ui_out *uiout)
ui_file_style style() const
void field_string(const char *fldname, const char *string, const ui_file_style &style=ui_file_style())
void field_signed(const char *fldname, LONGEST value)
void field_skip(const char *fldname)
void text(const char *string)
bool is_mi_like_p() const
void complete_on_enum(completion_tracker &tracker, const char *const *enumlist, const char *text, const char *word)
cli_style_option metadata_style
bool gdbarch_get_syscall_number_p(struct gdbarch *gdbarch)
struct inferior * current_inferior(void)
void get_last_target_status(process_stratum_target **target, ptid_t *ptid, target_waitstatus *status)
const char * async_reason_lookup(enum async_reply_reason reason)
@ EXEC_ASYNC_SYSCALL_ENTRY
@ EXEC_ASYNC_SYSCALL_RETURN
observable< struct inferior * > inferior_exit
#define prefix(a, b, R, do)
struct breakpoint * breakpoint_at
void print_recreate_thread(struct ui_file *fp) const
std::vector< int > syscalls_counts
std::vector< int > syscalls_to_be_caught
int insert_location(struct bp_location *) override
int breakpoint_hit(const struct bp_location *bl, const address_space *aspace, CORE_ADDR bp_addr, const target_waitstatus &ws) override
bool print_one(bp_location **) const override
void print_mention() const override
enum print_stop_action print_it(const bpstat *bs) const override
syscall_catchpoint(struct gdbarch *gdbarch, bool tempflag, std::vector< int > &&calls)
int remove_location(struct bp_location *, enum remove_bp_reason reason) override
void print_recreate(struct ui_file *fp) const override
target_waitkind kind() const
int target_set_syscall_catchpoint(int pid, bool needed, int any_count, gdb::array_view< const int > syscall_counts)
void gdb_printf(struct ui_file *stream, const char *format,...)
void get_user_print_options(struct value_print_options *opts)
@ TARGET_WAITKIND_SYSCALL_RETURN
@ TARGET_WAITKIND_SYSCALL_ENTRY
const char ** get_syscall_group_names(struct gdbarch *gdbarch)
bool get_syscalls_by_group(struct gdbarch *gdbarch, const char *group, std::vector< int > *syscall_numbers)
const char ** get_syscall_names(struct gdbarch *gdbarch)
bool get_syscalls_by_name(struct gdbarch *gdbarch, const char *syscall_name, std::vector< int > *syscall_numbers)
void get_syscall_by_number(struct gdbarch *gdbarch, int syscall_number, struct syscall *s)