Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Autoload-breakpoints without report-async
@ 2012-05-03 16:37 Hui Zhu
  2012-05-03 17:03 ` Eli Zaretskii
  2012-05-15 11:29 ` Hui Zhu
  0 siblings, 2 replies; 7+ messages in thread
From: Hui Zhu @ 2012-05-03 16:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: Yao Qi, Stan Shebs, Eli Zaretskii

[-- Attachment #1: Type: text/plain, Size: 2472 bytes --]

Hi guys,

According to the mail form Yao.  I thought make the autoload-breakpoints and report-async function together make it too hard to review.  So I move the function that depend on the report-async to be a series of separate patches after report-async.
Then the other patches of autoload-breakpoints can be reveiw separate from report-async.

Thanks,
Hui

2012-05-04  Hui Zhu  <hui_zhu@mentor.com>

	* breakpoint.c (hex2bin, unpack_varlen_hex): New extern.
	(autoload_breakpoints_query, autoload_breakpoints_merge,
	autoload_breakpoints_gdb, autoload_breakpoints_stub,
	autoload_breakpoints_enums, this_ubpcmd): New variable.
	(breakpoint_get_commands): New function.
	(print_one_breakpoint): Add out for b->autoload_id.
	(init_raw_breakpoint_without_location): Add init for autoload_id
	and autoload_inserted.
	(autoload_breakpoints_get_id, uploaded_bp_commands_clean,
	uploaded_bp_commands_add, handle_autoload_breakpoint_cmd,
	parse_autoload_breakpoint_definition,
	handle_autoload_breakpoint_cmd_to_breakpoints,
	parse_autoload_breakpoint_definition_to_breakpoints,
	clean_upload_autoload_breakpoints,
	show_upload_autoload_breakpoints,
	read_autoload_breakpoints_action,
	merge_uploaded_autoload_breakpoints, autoload_breakpoints_reset,
	autoload_breakpoints_clean,
	autoload_breakpoints_number): New function.
	(initialize_breakpoint_ops): add command "autoload".
	* breakpoint.h (breakpoint): Add autoload_id and autoload_inserted.
	(uploaded_bpcmd, uploaded_bp): New struct.
	(autoload_breakpoints_query, autoload_breakpoints_merge,
	autoload_breakpoints_gdb, autoload_breakpoints_stub,
	autoload_breakpoints_mode, breakpoint_get_commands,
	autoload_breakpoints_reset, autoload_breakpoints_clean,
	autoload_breakpoints_number, parse_autoload_breakpoint_definition,
	parse_autoload_breakpoint_definition_to_breakpoints,
	clean_upload_autoload_breakpoints, show_upload_autoload_breakpoints,
	merge_uploaded_autoload_breakpoints): New extern.
	* remote.c (PACKET_AutoloadBreakpoints): New enum.
	(remote_start_remote): Check PACKET_AutoloadBreakpoints,
	if need call autoload-breakpoints functions.
	(remote_pr): Add PACKET_AutoloadBreakpoints.
	(remote_reportasync_handler): Add handle for "QBDP".
	(remote_upload_autoload_breakpoints,
	remote_download_autoload_breakpoints): New functions.

2012-05-04  Hui Zhu  <hui_zhu@mentor.com>

	* gdb.texinfo (Setting Breakpoints): Add set breakpoint autoload.
	(Remote Serial Protocol): Add Autoload-breakpoints Format.

[-- Attachment #2: autoload-breakpoints.txt --]
[-- Type: text/plain, Size: 19116 bytes --]

---
 breakpoint.c |  454 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 breakpoint.h |   49 ++++++
 remote.c     |  133 +++++++++++++++++
 3 files changed, 635 insertions(+), 1 deletion(-)

--- a/breakpoint.c
+++ b/breakpoint.c
@@ -79,6 +79,9 @@
 #include "mi/mi-common.h"
 #include "python/python.h"
 
+extern int hex2bin (const char *hex, gdb_byte *bin, int count);
+extern char *unpack_varlen_hex (char *buff, ULONGEST *result);
+
 /* Prototypes for local functions.  */
 
 static void enable_delete_command (char *, int);
@@ -470,6 +473,19 @@ gdb_evaluates_breakpoint_condition_p (vo
   return (mode == condition_evaluation_host);
 }
 
+const char autoload_breakpoints_query[] = "query";
+const char autoload_breakpoints_merge[] = "merge";
+const char autoload_breakpoints_gdb[] = "gdb";
+const char autoload_breakpoints_stub[] = "stub";
+const char *const autoload_breakpoints_enums[] = {
+  autoload_breakpoints_query,
+  autoload_breakpoints_merge,
+  autoload_breakpoints_gdb,
+  autoload_breakpoints_stub,
+  NULL
+};
+const char *autoload_breakpoints_mode = autoload_breakpoints_query;
+
 void _initialize_breakpoint (void);
 
 /* Are we executing breakpoint commands?  */
@@ -1120,6 +1136,15 @@ breakpoint_set_commands (struct breakpoi
   observer_notify_breakpoint_modified (b);
 }
 
+struct command_line *
+breakpoint_get_commands (struct breakpoint *b)
+{
+  if (b->commands && b->commands->commands)
+    return b->commands->commands;
+
+  return NULL;
+}
+
 /* Set the internal `silent' flag on the breakpoint.  Note that this
    is not the same as the "silent" that may appear in the breakpoint's
    commands.  */
@@ -5837,6 +5862,14 @@ print_one_breakpoint (struct breakpoint
 	    }
 	}
     }
+
+    if (b->autoload_id)
+      {
+	annotate_field (7);
+	ui_out_text (uiout, "\tautoload-breakpoint ");
+	ui_out_field_int (uiout, "id", b->autoload_id);
+	ui_out_text (uiout, "\n");
+      }
 }
 
 static int
