41 std::vector<int> &&calls)
166 int syscall_number = 0;
178 if (syscall_number == iter)
208 uiout->
text (
"Temporary catchpoint ");
210 uiout->
text (
"Catchpoint ");
222 uiout->
text (
" (call to syscall ");
224 uiout->
text (
" (returned from syscall ");
248 if (opts.addressprint)
253 uiout->
text (
"syscalls \"");
255 uiout->
text (
"syscall \"");
274 text += std::to_string (iter);
350 std::unique_ptr<syscall_catchpoint> c
358static std::vector<int>
361 std::vector<int> result;
366 int i, syscall_number;
372 arg = skip_spaces (arg);
374 for (i = 0; i < 127 && arg[i] && !isspace (arg[i]); ++i)
375 cur_name[i] = arg[i];
380 syscall_number = (int) strtol (cur_name, &endptr, 0);
383 if (syscall_number < 0)
384 error (_(
"Unknown syscall number '%d'."), syscall_number);
386 result.push_back (s.
number);
388 else if (startswith (cur_name,
"g:")
389 || startswith (cur_name,
"group:"))
393 const char *group_name;
396 group_name = strchr (cur_name,
':') + 1;
399 error (_(
"Unknown syscall group '%s'."), group_name);
409 error (_(
"Unknown syscall name '%s'."), cur_name);
423 std::vector<int> filter;
429 error (_(
"The feature 'catch syscall' is not supported on \
430this architecture yet."));
434 arg = skip_spaces (arg);
486 = gdb::checked_static_cast<syscall_catchpoint *> (b);
491 if (syscall_number == iter)
516 const char *text,
const char *word)
519 gdb::unique_xmalloc_ptr<const char *> group_list;
528 if (startswith (
prefix,
"g:") || startswith (
prefix,
"group:"))
532 if (group_list != NULL)
538 gdb::unique_xmalloc_ptr<const char *> syscall_list
542 const char **group_ptr = group_list.get ();
545 std::vector<std::string> holders;
548 for (
int i = 0; group_ptr[i] != NULL; i++)
549 holders.push_back (string_printf (
"group:%s", group_ptr[i]));
551 for (
int i = 0; group_ptr[i] != NULL; i++)
552 group_ptr[i] = holders[i].c_str ();
554 if (syscall_list != NULL)
556 if (group_list != NULL)
577 "break-catch-syscall");
580Catch system calls by their names, groups and/or numbers.\n\
581Arguments say which system calls to catch. If no arguments are given,\n\
582every system call will be caught. Arguments, if given, should be one\n\
583or more system call names (if your system supports that), system call\n\
584groups 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)
static const registry< inferior >::key< catch_syscall_inferior_data > catch_syscall_inferior_data
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)
breakpoint * install_breakpoint(int internal, std::unique_ptr< breakpoint > &&arg, int update_gll)
void print_num_locno(const bpstat *bs, struct ui_out *uiout)
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)
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(const 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)