--- 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);