From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28594 invoked by alias); 3 Mar 2013 02:15:51 -0000 Received: (qmail 28584 invoked by uid 22791); 3 Mar 2013 02:15:50 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 03 Mar 2013 02:15:46 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1UBySn-0007Iu-Eh from Hui_Zhu@mentor.com ; Sat, 02 Mar 2013 18:15:45 -0800 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Sat, 2 Mar 2013 18:15:45 -0800 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.1.289.1; Sat, 2 Mar 2013 18:15:39 -0800 Message-ID: <5132B24D.40401@mentor.com> Date: Sun, 03 Mar 2013 02:15:00 -0000 From: Hui Zhu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20130126 Thunderbird/19.0 MIME-Version: 1.0 To: Eli Zaretskii CC: , , Subject: Re: [PATCH] Support targets that know how to continue over breakpoints[3/4] -- gdbserver References: <51322425.6090007@mentor.com> <513224AF.6030603@mentor.com> <51322515.60309@mentor.com> <831ubxvkn0.fsf@gnu.org> In-Reply-To: <831ubxvkn0.fsf@gnu.org> Content-Type: multipart/mixed; boundary="------------060709010308070409050201" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2013-03/txt/msg00065.txt.bz2 --------------060709010308070409050201 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 819 On 03/03/13 00:20, Eli Zaretskii wrote: >> Date: Sun, 3 Mar 2013 00:13:09 +0800 >> From: Hui Zhu >> CC: , Pedro Alves >> >> This patch add a new option "--cob" to gdbserver. When gdbserver called with this option, it will open support of continue over breakpoints. > > Can we have something less cryptic, like "--continue-over-breakpoints", > please? > > Thanks. > OK. Update this option to "--continue-over-breakpoints". Post a new version for that. Thanks, Hui 2013-03-03 Hui Zhu * 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 "--continue-over-breakpoints". (main): Ditto. --------------060709010308070409050201 Content-Type: text/plain; charset="us-ascii"; name="remote-cob-server.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="remote-cob-server.txt" Content-length: 3335 --- 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" + " --continue-over-breakpoints 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, "--continue-over-breakpoints") == 0) + use_cob = 1; else { fprintf (stderr, "Unknown argument: %s\n", *next_arg); --------------060709010308070409050201--