OSDN Git Service

2003-01-14 Elena Zannoni <ezannoni@redhat.com>
authorezannoni <ezannoni>
Wed, 15 Jan 2003 00:48:36 +0000 (00:48 +0000)
committerezannoni <ezannoni>
Wed, 15 Jan 2003 00:48:36 +0000 (00:48 +0000)
* breakpoint.c (until_break_command): Add new argument.  Use it to
decide whether to stop only at the current frame or not.
* breakpoint.h (until_break_command): Update prototype.
  * infcmd.c (until_command): Add new argument to until_break_command
call.
(advance_command): New function.
(_initialize_infcmd): Update help string for 'until' command.
Add new 'advance' command.

gdb/ChangeLog
gdb/breakpoint.c
gdb/breakpoint.h
gdb/infcmd.c

index 947e2bb..1279eb4 100644 (file)
@@ -1,3 +1,14 @@
+2003-01-14  Elena Zannoni  <ezannoni@redhat.com>
+
+       * breakpoint.c (until_break_command): Add new argument.  Use it to
+       decide whether to stop only at the current frame or not.
+       * breakpoint.h (until_break_command): Update prototype.
+       * infcmd.c (until_command): Add new argument to until_break_command
+       call.
+       (advance_command): New function.
+       (_initialize_infcmd): Update help string for 'until' command.
+       Add new 'advance' command.
+
 2003-01-14  David Carlton  <carlton@math.stanford.edu>
 
        * linespec.c (decode_line_1): Normalize comments.
index 10c2bc6..0810085 100644 (file)
@@ -5576,7 +5576,7 @@ until_break_command_continuation (struct continuation_arg *arg)
 
 /* ARGSUSED */
 void
-until_break_command (char *arg, int from_tty)
+until_break_command (char *arg, int from_tty, int anywhere)
 {
   struct symtabs_and_lines sals;
   struct symtab_and_line sal;
@@ -5609,9 +5609,16 @@ until_break_command (char *arg, int from_tty)
 
   resolve_sal_pc (&sal);
 
-  breakpoint = 
-    set_momentary_breakpoint (sal,get_frame_id (deprecated_selected_frame),
-                             bp_until);
+  if (anywhere)
+    /* If the user told us to continue until a specified location,
+       we don't specify a frame at which we need to stop.  */
+    breakpoint = set_momentary_breakpoint (sal, null_frame_id, bp_until);
+  else
+    /* Otherwise, specify the current frame, because we want to stop only
+       at the very same frame.  */
+    breakpoint = set_momentary_breakpoint (sal,
+                                          get_frame_id (deprecated_selected_frame),
+                                          bp_until);
 
   if (!event_loop_p || !target_can_async_p ())
     old_chain = make_cleanup_delete_breakpoint (breakpoint);
@@ -5639,8 +5646,8 @@ until_break_command (char *arg, int from_tty)
       add_continuation (until_break_command_continuation, arg1);
     }
 
-  /* Keep within the current frame */
-
+  /* Keep within the current frame, or in frames called by the current
+     one.  */
   if (prev_frame)
     {
       sal = find_pc_line (get_frame_pc (prev_frame), 0);
@@ -5659,7 +5666,7 @@ until_break_command (char *arg, int from_tty)
   if (!event_loop_p || !target_can_async_p ())
     do_cleanups (old_chain);
 }
-\f
+
 #if 0
 /* These aren't used; I don't konw what they were for.  */
 /* Set a breakpoint at the catch clause for NAME.  */
index 7b359cb..ba4d278 100644 (file)
@@ -534,7 +534,7 @@ extern int deprecated_frame_in_dummy (struct frame_info *);
 
 extern int breakpoint_thread_match (CORE_ADDR, ptid_t);
 
-extern void until_break_command (char *, int);
+extern void until_break_command (char *, int, int);
 
 extern void breakpoint_re_set (void);
 
index 56bd75d..c0889ac 100644 (file)
@@ -1140,10 +1140,41 @@ until_command (char *arg, int from_tty)
     }
 
   if (arg)
-    until_break_command (arg, from_tty);
+    until_break_command (arg, from_tty, 0);
   else
     until_next_command (from_tty);
 }
+
+static void
+advance_command (char *arg, int from_tty)
+{
+  int async_exec = 0;
+
+  if (!target_has_execution)
+    error ("The program is not running.");
+
+  if (arg == NULL)
+    error_no_arg ("a location");
+
+  /* Find out whether we must run in the background.  */
+  if (arg != NULL)
+    async_exec = strip_bg_char (&arg);
+
+  /* If we must run in the background, but the target can't do it,
+     error out.  */
+  if (event_loop_p && async_exec && !target_can_async_p ())
+    error ("Asynchronous execution not supported on this target.");
+
+  /* If we are not asked to run in the bg, then prepare to run in the
+     foreground, synchronously.  */
+  if (event_loop_p && !async_exec && target_can_async_p ())
+    {
+      /* Simulate synchronous execution.  */
+      async_disable_stdin ();
+    }
+
+  until_break_command (arg, from_tty, 1);
+}
 \f
 
 /* Print the result of a function at the end of a 'finish' command. */
@@ -2130,11 +2161,15 @@ Argument N means do this N times (or till program stops for another reason).");
 
   c = add_com ("until", class_run, until_command,
               "Execute until the program reaches a source line greater than the current\n\
-or a specified line or address or function (same args as break command).\n\
-Execution will also stop upon exit from the current stack frame.");
+or a specified location (same args as break command) within the current frame.");
   set_cmd_completer (c, location_completer);
   add_com_alias ("u", "until", class_run, 1);
 
+  c = add_com ("advance", class_run, advance_command,
+              "Continue the program up to the given location (same form as args for break command).\n\
+Execution will also stop upon exit from the current stack frame.");
+  set_cmd_completer (c, location_completer);
+
   c = add_com ("jump", class_run, jump_command,
               "Continue program being debugged at specified line or address.\n\
 Give as argument either LINENUM or *ADDR, where ADDR is an expression\n\