Add support for --start option in -exec-run GDB/MI command.
gdb/ChangeLog: * mi/mi-main.c (run_one_inferior): Add function description. Make ARG a pointer to an integer whose value determines whether we should "run" or "start" the program. (mi_cmd_exec_run): Add handling of the "--start" option. Reject all other command-line options. * NEWS: Add entry for "-exec-run"'s new "--start" option. gdb/doc/ChangeLog: * gdb.texinfo (GDB/MI Program Execution): Document "-exec-run"'s new "--start" option. gdb/testsuite/ChangeLog: * gdb.mi/mi-start.c, gdb.mi/mi-start.exp: New files.
This commit is contained in:
parent
f48ff2a7d3
commit
5713b9b5c1
@ -1,3 +1,12 @@
|
||||
2013-10-04 Joel Brobecker <brobecker@adacore.com>
|
||||
|
||||
* mi/mi-main.c (run_one_inferior): Add function description.
|
||||
Make ARG a pointer to an integer whose value determines whether
|
||||
we should "run" or "start" the program.
|
||||
(mi_cmd_exec_run): Add handling of the "--start" option.
|
||||
Reject all other command-line options.
|
||||
* NEWS: Add entry for "-exec-run"'s new "--start" option.
|
||||
|
||||
2013-10-04 Yao Qi <yao@codesourcery.com>
|
||||
|
||||
* remote-notif.h (REMOTE_NOTIF_ID): New enum.
|
||||
|
5
gdb/NEWS
5
gdb/NEWS
@ -137,6 +137,11 @@ show range-stepping
|
||||
-stack-list-variables now accept an option "--skip-unavailable".
|
||||
When used, only the available locals or arguments are displayed.
|
||||
|
||||
** The -exec-run command now accepts an optional "--start" option.
|
||||
When used, the command follows the same semantics as the "start"
|
||||
command, stopping the program's execution at the start of its
|
||||
main subprogram.
|
||||
|
||||
* New system-wide configuration scripts
|
||||
A GDB installation now provides scripts suitable for use as system-wide
|
||||
configuration scripts for the following systems:
|
||||
|
@ -1,3 +1,8 @@
|
||||
2013-10-04 Joel Brobecker <brobecker@adacore.com>
|
||||
|
||||
* gdb.texinfo (GDB/MI Program Execution): Document "-exec-run"'s
|
||||
new "--start" option.
|
||||
|
||||
2013-10-02 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* gdb.texinfo (Registers): Expand description of saved registers
|
||||
|
@ -31057,7 +31057,7 @@ fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
|
||||
@subsubheading Synopsis
|
||||
|
||||
@smallexample
|
||||
-exec-run [--all | --thread-group N]
|
||||
-exec-run [ --all | --thread-group N ] [ --start ]
|
||||
@end smallexample
|
||||
|
||||
Starts execution of the inferior from the beginning. The inferior
|
||||
@ -31065,11 +31065,17 @@ executes until either a breakpoint is encountered or the program
|
||||
exits. In the latter case the output will include an exit code, if
|
||||
the program has exited exceptionally.
|
||||
|
||||
When no option is specified, the current inferior is started. If the
|
||||
When neither the @samp{--all} nor the @samp{--thread-group} option
|
||||
is specified, the current inferior is started. If the
|
||||
@samp{--thread-group} option is specified, it should refer to a thread
|
||||
group of type @samp{process}, and that thread group will be started.
|
||||
If the @samp{--all} option is specified, then all inferiors will be started.
|
||||
|
||||
Using the @samp{--start} option instructs the debugger to stop
|
||||
the execution at the start of the inferior's main subprogram,
|
||||
following the same behavior as the @code{start} command
|
||||
(@pxref{Starting}).
|
||||
|
||||
@subsubheading @value{GDBN} Command
|
||||
|
||||
The corresponding @value{GDBN} command is @samp{run}.
|
||||
|
@ -364,9 +364,19 @@ mi_cmd_exec_interrupt (char *command, char **argv, int argc)
|
||||
}
|
||||
}
|
||||
|
||||
/* Callback for iterate_over_inferiors which starts the execution
|
||||
of the given inferior.
|
||||
|
||||
ARG is a pointer to an integer whose value, if non-zero, indicates
|
||||
that the program should be stopped when reaching the main subprogram
|
||||
(similar to what the CLI "start" command does). */
|
||||
|
||||
static int
|
||||
run_one_inferior (struct inferior *inf, void *arg)
|
||||
{
|
||||
int start_p = *(int *) arg;
|
||||
const char *run_cmd = start_p ? "start" : "run";
|
||||
|
||||
if (inf->pid != 0)
|
||||
{
|
||||
if (inf->pid != ptid_get_pid (inferior_ptid))
|
||||
@ -386,7 +396,7 @@ run_one_inferior (struct inferior *inf, void *arg)
|
||||
switch_to_thread (null_ptid);
|
||||
set_current_program_space (inf->pspace);
|
||||
}
|
||||
mi_execute_cli_command ("run", target_can_async_p (),
|
||||
mi_execute_cli_command (run_cmd, target_can_async_p (),
|
||||
target_can_async_p () ? "&" : NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -394,16 +404,54 @@ run_one_inferior (struct inferior *inf, void *arg)
|
||||
void
|
||||
mi_cmd_exec_run (char *command, char **argv, int argc)
|
||||
{
|
||||
int i;
|
||||
int start_p = 0;
|
||||
|
||||
/* Parse the command options. */
|
||||
enum opt
|
||||
{
|
||||
START_OPT,
|
||||
};
|
||||
static const struct mi_opt opts[] =
|
||||
{
|
||||
{"-start", START_OPT, 0},
|
||||
{NULL, 0, 0},
|
||||
};
|
||||
|
||||
int oind = 0;
|
||||
char *oarg;
|
||||
|
||||
while (1)
|
||||
{
|
||||
int opt = mi_getopt ("-exec-run", argc, argv, opts, &oind, &oarg);
|
||||
|
||||
if (opt < 0)
|
||||
break;
|
||||
switch ((enum opt) opt)
|
||||
{
|
||||
case START_OPT:
|
||||
start_p = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* This command does not accept any argument. Make sure the user
|
||||
did not provide any. */
|
||||
if (oind != argc)
|
||||
error (_("Invalid argument: %s"), argv[oind]);
|
||||
|
||||
if (current_context->all)
|
||||
{
|
||||
struct cleanup *back_to = save_current_space_and_thread ();
|
||||
|
||||
iterate_over_inferiors (run_one_inferior, NULL);
|
||||
iterate_over_inferiors (run_one_inferior, &start_p);
|
||||
do_cleanups (back_to);
|
||||
}
|
||||
else
|
||||
{
|
||||
mi_execute_cli_command ("run", target_can_async_p (),
|
||||
const char *run_cmd = start_p ? "start" : "run";
|
||||
|
||||
mi_execute_cli_command (run_cmd, target_can_async_p (),
|
||||
target_can_async_p () ? "&" : NULL);
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,7 @@
|
||||
2013-10-04 Joel Brobecker <brobecker@adacore.com>
|
||||
|
||||
* gdb.mi/mi-start.c, gdb.mi/mi-start.exp: New files.
|
||||
|
||||
2013-10-02 Vidya Praveen <vidyapraveen@arm.com>
|
||||
|
||||
* gdb.trace/entry-values.exp: Modify regular expression to scan for
|
||||
|
22
gdb/testsuite/gdb.mi/mi-start.c
Normal file
22
gdb/testsuite/gdb.mi/mi-start.c
Normal file
@ -0,0 +1,22 @@
|
||||
/* Copyright 2013 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
47
gdb/testsuite/gdb.mi/mi-start.exp
Normal file
47
gdb/testsuite/gdb.mi/mi-start.exp
Normal file
@ -0,0 +1,47 @@
|
||||
# Copyright 2013 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
load_lib mi-support.exp
|
||||
set MIFLAGS "-i=mi"
|
||||
|
||||
# The purpose of this testcase is to test the --start option of
|
||||
# the -exec-run command. If we cannot use the -exec-run command,
|
||||
# then there is no point in running this testcase...
|
||||
if [target_info exists use_gdb_stub] {
|
||||
untested "cannot use -exec-run command"
|
||||
return -1
|
||||
}
|
||||
|
||||
gdb_exit
|
||||
if [mi_gdb_start] {
|
||||
continue
|
||||
}
|
||||
|
||||
standard_testfile mi-start.c
|
||||
|
||||
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
untested "could not build mi-start"
|
||||
return -1
|
||||
}
|
||||
|
||||
mi_delete_breakpoints
|
||||
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||
mi_gdb_load ${binfile}
|
||||
|
||||
mi_run_cmd "--start"
|
||||
mi_expect_stop "breakpoint-hit" "main" "" ".*mi-start.c" "$decimal" \
|
||||
{ "" "disp=\"del\"" } "run to main"
|
||||
|
Loading…
x
Reference in New Issue
Block a user