Esempio n. 1
0
void
gdbtk_add_hooks (void)
{
  static struct gdb_events handlers;

  /* Gdb event handlers */
  handlers.breakpoint_create = gdbtk_create_breakpoint;
  handlers.breakpoint_modify = gdbtk_modify_breakpoint;
  handlers.breakpoint_delete = gdbtk_delete_breakpoint;
  handlers.tracepoint_create = gdbtk_create_tracepoint;
  handlers.tracepoint_modify = gdbtk_modify_tracepoint;
  handlers.tracepoint_delete = gdbtk_delete_tracepoint;
  handlers.architecture_changed = gdbtk_architecture_changed;
  deprecated_set_gdb_event_hooks (&handlers);

  /* Hooks */
  deprecated_call_command_hook = gdbtk_call_command;
  deprecated_set_hook = gdbtk_set_hook;
  deprecated_readline_begin_hook = gdbtk_readline_begin;
  deprecated_readline_hook = gdbtk_readline;
  deprecated_readline_end_hook = gdbtk_readline_end;

  deprecated_print_frame_info_listing_hook = gdbtk_print_frame_info;
  deprecated_query_hook = gdbtk_query;
  deprecated_warning_hook = gdbtk_warning;

  deprecated_interactive_hook = gdbtk_interactive;
  deprecated_target_wait_hook = gdbtk_wait;
  deprecated_ui_load_progress_hook = gdbtk_load_hash;

  deprecated_ui_loop_hook = x_event;
  deprecated_pre_add_symbol_hook = gdbtk_pre_add_symbol;
  deprecated_post_add_symbol_hook = gdbtk_post_add_symbol;
  deprecated_file_changed_hook = gdbtk_file_changed;
  specify_exec_file_hook (gdbtk_exec_file_display);

  deprecated_trace_find_hook = gdbtk_trace_find;
  deprecated_trace_start_stop_hook = gdbtk_trace_start_stop;

  deprecated_attach_hook            = gdbtk_attach;
  deprecated_detach_hook            = gdbtk_detach;

  deprecated_register_changed_hook = gdbtk_register_changed;
  deprecated_memory_changed_hook = gdbtk_memory_changed;
  deprecated_selected_frame_level_changed_hook = gdbtk_selected_frame_changed;
  deprecated_context_hook = gdbtk_context_change;

  deprecated_error_begin_hook = gdbtk_error_begin;

  deprecated_annotate_signal_hook = gdbtk_annotate_signal;
  deprecated_annotate_signalled_hook = gdbtk_annotate_signal;
}
Esempio n. 2
0
/* Remove the TUI specific hooks.  */
void
tui_remove_hooks (void)
{
    deprecated_target_wait_hook = 0;
    deprecated_selected_frame_level_changed_hook = 0;
    deprecated_print_frame_info_listing_hook = 0;
    deprecated_query_hook = 0;
    deprecated_registers_changed_hook = 0;
    deprecated_register_changed_hook = 0;
    deprecated_detach_hook = 0;

    /* Restore the previous event hooks.  */
    deprecated_set_gdb_event_hooks (tui_old_event_hooks);
}
Esempio n. 3
0
/* Install the TUI specific hooks.  */
void
tui_install_hooks (void)
{
    deprecated_target_wait_hook = tui_target_wait_hook;
    deprecated_selected_frame_level_changed_hook = tui_selected_frame_level_changed_hook;
    deprecated_print_frame_info_listing_hook = tui_print_frame_info_listing_hook;

    deprecated_query_hook = tui_query_hook;

    /* Install the event hooks.  */
    tui_old_event_hooks = deprecated_set_gdb_event_hooks (&tui_event_hooks);

    deprecated_registers_changed_hook = tui_registers_changed_hook;
    deprecated_register_changed_hook = tui_register_changed_hook;
    deprecated_detach_hook = tui_detach_hook;
}
enum mi_cmd_result
mi_cmd_break_insert (char *command, char **argv, int argc)
{
  char *address = NULL;
  enum bp_type type = REG_BP;
  int temp_p = 0;
  int thread = -1;
  int ignore_count = 0;
  char *condition = NULL;
  int pending = 0;
  struct gdb_exception e;
  struct gdb_events *old_hooks;
  enum opt
    {
      HARDWARE_OPT, TEMP_OPT /*, REGEXP_OPT */ , CONDITION_OPT,
      IGNORE_COUNT_OPT, THREAD_OPT, PENDING_OPT
    };
  static struct mi_opt opts[] =
  {
    {"h", HARDWARE_OPT, 0},
    {"t", TEMP_OPT, 0},
    {"c", CONDITION_OPT, 1},
    {"i", IGNORE_COUNT_OPT, 1},
    {"p", THREAD_OPT, 1},
    {"f", PENDING_OPT, 0},
    { 0, 0, 0 }
  };

  /* Parse arguments. It could be -r or -h or -t, <location> or ``--''
     to denote the end of the option list. */
  int optind = 0;
  char *optarg;
  while (1)
    {
      int opt = mi_getopt ("mi_cmd_break_insert", argc, argv, opts, &optind, &optarg);
      if (opt < 0)
	break;
      switch ((enum opt) opt)
	{
	case TEMP_OPT:
	  temp_p = 1;
	  break;
	case HARDWARE_OPT:
	  type = HW_BP;
	  break;
#if 0
	case REGEXP_OPT:
	  type = REGEXP_BP;
	  break;
#endif
	case CONDITION_OPT:
	  condition = optarg;
	  break;
	case IGNORE_COUNT_OPT:
	  ignore_count = atol (optarg);
	  break;
	case THREAD_OPT:
	  thread = atol (optarg);
	  break;
	case PENDING_OPT:
	  pending = 1;
	  break;
	}
    }

  if (optind >= argc)
    error (_("mi_cmd_break_insert: Missing <location>"));
  if (optind < argc - 1)
    error (_("mi_cmd_break_insert: Garbage following <location>"));
  address = argv[optind];

  /* Now we have what we need, let's insert the breakpoint! */
  old_hooks = deprecated_set_gdb_event_hooks (&breakpoint_hooks);
  /* Make sure we restore hooks even if exception is thrown.  */
  TRY_CATCH (e, RETURN_MASK_ALL)
    {
      switch (type)
	{
	case REG_BP:
	  set_breakpoint (address, condition,
			  0 /*hardwareflag */ , temp_p,
			  thread, ignore_count,
			  pending);
	  break;
	case HW_BP:
	  set_breakpoint (address, condition,
			  1 /*hardwareflag */ , temp_p,
			  thread, ignore_count,
			  pending);
	  break;
#if 0
	case REGEXP_BP:
	  if (temp_p)
	    error (_("mi_cmd_break_insert: Unsupported tempoary regexp breakpoint"));
	  else
	    rbreak_command_wrapper (address, FROM_TTY);
	  return MI_CMD_DONE;
	  break;
#endif
	default:
	  internal_error (__FILE__, __LINE__,
			  _("mi_cmd_break_insert: Bad switch."));
	}
    }
  deprecated_set_gdb_event_hooks (old_hooks);
  if (e.reason < 0)
    throw_exception (e);

  return MI_CMD_DONE;
}