Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hui Zhu <hui_zhu@mentor.com>
To: <gdb-patches@sourceware.org>
Cc: <lgustavo@codesourcery.com>, Pedro Alves <palves@redhat.com>
Subject: [PATCH] Support targets that know how to continue over breakpoints[3/4] -- gdbserver
Date: Sat, 02 Mar 2013 16:13:00 -0000	[thread overview]
Message-ID: <51322515.60309@mentor.com> (raw)
In-Reply-To: <513224AF.6030603@mentor.com>

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

Hello,

This patch add a new option "--cob" to gdbserver. When gdbserver called with this option, it will open support of continue over breakpoints.
Then we can use testsuite test the function of continue over breakpoints.

To support this function, I add new function step_over_breakpoints to let the thread that is stop by breakpoints before continue all theads.  It is not very fast.  But I think for test is OK.  Please give me more comments about it.

Thanks,
Hui

2013-03-03   Hui Zhu  <hui_zhu@mentor.com>

	* server.c (use_cob): New.
	(handle_query): Check use_cob.
	(step_over_breakpoints): New.
	(handle_v_cont): Check use_cob.  If need, handle continue over
	breakpoints.
	(gdbserver_usage): Add "--cob".
	(main): Ditto.

[-- Attachment #2: remote-cob-server.txt --]
[-- Type: text/plain, Size: 3307 bytes --]

--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -53,6 +53,8 @@ static int exit_requested;
 /* --once: Exit after the first connection has closed.  */
 int run_once;
 
+int use_cob = 0;
+
 int multi_process;
 int non_stop;
 
@@ -1619,6 +1621,9 @@ handle_query (char *own_buf, int packet_
       if (target_supports_non_stop ())
 	strcat (own_buf, ";QNonStop+");
 
+      if (use_cob)
+	strcat (own_buf, ";ContinueOverBreakpoints+");
+
       if (target_supports_disable_randomization ())
 	strcat (own_buf, ";QDisableRandomization+");
 
@@ -1842,6 +1847,36 @@ handle_query (char *own_buf, int packet_
   own_buf[0] = 0;
 }
 
+static void
+step_over_breakpoints (void)
+{
+  CORE_ADDR pc;
+  struct thread_resume resume_info[2];
+  int valid_cont_thread;
+  struct target_waitstatus status;
+
+  set_desired_inferior (1);
+  pc = regcache_read_pc (get_thread_regcache (current_inferior, 1));
+  (*the_target->remove_point) ('0', pc, 1);
+
+  set_desired_inferior (0);
+  valid_cont_thread = (!ptid_equal (cont_thread, null_ptid)
+		       && !ptid_equal (cont_thread, minus_one_ptid));
+  resume_info[0].thread = current_ptid;
+  resume_info[0].kind = resume_step;
+  resume_info[0].sig = 0;
+  if (!valid_cont_thread)
+    {
+      resume_info[1].thread = minus_one_ptid;
+      resume_info[1].kind = resume_continue;
+      resume_info[1].sig = 0;
+    }
+  (*the_target->resume) (resume_info, 2);
+  mywait (minus_one_ptid, &status, 0, 1);
+
+  (*the_target->insert_point) ('0', pc, 1);
+}
+
 static void gdb_wants_all_threads_stopped (void);
 
 /* Parse vCont packets.  */
@@ -1852,6 +1887,7 @@ handle_v_cont (char *own_buf)
   int n = 0, i = 0;
   struct thread_resume *resume_info;
   struct thread_resume default_action = {{0}};
+  int is_cob = 0;
 
   /* Count the number of semicolons in the packet.  There should be one
      for every action.  */
@@ -1875,7 +1911,14 @@ handle_v_cont (char *own_buf)
       if (p[0] == 's' || p[0] == 'S')
 	resume_info[i].kind = resume_step;
       else if (p[0] == 'c' || p[0] == 'C')
-	resume_info[i].kind = resume_continue;
+        {
+	  if (use_cob && strcmp (p, "cob") == 0)
+	    {
+	      is_cob = 1;
+	      p += 2;
+	    }
+	  resume_info[i].kind = resume_continue;
+	}
       else if (p[0] == 't')
 	resume_info[i].kind = resume_stop;
       else
@@ -1939,6 +1982,9 @@ handle_v_cont (char *own_buf)
     cont_thread = minus_one_ptid;
   set_desired_inferior (0);
 
+  if (is_cob)
+    step_over_breakpoints ();
+
   if (!non_stop)
     enable_async_io ();
 
@@ -2404,7 +2450,8 @@ gdbserver_usage (FILE *stream)
 	   "  --version             Display version information and exit.\n"
 	   "  --wrapper WRAPPER --  Run WRAPPER to start new programs.\n"
 	   "  --once                Exit after the first connection has "
-								  "closed.\n");
+								  "closed.\n"
+	   "  --cob                 Support continue over breakpoints.\n");
   if (REPORT_BUGS_TO[0] && stream == stdout)
     fprintf (stream, "Report bugs to \"%s\".\n", REPORT_BUGS_TO);
 }
@@ -2630,6 +2677,8 @@ main (int argc, char *argv[])
 	disable_randomization = 0;
       else if (strcmp (*next_arg, "--once") == 0)
 	run_once = 1;
+      else if (strcmp (*next_arg, "--cob") == 0)
+	use_cob = 1;
       else
 	{
 	  fprintf (stderr, "Unknown argument: %s\n", *next_arg);

  reply	other threads:[~2013-03-02 16:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-02 16:09 [PATCH] Support targets that know how to continue over breakpoints[1/4] -- GDB Hui Zhu
2013-03-02 16:11 ` [PATCH] Support targets that know how to continue over breakpoints[2/4] -- Doc Hui Zhu
2013-03-02 16:13   ` Hui Zhu [this message]
2013-03-02 16:14     ` [PATCH] Support targets that know how to continue over breakpoints[4/4] -- testsuite Hui Zhu
2013-03-03  2:18       ` Hui Zhu
2013-03-24 14:45         ` Hui Zhu
2013-05-07  2:46           ` Hui Zhu
2013-03-12 10:05       ` Hui Zhu
2013-03-02 16:20     ` [PATCH] Support targets that know how to continue over breakpoints[3/4] -- gdbserver Eli Zaretskii
2013-03-03  2:15       ` Hui Zhu
2013-03-24 14:10         ` Hui Zhu
2013-03-25  3:46           ` Eli Zaretskii
2013-03-25  8:06             ` Hui Zhu
2013-05-07  2:45           ` Hui Zhu
2013-03-12 10:05     ` Hui Zhu
2013-03-02 16:19   ` [PATCH] Support targets that know how to continue over breakpoints[2/4] -- Doc Eli Zaretskii
2013-03-03  2:06     ` Hui Zhu
2013-03-03  3:51       ` Eli Zaretskii
2013-03-03  3:58         ` Hui Zhu
2013-03-12 10:04   ` Hui Zhu
2013-05-07  2:37     ` Hui Zhu
2013-03-12 10:04 ` [PATCH] Support targets that know how to continue over breakpoints[1/4] -- GDB Hui Zhu
2013-03-24 12:33 ` Hui Zhu
2013-05-07  2:35   ` Hui Zhu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51322515.60309@mentor.com \
    --to=hui_zhu@mentor.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lgustavo@codesourcery.com \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox