diff options
author | Joel Brobecker <brobecker@gnat.com> | 2005-03-08 22:03:43 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2005-03-08 22:03:43 +0000 |
commit | f67a969fd69a89d5270e4884e50724f59c9bd77f (patch) | |
tree | af825f3a45dccb2e2477a3ff24c222e76b9288fa /gdb/infcmd.c | |
parent | c0501be5509727c0361a0bf501f7dc4e799cb03c (diff) | |
download | gdb-f67a969fd69a89d5270e4884e50724f59c9bd77f.zip gdb-f67a969fd69a89d5270e4884e50724f59c9bd77f.tar.gz gdb-f67a969fd69a89d5270e4884e50724f59c9bd77f.tar.bz2 |
* infcmd.c (run_command_1): New function, extracted from
run_command.
(run_command): Replace implementation by call to run_command_1.
(start_command): Use run_command_1 to insert the temporary
breakpoint and run the program. Remove code that's no longer
needed, as already done at the proper time by run_command_1.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r-- | gdb/infcmd.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c index f04dc8a..e2db3d4 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -400,8 +400,12 @@ Start it from the beginning? ")) } } +/* Implement the "run" command. If TBREAK_AT_MAIN is set, then insert + a temporary breakpoint at the begining of the main program before + running the program. */ + static void -run_command (char *args, int from_tty) +run_command_1 (char *args, int from_tty, int tbreak_at_main) { char *exec_file; @@ -425,6 +429,10 @@ run_command (char *args, int from_tty) reopen_exec_file (); reread_symbols (); + /* Insert the temporary breakpoint if a location was specified. */ + if (tbreak_at_main) + tbreak_command (main_name (), 0); + exec_file = (char *) get_exec_file (0); /* We keep symbols from add-symbol-file, on the grounds that the @@ -487,6 +495,12 @@ run_command (char *args, int from_tty) static void +run_command (char *args, int from_tty) +{ + run_command_1 (args, from_tty, 0); +} + +static void run_no_args_command (char *args, int from_tty) { char *old_args = set_inferior_args (xstrdup ("")); @@ -506,15 +520,8 @@ start_command (char *args, int from_tty) if (!have_minimal_symbols ()) error (_("No symbol table loaded. Use the \"file\" command.")); - /* If the inferior is already running, we want to ask the user if we - should restart it or not before we insert the temporary breakpoint. - This makes sure that this command doesn't have any side effect if - the user changes its mind. */ - kill_if_already_running (from_tty); - - /* Insert the temporary breakpoint, and run... */ - tbreak_command (main_name (), 0); - run_command (args, from_tty); + /* Run the program until reaching the main procedure... */ + run_command_1 (args, from_tty, 1); } void |