30#include "gdbsupport/gdb_obstack.h"
36#include "gdbsupport/gdb_regex.h"
61 {
"-probe-stap libstdcxx:throw",
"__cxa_throw" },
62 {
"-probe-stap libstdcxx:rethrow",
"__cxa_rethrow" },
63 {
"-probe-stap libstdcxx:catch",
"__cxa_begin_catch" }
73 bool temp,
const char *cond_string_,
75 std::string &&except_rx)
82 _(
"invalid type-matching regexp")))
135 if (pc_probe.
prob == NULL)
136 error (_(
"did not find exception probe (does libstdcxx have SDT probes?)"));
142 error (_(
"not stopped at a C++ exception catchpoint"));
146 error (_(
"C++ exception catchpoint has too few arguments"));
152 if ((arg0 != NULL && *arg0 == NULL) || *arg1 == NULL)
153 error (_(
"error computing probe argument at c++ exception catchpoint"));
163 std::string type_name;
172 const char *
name =
nullptr;
173 gdb::unique_xmalloc_ptr<char> canon;
176 struct value *typeinfo_arg;
182 name = (canon !=
nullptr
184 : type_name.c_str ());
186 catch (
const gdb_exception_error &e)
193 if (this->
pattern->exec (name, 0, NULL, 0) != 0)
203 std::vector<symtab_and_line> sals;
213 catch (
const gdb_exception_error &e)
224 catch (
const gdb_exception_error &ex)
228 if (ex.error != NOT_FOUND_ERROR)
246 uiout->
text (bp_temp ?
"Temporary catchpoint "
251 :
" (exception rethrown), ")));
269 if (opts.addressprint)
304 uiout->
text (_(
"\tmatching: "));
318 (bp_temp ? _(
"Temporary catchpoint ") : _(
"Catchpoint")),
322 ? _(
"(catch)") : _(
"(rethrow)"))));
334 gdb_printf (fp, bp_temp ?
"tcatch " :
"catch ");
361 const char *cond_string,
366 std::unique_ptr<exception_catchpoint> cp
368 ex_event, std::move (except_rx)));
387 const char *last, *last_space;
389 start = skip_spaces (*
string);
393 while (*last !=
'\0')
395 const char *if_token = last;
402 last_space = skip_to_space (last);
403 last = skip_spaces (last_space);
407 if (last_space > start)
408 return std::string (start, last_space - start);
409 return std::string ();
416 const char *arg,
bool tempflag,
int from_tty)
418 const char *cond_string = NULL;
422 arg = skip_spaces (arg);
428 if ((*arg !=
'\0') && !isspace (*arg))
429 error (_(
"Junk at end of arguments."));
434 error (_(
"Unsupported or unknown exception event; cannot catch it"));
481 struct value *arg0, *arg1;
482 struct type *obj_type;
509Catch an exception, when caught."),
515Catch an exception, when thrown."),
521Catch an exception, when rethrown."),
void annotate_field(int num)
void annotate_catchpoint(int num)
struct gdbarch * get_current_arch(void)
const char * ep_parse_optional_if_clause(const char **arg)
static void handle_gnu_v3_exceptions(int tempflag, std::string &&except_rx, const char *cond_string, enum exception_event_kind ex_event, int from_tty)
static void catch_throw_command(const char *arg, int from_tty, struct cmd_list_element *command)
static void catch_catch_command(const char *arg, int from_tty, struct cmd_list_element *command)
static std::string extract_exception_regexp(const char **string)
static struct value * compute_exception(struct gdbarch *argc, struct internalvar *var, void *ignore)
static void fetch_probe_arguments(struct value **arg0, struct value **arg1)
static const struct exception_names exception_functions[]
void catch_exception_event(enum exception_event_kind ex_event, const char *arg, bool tempflag, int from_tty)
bool is_exception_catchpoint(breakpoint *bp)
static void catch_rethrow_command(const char *arg, int from_tty, struct cmd_list_element *command)
void _initialize_break_catch_throw()
static const struct internalvar_funcs exception_funcs
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)
void update_breakpoint_locations(code_breakpoint *b, struct program_space *filter_pspace, gdb::array_view< const symtab_and_line > sals, gdb::array_view< const symtab_and_line > sals_end)
void maybe_print_thread_hit_breakpoint(struct ui_out *uiout)
@ bp_loc_software_breakpoint
virtual struct value * evaluate_argument(unsigned n, frame_info_ptr frame)=0
const std::string & get_name() const
virtual unsigned get_argument_count(struct gdbarch *gdbarch)=0
const std::string & get_provider() const
void field_string(const char *fldname, const char *string, const ui_file_style &style=ui_file_style())
void field_skip(const char *fldname)
void text(const char *string)
bool is_mi_like_p() const
void message(const char *format,...) ATTRIBUTE_PRINTF(2
int check_for_argument(const char **str, const char *arg, int arg_len)
std::string cplus_typename_from_type_info(struct value *value)
struct type * cplus_type_from_type_info(struct value *value)
gdb::unique_xmalloc_ptr< char > cp_canonicalize_string(const char *string)
void exception_print(struct ui_file *file, const struct gdb_exception &e)
CORE_ADDR get_frame_pc(frame_info_ptr frame)
struct gdbarch * get_frame_arch(frame_info_ptr this_frame)
frame_info_ptr get_selected_frame(const char *message)
struct type * make_pointer_type(struct type *type, struct type **typeptr)
location_spec_up new_probe_location_spec(std::string &&probe)
std::unique_ptr< location_spec > location_spec_up
static location_spec_up new_explicit_location_spec_function(const char *function_name)
const char * async_reason_lookup(enum async_reply_reason reason)
@ EXEC_ASYNC_BREAKPOINT_HIT
std::vector< symtab_and_line > parse_probes(const location_spec *locspec, struct program_space *search_pspace, struct linespec_result *canonical)
struct bound_probe find_probe_by_pc(CORE_ADDR pc)
struct program_space * current_program_space
virtual void check_status(struct bpstat *bs)
void print_recreate_thread(struct ui_file *fp) const
virtual std::vector< symtab_and_line > decode_location_spec(location_spec *locspec, struct program_space *search_pspace)
bool print_one(const bp_location **) const override
void print_one_detail(struct ui_out *) const override
void print_recreate(struct ui_file *fp) const override
exception_catchpoint(struct gdbarch *gdbarch, bool temp, const char *cond_string_, enum exception_event_kind kind_, std::string &&except_rx)
enum exception_event_kind kind
enum print_stop_action print_it(const bpstat *bs) const override
std::unique_ptr< compiled_regex > pattern
void print_mention() const override
struct bp_location * allocate_location() override
void check_status(struct bpstat *bs) override
void gdb_printf(struct ui_file *stream, const char *format,...)
struct value * value_cast(struct type *type, struct value *arg2)
struct value * value_ind(struct value *arg1)
void get_user_print_options(struct value_print_options *opts)
struct internalvar * create_internalvar_type_lazy(const char *name, const struct internalvar_funcs *funcs, void *data)