@@ -6554,6 +6587,8 @@ init_raw_breakpoint_without_location (st
   b->condition_not_parsed = 0;
   b->py_bp_object = NULL;
   b->related_breakpoint = b;
+  b->autoload_id = 0;
+  b->autoload_inserted = 0;
 }
 
 /* Helper to set_raw_breakpoint below.  Creates a breakpoint
@@ -15074,6 +15109,407 @@ pc_at_non_inline_function (struct addres
   return 0;
 }
 
+static int
+autoload_breakpoints_get_id (void)
+{
+  struct breakpoint *b;
+  int id = 1;
+
+  while (1)
+    {
+      ALL_BREAKPOINTS (b)
+	{
+	  if (b->autoload_id == id)
+	    break;
+	}
+      if (b)
+	id ++;
+      else
+	break;
+    }
+
+  return id;
+}
+
+static void
+uploaded_bp_commands_clean (struct uploaded_bp *ubp)
+{
+  struct uploaded_bpcmd *cmd, *cmd_tmp;
+
+  for (cmd = ubp->commands; cmd ? (cmd_tmp = cmd->next, 1): 0; cmd = cmd_tmp)
+    xfree (cmd);
+  ubp->commands = NULL;
+}
+
+static void
+uploaded_bp_commands_add (struct uploaded_bp *ubp, char *buf)
+{
+  struct uploaded_bpcmd *new_cmd, *cmd;
+
+  new_cmd = xzalloc (sizeof (struct uploaded_bpcmd));
+  new_cmd->str = xstrdup (buf);
+
+  for (cmd = ubp->commands; cmd && cmd->next; cmd = cmd->next)
+    ;
+  if (cmd)
+    cmd->next = new_cmd;
+  else
+    ubp->commands = new_cmd;
+}
+
+static void
+handle_autoload_breakpoint_cmd (char cmd, struct uploaded_bp *ubp)
+{
+  switch (cmd)
+    {
+    case 'E':
+      ubp->enable = 1;
+      break;
+    case 'D':
+      ubp->enable = 0;
+      break;
+    case 'R':
+      ubp->removed = 1;
+      break;
+    }
+}
+
+int
+parse_autoload_breakpoint_definition (char *line, struct uploaded_bp **ubpp)
+{
+  ULONGEST id;
+  char cmd;
+  struct uploaded_bp *ubp, *ubp_tmp;
+
+  /* Get id.  */
+  line = unpack_varlen_hex (line, &id);
+  if (line[0] != ':')
+    return -1;
+  if (strlen (line) < 2)
+    return -1;
+  line += 1;
+
+  cmd = line[0];
+  if (line[1] == ':')
+    line += 2;
+  else
+    line += 1;
+
+  if ((cmd == 'C' || cmd == 'O') && id == 0)
+    return -1;
+
+  for (ubp = *ubpp; ubp ? (ubp_tmp = ubp->next, 1): 0; ubp = ubp_tmp)
+    {
+      int loop_stop = 0;
+
+      if (ubp->removed)
+	continue;
+
+      switch (cmd)
+	{
+	case 'E':
+	case 'D':
+	case 'R':
+	  if (id == 0)
+	    handle_autoload_breakpoint_cmd (cmd, ubp);
+	  else if (ubp->id == (int)id)
+	    {
+	      if (line[0] != '\0' && cmd != 'R')
+	        {
+		  /* Get the ubp that same with the id,
+		     change it to new value.  */
+		  loop_stop = 1;
+		}
+	      else
+		{
+		  handle_autoload_breakpoint_cmd (cmd, ubp);
+		  return 0;
+		}
+	    }
+	  break;
+	case 'C':
+	case 'O':
+	  if (ubp->id == (int)id)
+	    loop_stop = 1;
+	  break;
+	default:
+	  return -1;
+	  break;
+	}
+
+      if (loop_stop)
+	break;
+    }
+
+  if (id == 0)
+    return 0;
+
+  switch (cmd)
+    {
+      case 'E':
+      case 'D':
+        {
+	  char *b_addr_hex;
+	  char *b_addr;
+	  enum bptype b_type;
+	  ULONGEST ignore_num;
+	  int end;
+
+	  b_addr_hex = line;
+	  line = strchr (line, ':');
+	  if (!line)
+	    return -1;
+	  line[0] = '\0';
+	  line += 1;
+	  b_addr = alloca (strlen (b_addr_hex) / 2);
+	  end = hex2bin (b_addr_hex, (gdb_byte *) b_addr,
+			 strlen (b_addr_hex) / 2);
+	  b_addr[end] = '\0';
+
+	  if (line[0] == 'S')
+	    b_type = bp_breakpoint;
+	  else if (line[0] == 'H')
+	    b_type = bp_hardware_breakpoint;
+	  else
+	    return -1;
+	  if (line[1] != ':' || line[2] == '\0')
+	    return -1;
+	  line += 2;
+
+	  unpack_varlen_hex (line, &ignore_num);
+
+	  if (ubp)
+	    ubp->removed = 1;
+	  ubp = xzalloc (sizeof (struct uploaded_bp));
+
+          ubp->id = (int) id;
+	  ubp->enable = (cmd == 'E') ? 1 : 0;
+	  ubp->addr_string = xstrdup (b_addr);
+	  ubp->type = b_type;
+	  ubp->ignore_count = (int) ignore_num;
+
+	  for (ubp_tmp = *ubpp; ubp_tmp && ubp_tmp->next;
+	       ubp_tmp = ubp_tmp->next)
+	    ;
+	  if (ubp_tmp)
+	    ubp_tmp->next = ubp;
+	  else
+	    *ubpp = ubp;
+	}
+	break;
+      case 'R':
+	return -1;
+	break;
+      case 'C':
+      case 'O':
+	if (!ubp)
+	  return -1;
+	{
+	  char buf[strlen(line)/2 + 1];
+	  int end;
+
+	  end = hex2bin (line, (gdb_byte *) buf, strlen (line) / 2);
+	  buf[end] = '\0';
+	  if (cmd == 'O')
+	    {
+	      if (ubp->condition)
+		{
+		  xfree (ubp->condition);
+		  ubp->condition = NULL;
+		}
+	      if (end)
+	        ubp->condition = xstrdup (buf);
+	    }
+	  else
+	    {
+	      if (end == 0)
+		uploaded_bp_commands_clean (ubp);
+	      else
+		uploaded_bp_commands_add (ubp, buf);
+	    }
+	}
+	break;
+    }
+
+  return 0;
+}
+
+void
+clean_upload_autoload_breakpoints (void *p)
+{
+  struct uploaded_bp **ubpp = p;
+  struct uploaded_bp *ubp, *ubp_tmp;
+
+  for (ubp = *ubpp; ubp ? (ubp_tmp = ubp->next, 1): 0; ubp = ubp_tmp)
+    {
+      uploaded_bp_commands_clean (ubp);
+      xfree (ubp);
+    }
+  *ubpp = NULL;
+}
+
+void
+show_upload_autoload_breakpoints (struct uploaded_bp *ubp)
+{
+  struct uploaded_bp *tmp;
+  int number = 0;
+
+  for (tmp = ubp; tmp; tmp = tmp->next)
+    {
+      if (!tmp->removed)
+        number ++;
+    }
+  if (number)
+    printf_filtered (_("Got %d autoload-breakpoints from target\n"), number);
+  else
+    return;
+
+  for (tmp = ubp; tmp; tmp = tmp->next)
+    {
+      if (tmp->removed)
+	continue;
+      printf_filtered (_("Id %d in %s"), tmp->id, tmp->addr_string);
+      if (tmp->condition)
+	printf_filtered (_(" stop only if %s"), tmp->condition);
+      if (tmp->ignore_count)
+	printf_filtered (_(" ignore next %d hits"), tmp->ignore_count);
+      printf_filtered (_("\n"));
+      if (tmp->commands)
+        {
+	  struct uploaded_bpcmd *cmd;
+
+	  for (cmd = ubp->commands; cmd; cmd = cmd->next)
+	    printf_filtered (_("    %s\n"), cmd->str);
+	}
+    }
+}
+
+struct uploaded_bpcmd *this_ubpcmd = NULL;
+
+static char *
+read_autoload_breakpoints_action (void)
+{
+  char *ret = NULL;
+
+  if (this_ubpcmd)
+    {
+      ret = this_ubpcmd->str;
+      this_ubpcmd = this_ubpcmd->next;
+    }
+
+  return ret;
+}
+
+void
+merge_uploaded_autoload_breakpoints (struct uploaded_bp *ubp)
+{
+  for (; ubp; ubp = ubp->next)
+    {
+      struct breakpoint *b;
+
+      if (ubp->removed)
+	continue;
+
+      ALL_BREAKPOINTS(b)
+        {
+	  if (b->autoload_inserted)
+	    continue;
+
+	  if (b->autoload_id == ubp->id)
+	    {
+	      if (strcmp (b->addr_string, ubp->addr_string) == 0)
+		{
+		  printf_filtered (_("\
+Assuming autoload-breakpoints %d in GDB is same as target's\n\
+autoload-breakpoints %d at %s.\n"),
+				   b->number, ubp->id, ubp->addr_string);
+		  b->autoload_inserted = 1;
+		  break;
+		}
+	       else
+		{
+		  b->autoload_id = autoload_breakpoints_get_id ();
+		  printf_filtered (_("\
+Change breakpoint %d's autoload-breakpoints id to %d.\n"),
+				   b->number, b->autoload_id);
+		}
+	    }
+	}
+
+      if (!b)
+        {
+          /* Create new breakpoint.  */
+          if (!create_breakpoint (get_current_arch (),
+				  ubp->addr_string,
+				  ubp->condition, -1, 0,
+				  0, ubp->type,
+				  ubp->ignore_count,
+				  AUTO_BOOLEAN_TRUE,
+				  &bkpt_breakpoint_ops,
+				  0,
+				  ubp->enable,
+				  0, CREATE_BREAKPOINT_FLAGS_INSERTED))
+	    {
+	      printf_filtered (_("\
+Create breakpoint for autoload-breakpoint %d got error.\n"),
+			       ubp->id);
+	      continue;
+	    }
+	  b = get_breakpoint (breakpoint_count);
+	  b->autoload_id = ubp->id;
+	  b->autoload_inserted = 1;
+	  if (ubp->commands)
+	    {
+	      struct command_line *cmd_list;
+
+	      this_ubpcmd = ubp->commands;
+	      cmd_list = read_command_lines_1 (read_autoload_breakpoints_action,
+					       1, NULL, NULL);
+	      breakpoint_set_commands (b, cmd_list);
+	    }
+	  printf_filtered (_("\
+Create breakpoint %d for autoload-breakpoint %d.\n"),
+			   b->number, b->autoload_id);
+	}
+    }
+}
+
+void
+autoload_breakpoints_reset (void)
+{
+  struct breakpoint *b;
+
+  ALL_BREAKPOINTS(b)
+    b->autoload_inserted = 0;
+}
+
+void
+autoload_breakpoints_clean (void)
+{
+  struct breakpoint *b, *btmp;
+
+  ALL_BREAKPOINTS_SAFE (b, btmp)
+    {
+      if (b->autoload_id)
+        delete_breakpoint (b);
+    }
+}
+
+int
+autoload_breakpoints_number (void)
+{
+  int ret = 0;
+  struct breakpoint *b;
+
+  ALL_BREAKPOINTS(b)
+    {
+      if (b->autoload_id)
+        ret ++;
+    }
+
+  return ret;
+}
+
 void
 initialize_breakpoint_ops (void)
 {
@@ -15805,6 +16241,24 @@ In this case, if gdb is controlling the
 behaves as if always-inserted mode is on; if gdb is controlling the\n\
 inferior in all-stop mode, gdb behaves as if always-inserted mode is off."),
 			   NULL,
+			   NULL,
+			   &breakpoint_set_cmdlist,
+			   &breakpoint_show_cmdlist);
+
+  add_setshow_enum_cmd ("autoload", class_support,
+			autoload_breakpoints_enums, &autoload_breakpoints_mode,
+			_("\
+Set mode for autoload-breakpoints."), _("\
+Show mode for autoload-breakpoints."), _("\
+When this mode is \"query\" (the default mode), will query when got the\n\
+autoload-breakpoints.\n\
+When this mode is \"merge\", the autoload-breakpoints\n\
+of GDB and stub will merge together when GDB connect to stub.\n\
+When this mode is \"gdb\", the autoload-breakpoints of stub will be removed\n\
+when GDB connect to stub.\n\
+When this mode is \"stub\", the autoload-breakpoints of GDB will be removed\n\
+when GDB connect to stub."),
+			   NULL,
 			   &show_always_inserted_mode,
 			   &breakpoint_set_cmdlist,
 			   &breakpoint_show_cmdlist);
