From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Received: (qmail 5508 invoked from network); 12 Jan 2003 21:15:42 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by 209.249.29.67 with SMTP; 12 Jan 2003 21:15:42 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h0CKlSB31863 for ; Sun, 12 Jan 2003 15:47:28 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h0CLFVa24200 for ; Sun, 12 Jan 2003 16:15:31 -0500 Received: from localhost.redhat.com (romulus-int.sfbay.redhat.com [172.16.27.46]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h0CLFUS19843 for ; Sun, 12 Jan 2003 16:15:30 -0500 Received: by localhost.redhat.com (Postfix, from userid 469) id 70BF3FF79; Sun, 12 Jan 2003 16:19:52 -0500 (EST) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15905.56312.398771.559115@localhost.redhat.com> Date: Sun, 12 Jan 2003 21:15:00 -0000 To: Michael Elizabeth Chastain Cc: drow@mvista.com, gdb-patches@sources.redhat.com Subject: Re: [RFC/RFA] New 'to' command In-Reply-To: <200301122050.h0CKoL231284@duracef.shout.net> References: <200301122050.h0CKoL231284@duracef.shout.net> X-SW-Source: 2003-01/txt/msg00477.txt.bz2 Michael Elizabeth Chastain writes: > I'm pretty much in Dan J's camp, up to the point where he doesn't > think of checking in 'help'. Although 'to' without an argument might > possibly provide some useful text. > > Michael C Aehm..., right not it doesn't.... fixed it: (gdb) b main Breakpoint 1 at 0x804852e: file /home/ezannoni/sources/src/gdb/testsuite/gdb.base/break.c, line 75. (gdb) r Starting program: /home/ezannoni/sources/native/gdb/testsuite/gdb.base/break Breakpoint 1, main (argc=1, argv=0xbffff0f4, envp=0xbffff0fc) at /home/ezannoni/sources/src/gdb/testsuite/gdb.base/break.c:75 75 if (argc == 12345) { /* an unlikely value < 2^16, in case uninited */ (gdb) to Argument required (a location). (gdb) Updated diff attached: 2003-01-12 Elena Zannoni * 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. (to_command): New function. (_initialize_infcmd): Update help string for 'until' command. Add new 'to' command. Index: breakpoint.c =================================================================== RCS file: /cvs/uberbaum/gdb/breakpoint.c,v retrieving revision 1.105 diff -u -p -r1.105 breakpoint.c --- breakpoint.c 4 Jan 2003 23:07:24 -0000 1.105 +++ breakpoint.c 12 Jan 2003 19:08:07 -0000 @@ -5576,7 +5576,7 @@ until_break_command_continuation (struct /* 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 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 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); Index: breakpoint.h =================================================================== RCS file: /cvs/uberbaum/gdb/breakpoint.h,v retrieving revision 1.16 diff -u -p -r1.16 breakpoint.h --- breakpoint.h 11 Dec 2002 22:34:47 -0000 1.16 +++ breakpoint.h 12 Jan 2003 19:08:50 -0000 @@ -534,7 +534,7 @@ extern int deprecated_frame_in_dummy (st 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: infcmd.c =================================================================== RCS file: /cvs/uberbaum/gdb/infcmd.c,v retrieving revision 1.69 diff -u -p -r1.69 infcmd.c --- infcmd.c 13 Dec 2002 16:26:02 -0000 1.69 +++ infcmd.c 12 Jan 2003 21:07:14 -0000 @@ -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 +to_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); +} /* Print the result of a function at the end of a 'finish' command. */ @@ -2130,10 +2161,14 @@ Argument N means do this N times (or til 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 ("to", class_run, to_command, + "Continue the program up to the given location (same args as 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\