--- a/breakpoint.h
+++ b/breakpoint.h
@@ -709,6 +709,9 @@ struct breakpoint
        can sometimes be NULL for enabled GDBs as not all breakpoint
        types are tracked by the Python scripting API.  */
     struct breakpoint_object *py_bp_object;
+
+    int autoload_id;
+    int autoload_inserted;
   };
 
 /* An instance of this type is used to represent a watchpoint.  It
@@ -1059,6 +1062,25 @@ struct bpstats
     enum bp_print_how print_it;
   };
 
+struct uploaded_bpcmd
+  {
+    struct uploaded_bpcmd *next;
+    char *str;
+  };
+
+struct uploaded_bp
+  {
+    int removed;
+    struct uploaded_bp *next;
+    int id;
+    int enable;
+    char *addr_string;
+    enum bptype type;
+    int ignore_count;
+    char *condition;
+    struct uploaded_bpcmd *commands;
+  };
+
 enum inf_context
   {
     inf_starting,
@@ -1075,8 +1097,14 @@ enum breakpoint_here
     ordinary_breakpoint_here,
     permanent_breakpoint_here
   };
-\f
 
+extern const char autoload_breakpoints_query[];
+extern const char autoload_breakpoints_merge[];
+extern const char autoload_breakpoints_gdb[];
+extern const char autoload_breakpoints_stub[];
+extern const char *autoload_breakpoints_mode;
+
+\f
 /* Prototypes for breakpoint-related functions.  */
 
 extern enum breakpoint_here breakpoint_here_p (struct address_space *, 
@@ -1344,6 +1372,8 @@ extern void enable_breakpoint (struct br
 extern void breakpoint_set_commands (struct breakpoint *b, 
 				     struct command_line *commands);
 
+extern struct command_line * breakpoint_get_commands (struct breakpoint *b);
+
 extern void breakpoint_set_silent (struct breakpoint *b, int silent);
 
 extern void breakpoint_set_thread (struct breakpoint *b, int thread);
@@ -1488,4 +1518,21 @@ extern struct gdbarch *get_sal_arch (str
 
 extern void handle_solib_event (void);
 
+extern void autoload_breakpoints_reset (void);
+
+extern void autoload_breakpoints_clean (void);
+
+extern int autoload_breakpoints_number (void);
+
+extern int parse_autoload_breakpoint_definition (char *line,
+						 struct uploaded_bp **ubpp);
+
+extern int parse_autoload_breakpoint_definition_to_breakpoints (char *line);
+
+extern void clean_upload_autoload_breakpoints (void *p);
+
+extern void show_upload_autoload_breakpoints (struct uploaded_bp *ubp);
+
+extern void merge_uploaded_autoload_breakpoints (struct uploaded_bp *ubp);
+
 #endif /* !defined (BREAKPOINT_H) */
--- a/remote.c
+++ b/remote.c
@@ -214,6 +214,10 @@ static int remote_get_trace_status (stru
 static int remote_upload_tracepoints (struct uploaded_tp **utpp);
 
 static int remote_upload_trace_state_variables (struct uploaded_tsv **utsvp);
+
+static int remote_upload_autoload_breakpoints (struct uploaded_bp **ubpp);
+
+static void remote_download_autoload_breakpoints (void);
   
 static void remote_query_supported (void);
 
@@ -1284,6 +1288,7 @@ enum {
   PACKET_qXfer_fdpic,
   PACKET_QDisableRandomization,
   PACKET_QAgent,
+  PACKET_AutoloadBreakpoints,
   PACKET_MAX
 };
 
@@ -3529,6 +3534,52 @@ remote_start_remote (int from_tty, struc
      up.  */
   rs->starting_up = 0;
 
+  /* Get autoload-breakpoints from stub.  */
+  if (remote_protocol_packets[PACKET_AutoloadBreakpoints].support
+	!= PACKET_DISABLE)
+    {
+      static struct uploaded_bp *uploaded_bps = NULL;
+      struct cleanup *old_chain = make_cleanup
+					(clean_upload_autoload_breakpoints,
+					 &uploaded_bps);
+      int num;
+
+      if ((autoload_breakpoints_mode == autoload_breakpoints_stub)
+	  || (autoload_breakpoints_mode == autoload_breakpoints_query
+	      && (num = autoload_breakpoints_number ())
+	      && query (_("Remove %d autoload-breakpoints in GDB?"), num)))
+	autoload_breakpoints_clean ();
+      else
+	autoload_breakpoints_reset ();
+
+      if (autoload_breakpoints_mode != autoload_breakpoints_gdb)
+        {
+          remote_upload_autoload_breakpoints (&uploaded_bps);
+	  show_upload_autoload_breakpoints (uploaded_bps);
+	}
+      else
+        {
+	  /* Remove all the autoload-breakpoints in stub part.  */
+	  snprintf (rs->buf, rs->buf_size, "QBDP0:R");
+	  remote_send (&rs->buf, &rs->buf_size);
+	}
+
+      if (autoload_breakpoints_mode == autoload_breakpoints_query)
+        {
+	  if (uploaded_bps)
+	    {
+	      if (!query (_("Add to GDB?")))
+		clean_upload_autoload_breakpoints (&uploaded_bps);
+	    }
+	}
+
+      merge_uploaded_autoload_breakpoints (uploaded_bps);
+
+      do_cleanups (old_chain);
+
+      remote_download_autoload_breakpoints ();
+    }
+
   /* If breakpoints are global, insert them now.  */
   if (gdbarch_has_global_breakpoints (target_gdbarch)
       && breakpoints_always_inserted_mode ())
@@ -3925,6 +3976,8 @@ static struct protocol_feature remote_pr
   { "QAgent", PACKET_DISABLE, remote_supported_packet, PACKET_QAgent},
   { "tracenz", PACKET_DISABLE,
     remote_string_tracing_feature, -1 },
+  { "AutoloadBreakpoints", PACKET_DISABLE, remote_supported_packet,
+    PACKET_AutoloadBreakpoints },
 };
 
 static char *remote_support_xml;
@@ -11204,6 +11257,83 @@ remote_upload_trace_state_variables (str
   return 0;
 }
 
+static int
+remote_upload_autoload_breakpoints (struct uploaded_bp **ubpp)
+{
+  struct remote_state *rs = get_remote_state ();
+  char *p;
+
+  /* Ask for a first packet of autoload-breakpoints definition.  */
+  putpkt ("qBfP");
+  getpkt (&rs->buf, &rs->buf_size, 0);
+  p = rs->buf;
+  while (*p && *p != 'l')
+    {
+      parse_autoload_breakpoint_definition (p, ubpp);
+      /* Ask for another packet of autoload-breakpoints definition.  */
+      putpkt ("qBsP");
+      getpkt (&rs->buf, &rs->buf_size, 0);
+      p = rs->buf;
+    }
+  return 0;
+}
+
+static void
+remote_download_autoload_breakpoints (void)
+{
+  struct remote_state *rs = get_remote_state ();
+  struct breakpoint *b;
+  extern struct breakpoint *breakpoint_chain;
+
+  for (b = breakpoint_chain;  b; b = b->next)
+    {
+      if (b->autoload_id && !b->autoload_inserted)
+	{
+	  struct command_line *cmd;
+	  char *hex = alloca (strlen (b->addr_string) * 2);
+	  int end = bin2hex (b->addr_string, hex, 0);
+
+	  hex[end * 2] = '\0';
+	  snprintf (rs->buf, rs->buf_size, "QBDP%x:%c:%s:%c:%x",
+		    b->autoload_id, (b->enable_state == bp_enabled) ? 'E' : 'D',
+		    hex,
+		    (b->type == bp_hardware_breakpoint) ? 'H' : 'S',
+		    b->ignore_count);
+	  remote_send (&rs->buf, &rs->buf_size);
+
+	  if (b->cond_string)
+	    {
+	      char *p = rs->buf;
+	      int end;
+
+	      snprintf (rs->buf, rs->buf_size, "QBDP%x:O:", b->autoload_id);
+	      p += strlen (p);
+	      end = bin2hex (b->cond_string, p, strlen (b->cond_string));
+	      p[end] = '\0';
+	      remote_send (&rs->buf, &rs->buf_size);
+	    }
+
+          for (cmd = breakpoint_get_commands (b); cmd; cmd = cmd->next)
+	    {
+	      char *p = rs->buf;
+	      int end;
+
+	      snprintf (rs->buf, rs->buf_size, "QBDP%x:C:", b->autoload_id);
+	      p += strlen (p);
+	      end = bin2hex (cmd->line, p, strlen (cmd->line));
+	      p[end] = '\0';
+	      remote_send (&rs->buf, &rs->buf_size);
+	    }
+
+          b->autoload_inserted = 1;
+
+	  printf_filtered (_("\
+Download breakpoint %d to target as autoload-breakpoint %d.\n"),
+			   b->number, b->autoload_id);
+	}
+    }
+}
+
 void
 _initialize_remote (void)
 {
@@ -11537,6 +11667,9 @@ Show the maximum size of the address (in
   add_packet_config_cmd (&remote_protocol_packets[PACKET_QAgent],
 			 "QAgent", "agent", 0);
 
+  add_packet_config_cmd (&remote_protocol_packets[PACKET_AutoloadBreakpoints],
+			 "AutoloadBreakpoints", "autoload-breakpoints", 0);
+
   /* Keep the old ``set remote Z-packet ...'' working.  Each individual
      Z sub-packet has its own set and show commands, but users may
      have sets to this variable in their .gdbinit files (or in their

[-- Attachment #3: autoload-breakpoints-doc.txt --]
[-- Type: text/plain, Size: 4910 bytes --]

---
 doc/gdb.texinfo |  103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 103 insertions(+)

--- a/doc/gdb.texinfo
+++ b/doc/gdb.texinfo
@@ -3773,6 +3773,34 @@ not support breakpoint condition evaluat
 to evaluating all these conditions on the host's side.
 @end table
 
+Prior to @value{GDBN} connects to remote stub, some breakpoints might
+have been already set in target, either by a prior @value{GDBN} session or
+by the program itself through some special system API.  When @value{GDBN}
+connects to target, it should handle these existing breakpoints from
+remote stub.  We call these breakpoints @dfn{auotload-breakpoints}.
+
+This feature can be controlled via the following commands:
+
+@kindex set breakpoint autoload
+@kindex show breakpoint autoload
+@table @code
+@item set breakpoint autoload query
+If this option is @samp{query} (the default), @value{GDBN} will query to user
+how to handle the autoload-breakpoints when @value{GDBN} connect to the stub.
+
+@item set breakpoint autoload merge
+If this option is @samp{merge}, the autoload-breakpoints of both @value{GDBN}
+and of the stub will be kept.
+
+@item set breakpoint autoload gdb
+If this option is @samp{gdb}, the autoload-breakpoints of stub will be removed
+when @value{GDBN} connects to stub.
+
+@item set breakpoint autoload stub
+If this option is @samp{stub}, the autoload-breakpoints of GDB will be removed
+when @value{GDBN} connects to stub.
+@end table
+
 
 @cindex negative breakpoint numbers
 @cindex internal @value{GDBN} breakpoints
@@ -34333,6 +34361,7 @@ Show the current setting of the target w
 * Memory Map Format::
 * Thread List Format::
 * Traceframe Info Format::
+* Autoload-breakpoints Format::
 @end menu
 
 @node Overview
@@ -38936,6 +38965,80 @@ The formal DTD for the traceframe info f
                         length  CDATA   #REQUIRED>
 @end smallexample
 
+@node Autoload-breakpoints Format
+@section Autoload-breakpoints Format
+@cindex autoload-breakpoints format
+
+@table @samp
+@item qBfP
+@itemx qBsP
+These packets request data in autoload-breakpoints base format
+about autoload-breakpoints from the stub.
+@value{GDBN} sends @code{qBfP} to get the first piece
+of data, and multiple @code{qTsP} to get additional pieces.
+
+@item @samp{QBDP}@var{autoload-breakpoints base format}
+@value{GDBN} and the stub use this packet to control
+the autoload-breakpoints in the remote.  The stub will translate
+this packet through ReportAsync Packets.
+@end table
+
+Autoload-breakpoints base format describes the operation of
+the autoload-breakpoints in @value{GDBN} and the stub.
+
+@table @samp
+
+@item @var{id}@samp{:}@var{command}@samp{:}@var{addr_string}@samp{:}@var{type}@samp{:}@var{ignore_num}
+@table @samp
+@item @var{id}
+This is the id in hex string format of this command want to control.
+this command wants to control.
+0 means all autoload-breakpoints.
+@item @var{command}
+This is the command character, either @samp{E} (for ``enable'') or
+@samp{D} (for ``disable'').
+If the autoload-breakpoint @var{id} does not exist, create one and
+enable or disable it.  @value{GDBN} will create this breakpoint as
+it have been created in the target.  So when the target creates the
+breakpoint, it needs to insert this breakpoint by itself.
+If the autoload-breakpoint @var{id} does exist, the following items
+will be ignored, and the autoload-breakpoint will be enabled or
+disabled as specified by @var{command}.
+@item @var{addr_string}
+This is the address of an autoload-breakpoint to create, encoded
+as a hex string.
+@item @var{type}
+This is the type of the autoload-breakpoint to create, either
+@samp{H} (for ``hardware'') or @samp{S} (for ``software'').
+@item @var{ignore_num}
+This is the ignore count of the autoload-breakpoint to create,
+encoded as a hex string.
+@end table
+
+@item @var{id}@samp{:}@samp{R}
+This is the remove packet.
+@var{id} is the number of the autoload-breakpoint that this command
+wants to remove, encoded as a hex string.
+0 means all autoload-breakpoints.
+When @value{GDBN} get this packet, it will delete this breakpoint
+as it have been removed in the target.  So when the target send
+this packet, it needs to remove these breakpoints in local part by itself.
+
+@item @var{id}@samp{:}@samp{C}@samp{:}@var{cmd_str}
+This packet adds commands in @var{cmd_list} to the command list
+of the autoload-breakpoint whose number is @var{id}.
+If @var{cmd_str} is empty, the command list will be emptied.
+@var{cmd_str} is encoded as hex string.
+
+@item @var{id}@samp{:}@samp{O}@samp{:}@var{condition_str}
+This packet sets the condition of the autoload-breakpoint @var{id} to
+be as specified by @var{condition_str}.
+If @var{condition_str} is empty, the autoload-breakpoint becomes
+unconditional.
+@var{condition_str} is encoded as hex string.
+
+@end table
+
 @include agentexpr.texi
 
 @node Target Descriptions

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Autoload-breakpoints without report-async
  2012-05-03 16:37 [PATCH] Autoload-breakpoints without report-async Hui Zhu
@ 2012-05-03 17:03 ` Eli Zaretskii
  2012-05-04  1:00   ` Hui Zhu
  2012-05-15 11:29 ` Hui Zhu
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2012-05-03 17:03 UTC (permalink / raw)
  To: Hui Zhu; +Cc: gdb-patches, Yao_Qi, stan_shebs

> Date: Fri, 4 May 2012 00:37:08 +0800
> From: Hui Zhu <hui_zhu@mentor.com>
> CC: Yao Qi <Yao_Qi@mentor.com>, Stan Shebs <stan_shebs@mentor.com>, Eli
>  Zaretskii <eliz@gnu.org>
> 
> According to the mail form Yao.  I thought make the autoload-breakpoints and report-async function together make it too hard to review.  So I move the function that depend on the report-async to be a series of separate patches after report-async.
> Then the other patches of autoload-breakpoints can be reveiw separate from report-async.

Is the documentation part here any different from the last time I
reviewed it?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Autoload-breakpoints without report-async
  2012-05-03 17:03 ` Eli Zaretskii
@ 2012-05-04  1:00   ` Hui Zhu
  2012-05-04  7:02     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Hui Zhu @ 2012-05-04  1:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches, Yao_Qi, stan_shebs

[-- Attachment #1: Type: text/plain, Size: 760 bytes --]

On 05/04/12 01:02, Eli Zaretskii wrote:
>> Date: Fri, 4 May 2012 00:37:08 +0800
>> From: Hui Zhu<hui_zhu@mentor.com>
>> CC: Yao Qi<Yao_Qi@mentor.com>, Stan Shebs<stan_shebs@mentor.com>, Eli
>>   Zaretskii<eliz@gnu.org>
>>
>> According to the mail form Yao.  I thought make the autoload-breakpoints and report-async function together make it too hard to review.  So I move the function that depend on the report-async to be a series of separate patches after report-async.
>> Then the other patches of autoload-breakpoints can be reveiw separate from report-async.
>
> Is the documentation part here any different from the last time I
> reviewed it?

Oops, I post the wrong version.  The attachment is the right version.  Please help me review it.

Thanks,
Hui

[-- Attachment #2: autoload-breakpoints-doc.txt --]
[-- Type: text/plain, Size: 4721 bytes --]

---
 doc/gdb.texinfo |  100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 100 insertions(+)

--- a/doc/gdb.texinfo
+++ b/doc/gdb.texinfo
@@ -3773,6 +3773,34 @@ not support breakpoint condition evaluat
 to evaluating all these conditions on the host's side.
 @end table
 
+Prior to @value{GDBN} connects to remote stub, some breakpoints might
+have been already set in target, either by a prior @value{GDBN} session or
+by the program itself through some special system API.  When @value{GDBN}
+connects to target, it should handle these existing breakpoints from
+remote stub.  We call these breakpoints @dfn{auotload-breakpoints}.
+
+This feature can be controlled via the following commands:
+
+@kindex set breakpoint autoload
+@kindex show breakpoint autoload
+@table @code
+@item set breakpoint autoload query
+If this option is @samp{query} (the default), @value{GDBN} will query to user
+how to handle the autoload-breakpoints when @value{GDBN} connect to the stub.
+
+@item set breakpoint autoload merge
+If this option is @samp{merge}, the autoload-breakpoints of both @value{GDBN}
+and of the stub will be kept.
+
+@item set breakpoint autoload gdb
+If this option is @samp{gdb}, the autoload-breakpoints of stub will be removed
+when @value{GDBN} connects to stub.
+
+@item set breakpoint autoload stub
+If this option is @samp{stub}, the autoload-breakpoints of GDB will be removed
+when @value{GDBN} connects to stub.
+@end table
+
 
 @cindex negative breakpoint numbers
 @cindex internal @value{GDBN} breakpoints
@@ -34333,6 +34361,7 @@ Show the current setting of the target w
 * Memory Map Format::
 * Thread List Format::
 * Traceframe Info Format::
+* Autoload-breakpoints Format::
 @end menu
 
 @node Overview
@@ -38936,6 +38965,77 @@ The formal DTD for the traceframe info f
                         length  CDATA   #REQUIRED>
 @end smallexample
 
+@node Autoload-breakpoints Format
+@section Autoload-breakpoints Format
+@cindex autoload-breakpoints format
+
+@table @samp
+@item qBfP
+@itemx qBsP
+These packets request data in autoload-breakpoints base format
+about autoload-breakpoints from the stub.
+@value{GDBN} sends @code{qBfP} to get the first piece
+of data, and multiple @code{qTsP} to get additional pieces.
+
+@item @samp{QBDP}@var{autoload-breakpoints base format}
+@value{GDBN} use this packet to control the autoload-breakpoints in the remote.
+@end table
+
+Autoload-breakpoints base format describes the operation of
+the autoload-breakpoints in @value{GDBN} and the stub.
+
+@table @samp
+
+@item @var{id}@samp{:}@var{command}@samp{:}@var{addr_string}@samp{:}@var{type}@samp{:}@var{ignore_num}
+@table @samp
+@item @var{id}
+This is the id in hex string format of this command want to control.
+this command wants to control.
+0 means all autoload-breakpoints.
+@item @var{command}
+This is the command character, either @samp{E} (for ``enable'') or
+@samp{D} (for ``disable'').
+If the autoload-breakpoint @var{id} does not exist, create one and
+enable or disable it.  @value{GDBN} will create this breakpoint as
+it have been created in the target.  So when the target creates the
+breakpoint, it needs to insert this breakpoint by itself.
+If the autoload-breakpoint @var{id} does exist, the following items
+will be ignored, and the autoload-breakpoint will be enabled or
+disabled as specified by @var{command}.
+@item @var{addr_string}
+This is the address of an autoload-breakpoint to create, encoded
+as a hex string.
+@item @var{type}
+This is the type of the autoload-breakpoint to create, either
+@samp{H} (for ``hardware'') or @samp{S} (for ``software'').
+@item @var{ignore_num}
+This is the ignore count of the autoload-breakpoint to create,
+encoded as a hex string.
+@end table
+
+@item @var{id}@samp{:}@samp{R}
+This is the remove packet.
+@var{id} is the number of the autoload-breakpoint that this command
+wants to remove, encoded as a hex string.
+0 means all autoload-breakpoints.
+When @value{GDBN} or the target get this packet, it will delete
+the autoload-breakpoint @var{id}.
+
+@item @var{id}@samp{:}@samp{C}@samp{:}@var{cmd_str}
+This packet adds commands in @var{cmd_list} to the command list
+of the autoload-breakpoint whose number is @var{id}.
+If @var{cmd_str} is empty, the command list will be emptied.
+@var{cmd_str} is encoded as hex string.
+
+@item @var{id}@samp{:}@samp{O}@samp{:}@var{condition_str}
+This packet sets the condition of the autoload-breakpoint @var{id} to
+be as specified by @var{condition_str}.
+If @var{condition_str} is empty, the autoload-breakpoint becomes
+unconditional.
+@var{condition_str} is encoded as hex string.
+
+@end table
+
 @include agentexpr.texi
 
 @node Target Descriptions

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Autoload-breakpoints without report-async
  2012-05-04  1:00   ` Hui Zhu
@ 2012-05-04  7:02     ` Eli Zaretskii
  2012-05-06  1:53       ` Hui Zhu
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2012-05-04  7:02 UTC (permalink / raw)
  To: Hui Zhu; +Cc: gdb-patches, Yao_Qi, stan_shebs

> Date: Fri, 4 May 2012 09:00:30 +0800
> From: Hui Zhu <hui_zhu@mentor.com>
> CC: <gdb-patches@sourceware.org>, <Yao_Qi@mentor.com>, <stan_shebs@mentor.com>
> 
> Oops, I post the wrong version.  The attachment is the right version.  Please help me review it.
> +@item set breakpoint autoload query
> +If this option is @samp{query} (the default), @value{GDBN} will query to user
                                                                   ^^^^^^^^^^^^^
"query the user"

> +how to handle the autoload-breakpoints when @value{GDBN} connect to the stub.
                                                            ^^^^^^^
"connects"

> +@item set breakpoint autoload stub
> +If this option is @samp{stub}, the autoload-breakpoints of GDB will be removed
                                                              ^^^
"@value{GDBN}"

> +@item @samp{QBDP}@var{autoload-breakpoints base format}
> +@value{GDBN} use this packet to control the autoload-breakpoints in the remote.
                ^^^
"uses"

> +@table @samp
> +
> +@item @var{id}@samp{:}@var{command}@samp{:}@var{addr_string}@samp{:}@var{type}@samp{:}@var{ignore_num}

The whole table uses @samp as the default typeface, so you don't need
@samp in the @item line.  Every piece of text there that doesn't have
an explicit markup will be typeset as @samp automatically.

> +@item @var{id}
> +This is the id in hex string format of this command want to control.
> +this command wants to control.

 This is the id in hex string format of the breakpoint to which to
 apply this command.

> +                       @value{GDBN} will create this breakpoint as
> +it have been created in the target.  So when the target creates the
> +breakpoint, it needs to insert this breakpoint by itself.

  @value{GDBN} will assume the breakpoint already exists and is
  inserted in the remote, so the target needs to insert the breakpoint
  when it creates it.

> +When @value{GDBN} or the target get this packet, it will delete
> +the autoload-breakpoint @var{id}.                ^^^^^^^^^^^^^^

"they will delete"

OK with these changes.

Thanks.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Autoload-breakpoints without report-async
  2012-05-04  7:02     ` Eli Zaretskii
@ 2012-05-06  1:53       ` Hui Zhu
  2012-05-07 19:40         ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Hui Zhu @ 2012-05-06  1:53 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches, Yao_Qi, stan_shebs

[-- Attachment #1: Type: text/plain, Size: 2491 bytes --]

On 05/04/12 14:59, Eli Zaretskii wrote:
>> Date: Fri, 4 May 2012 09:00:30 +0800
>> From: Hui Zhu<hui_zhu@mentor.com>
>> CC:<gdb-patches@sourceware.org>,<Yao_Qi@mentor.com>,<stan_shebs@mentor.com>
>>
>> Oops, I post the wrong version.  The attachment is the right version.  Please help me review it.
>> +@item set breakpoint autoload query
>> +If this option is @samp{query} (the default), @value{GDBN} will query to user
>                                                                     ^^^^^^^^^^^^^
> "query the user"
>
>> +how to handle the autoload-breakpoints when @value{GDBN} connect to the stub.
>                                                              ^^^^^^^
> "connects"
>
>> +@item set breakpoint autoload stub
>> +If this option is @samp{stub}, the autoload-breakpoints of GDB will be removed
>                                                                ^^^
> "@value{GDBN}"
>
>> +@item @samp{QBDP}@var{autoload-breakpoints base format}
>> +@value{GDBN} use this packet to control the autoload-breakpoints in the remote.
>                  ^^^
> "uses"
>
>> +@table @samp
>> +
>> +@item @var{id}@samp{:}@var{command}@samp{:}@var{addr_string}@samp{:}@var{type}@samp{:}@var{ignore_num}
>
> The whole table uses @samp as the default typeface, so you don't need
> @samp in the @item line.  Every piece of text there that doesn't have
> an explicit markup will be typeset as @samp automatically.
>
>> +@item @var{id}
>> +This is the id in hex string format of this command want to control.
>> +this command wants to control.
>
>   This is the id in hex string format of the breakpoint to which to
>   apply this command.
>
>> +                       @value{GDBN} will create this breakpoint as
>> +it have been created in the target.  So when the target creates the
>> +breakpoint, it needs to insert this breakpoint by itself.
>
>    @value{GDBN} will assume the breakpoint already exists and is
>    inserted in the remote, so the target needs to insert the breakpoint
>    when it creates it.
>
>> +When @value{GDBN} or the target get this packet, it will delete
>> +the autoload-breakpoint @var{id}.                ^^^^^^^^^^^^^^
>
> "they will delete"
>
> OK with these changes.
>
> Thanks.

Hi Eli,

Thanks for your review.  This is the new patch that is updated by your commnets.

Best,
Hui

2012-05-04  Hui Zhu  <hui_zhu@mentor.com>

	* gdb.texinfo (Setting Breakpoints): Add set breakpoint autoload.
	(Remote Serial Protocol): Add Autoload-breakpoints Format.

[-- Attachment #2: autoload-breakpoints-doc.txt --]
[-- Type: text/plain, Size: 4618 bytes --]

---
 doc/gdb.texinfo |  100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 100 insertions(+)

--- a/doc/gdb.texinfo
+++ b/doc/gdb.texinfo
@@ -3773,6 +3773,34 @@ not support breakpoint condition evaluat
 to evaluating all these conditions on the host's side.
 @end table
 
+Prior to @value{GDBN} connects to remote stub, some breakpoints might
+have been already set in target, either by a prior @value{GDBN} session or
+by the program itself through some special system API.  When @value{GDBN}
+connects to target, it should handle these existing breakpoints from
+remote stub.  We call these breakpoints @dfn{auotload-breakpoints}.
+
+This feature can be controlled via the following commands:
+
+@kindex set breakpoint autoload
+@kindex show breakpoint autoload
+@table @code
+@item set breakpoint autoload query
+If this option is @samp{query} (the default), @value{GDBN} will query the user
+how to handle the autoload-breakpoints when @value{GDBN} connects to the stub.
+
+@item set breakpoint autoload merge
+If this option is @samp{merge}, the autoload-breakpoints of both @value{GDBN}
+and of the stub will be kept.
+
+@item set breakpoint autoload gdb
+If this option is @samp{gdb}, the autoload-breakpoints of stub will be removed
+when @value{GDBN} connects to stub.
+
+@item set breakpoint autoload stub
+If this option is @samp{stub}, the autoload-breakpoints of @value{GDBN} will
+be removed when @value{GDBN} connects to stub.
+@end table
+
 
 @cindex negative breakpoint numbers
 @cindex internal @value{GDBN} breakpoints
@@ -34333,6 +34361,7 @@ Show the current setting of the target w
 * Memory Map Format::
 * Thread List Format::
 * Traceframe Info Format::
+* Autoload-breakpoints Format::
 @end menu
 
 @node Overview
@@ -38936,6 +38965,77 @@ The formal DTD for the traceframe info f
                         length  CDATA   #REQUIRED>
 @end smallexample
 
+@node Autoload-breakpoints Format
+@section Autoload-breakpoints Format
+@cindex autoload-breakpoints format
+
+@table @samp
+@item qBfP
+@itemx qBsP
+These packets request data in autoload-breakpoints base format
+about autoload-breakpoints from the stub.
+@value{GDBN} sends @code{qBfP} to get the first piece
+of data, and multiple @code{qTsP} to get additional pieces.
+
+@item @samp{QBDP}@var{autoload-breakpoints base format}
+@value{GDBN} uses this packet to control the autoload-breakpoints in the remote.
+@end table
+
+Autoload-breakpoints base format describes the operation of
+the autoload-breakpoints in @value{GDBN} and the stub.
+
+@table @samp
+
+@item @var{id}:@var{command}:@var{addr_string}:@var{type}:@var{ignore_num}
+@table @samp
+@item @var{id}
+This is the id in hex string format of the breakpoint to which to
+apply this command.
+0 means all autoload-breakpoints.
+@item @var{command}
+This is the command character, either @samp{E} (for ``enable'') or
+@samp{D} (for ``disable'').
+If the autoload-breakpoint @var{id} does not exist, create one and
+enable or disable it.  @value{GDBN} will assume the breakpoint already
+exists and is inserted in the remote, so the target needs to insert
+the breakpoint when it creates it.
+If the autoload-breakpoint @var{id} does exist, the following items
+will be ignored, and the autoload-breakpoint will be enabled or
+disabled as specified by @var{command}.
+@item @var{addr_string}
+This is the address of an autoload-breakpoint to create, encoded
+as a hex string.
+@item @var{type}
+This is the type of the autoload-breakpoint to create, either
+@samp{H} (for ``hardware'') or @samp{S} (for ``software'').
+@item @var{ignore_num}
+This is the ignore count of the autoload-breakpoint to create,
+encoded as a hex string.
+@end table
+
+@item @var{id}:R
+This is the remove packet.
+@var{id} is the number of the autoload-breakpoint that this command
+wants to remove, encoded as a hex string.
+0 means all autoload-breakpoints.
+When @value{GDBN} or the target get this packet, they will delete
+the autoload-breakpoint @var{id}.
+
+@item @var{id}:C:@var{cmd_str}
+This packet adds commands in @var{cmd_list} to the command list
+of the autoload-breakpoint whose number is @var{id}.
+If @var{cmd_str} is empty, the command list will be emptied.
+@var{cmd_str} is encoded as hex string.
+
+@item @var{id}:O:@var{condition_str}
+This packet sets the condition of the autoload-breakpoint @var{id} to
+be as specified by @var{condition_str}.
+If @var{condition_str} is empty, the autoload-breakpoint becomes
+unconditional.
+@var{condition_str} is encoded as hex string.
+
+@end table
+
 @include agentexpr.texi
 
 @node Target Descriptions

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Autoload-breakpoints without report-async
  2012-05-06  1:53       ` Hui Zhu
@ 2012-05-07 19:40         ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2012-05-07 19:40 UTC (permalink / raw)
  To: Hui Zhu; +Cc: gdb-patches, Yao_Qi, stan_shebs

> Date: Sun, 6 May 2012 09:52:39 +0800
> From: Hui Zhu <hui_zhu@mentor.com>
> CC: <gdb-patches@sourceware.org>, <Yao_Qi@mentor.com>, <stan_shebs@mentor.com>
> 
> Thanks for your review.  This is the new patch that is updated by your commnets.

OK.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Autoload-breakpoints without report-async
  2012-05-03 16:37 [PATCH] Autoload-breakpoints without report-async Hui Zhu
  2012-05-03 17:03 ` Eli Zaretskii
@ 2012-05-15 11:29 ` Hui Zhu
  1 sibling, 0 replies; 7+ messages in thread
From: Hui Zhu @ 2012-05-15 11:29 UTC (permalink / raw)
  To: Hui Zhu; +Cc: gdb-patches, Yao Qi, Stan Shebs, Eli Zaretskii

Ping.

Thanks,
Hui

On Fri, May 4, 2012 at 12:37 AM, Hui Zhu <hui_zhu@mentor.com> wrote:
> Hi guys,
>
> According to the mail form Yao.  I thought make the autoload-breakpoints and
> report-async function together make it too hard to review.  So I move the
> function that depend on the report-async to be a series of separate patches
> after report-async.
> Then the other patches of autoload-breakpoints can be reveiw separate from
> report-async.
>
> Thanks,
> Hui
>
> 2012-05-04  Hui Zhu  <hui_zhu@mentor.com>
>
>        * breakpoint.c (hex2bin, unpack_varlen_hex): New extern.
>        (autoload_breakpoints_query, autoload_breakpoints_merge,
>        autoload_breakpoints_gdb, autoload_breakpoints_stub,
>        autoload_breakpoints_enums, this_ubpcmd): New variable.
>        (breakpoint_get_commands): New function.
>        (print_one_breakpoint): Add out for b->autoload_id.
>        (init_raw_breakpoint_without_location): Add init for autoload_id
>        and autoload_inserted.
>        (autoload_breakpoints_get_id, uploaded_bp_commands_clean,
>        uploaded_bp_commands_add, handle_autoload_breakpoint_cmd,
>        parse_autoload_breakpoint_definition,
>        handle_autoload_breakpoint_cmd_to_breakpoints,
>        parse_autoload_breakpoint_definition_to_breakpoints,
>        clean_upload_autoload_breakpoints,
>        show_upload_autoload_breakpoints,
>        read_autoload_breakpoints_action,
>        merge_uploaded_autoload_breakpoints, autoload_breakpoints_reset,
>        autoload_breakpoints_clean,
>        autoload_breakpoints_number): New function.
>        (initialize_breakpoint_ops): add command "autoload".
>        * breakpoint.h (breakpoint): Add autoload_id and autoload_inserted.
>        (uploaded_bpcmd, uploaded_bp): New struct.
>        (autoload_breakpoints_query, autoload_breakpoints_merge,
>        autoload_breakpoints_gdb, autoload_breakpoints_stub,
>        autoload_breakpoints_mode, breakpoint_get_commands,
>        autoload_breakpoints_reset, autoload_breakpoints_clean,
>        autoload_breakpoints_number, parse_autoload_breakpoint_definition,
>        parse_autoload_breakpoint_definition_to_breakpoints,
>        clean_upload_autoload_breakpoints, show_upload_autoload_breakpoints,
>        merge_uploaded_autoload_breakpoints): New extern.
>        * remote.c (PACKET_AutoloadBreakpoints): New enum.
>        (remote_start_remote): Check PACKET_AutoloadBreakpoints,
>        if need call autoload-breakpoints functions.
>        (remote_pr): Add PACKET_AutoloadBreakpoints.
>        (remote_reportasync_handler): Add handle for "QBDP".
>        (remote_upload_autoload_breakpoints,
>        remote_download_autoload_breakpoints): New functions.
>
> 2012-05-04  Hui Zhu  <hui_zhu@mentor.com>
>
>        * gdb.texinfo (Setting Breakpoints): Add set breakpoint autoload.
>        (Remote Serial Protocol): Add Autoload-breakpoints Format.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-05-15 11:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-03 16:37 [PATCH] Autoload-breakpoints without report-async Hui Zhu
2012-05-03 17:03 ` Eli Zaretskii
2012-05-04  1:00   ` Hui Zhu
2012-05-04  7:02     ` Eli Zaretskii
2012-05-06  1:53       ` Hui Zhu
2012-05-07 19:40         ` Eli Zaretskii
2012-05-15 11:29 ` Hui Zhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox