From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15081 invoked by alias); 23 Mar 2010 21:37:35 -0000 Received: (qmail 15071 invoked by uid 22791); 23 Mar 2010 21:37:34 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 23 Mar 2010 21:37:30 +0000 Received: (qmail 26718 invoked from network); 23 Mar 2010 21:37:27 -0000 Received: from unknown (HELO wind.localnet) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 23 Mar 2010 21:37:27 -0000 From: Vladimir Prus To: Stan Shebs Subject: Re: [MI tracepoints 2/9] unify breakpoint commands and tracepoint actions Date: Tue, 23 Mar 2010 21:37:00 -0000 User-Agent: KMail/1.12.2 (Linux/2.6.31-20-generic-pae; KDE/4.3.2; i686; ; ) Cc: gdb-patches@sourceware.org References: <201003141147.34051.vladimir@codesourcery.com> <201003161438.27874.vladimir@codesourcery.com> <4BA78648.6090202@codesourcery.com> In-Reply-To: <4BA78648.6090202@codesourcery.com> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_USTqLfxmwwCTQZJ" Message-Id: <201003240037.24522.vladimir@codesourcery.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-03/txt/msg00801.txt.bz2 --Boundary-00=_USTqLfxmwwCTQZJ Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-length: 695 On Monday 22 March 2010 18:01:28 Stan Shebs wrote: > Vladimir Prus wrote: > > Here's a revised version, also addressing Pedro's comments. > > > Looks great, just one little thing left to fix: > > + if (strstr (c->line, "eval ") == c->line) > + error (_("The 'eval' command can only be used for tracepoints")); > > > The command is now "teval" instead of "eval". > > With that change, we should be ready to roll in all 9 patches. Thanks > again! This patch is now in. Per discussion offlist, I've fused in the attached patch, which fixes save-tracepoints, which this patch, as posted, broke. Thanks, -- Vladimir Prus CodeSourcery vladimir@codesourcery.com (650) 331-3385 x722 --Boundary-00=_USTqLfxmwwCTQZJ Content-Type: text/x-patch; charset="UTF-8"; name="fix.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="fix.diff" Content-length: 3266 commit 3303beea79612354b2bf6795b854582f2e2f4ae5 Author: vladimir Date: Mon Aug 10 18:44:43 2009 +0000 Fix tracepoint saving git-svn-id: svn+ssh://cugel//net/svn-internal/subversion/Repository/csl/gdb/branches/ericsson-tracing@258025 e7755896-6108-0410-9592-8049d3e74e28 diff --git a/ChangeLog.csl b/ChangeLog.csl index 9499c3a..99955b8 100644 --- a/ChangeLog.csl +++ b/ChangeLog.csl @@ -1,3 +1,10 @@ +2009-08-10 Vladimir Prus + + Fix tracepoint saving. + + * breakpoint.c (tracepoint_save_command): + Relay to print_command_lines. + 2009-08-10 Pedro Alves gdb/gdbserver/ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index b95df83..ab5410d 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -8666,11 +8666,10 @@ tracepoint_save_command (char *args, int from_tty) struct breakpoint *tp; int any_tp = 0; struct command_line *line; - FILE *fp; - char *i1 = " ", *i2 = " "; - char *indent, *actionline, *pathname; + char *pathname; char tmp[40]; struct cleanup *cleanup; + struct ui_file *fp; if (args == 0 || *args == 0) error (_("Argument required (file name in which to save tracepoints)")); @@ -8689,49 +8688,43 @@ tracepoint_save_command (char *args, int from_tty) pathname = tilde_expand (args); cleanup = make_cleanup (xfree, pathname); - if (!(fp = fopen (pathname, "w"))) + + fp = gdb_fopen (pathname, "w"); + if (!fp) error (_("Unable to open file '%s' for saving tracepoints (%s)"), args, safe_strerror (errno)); - make_cleanup_fclose (fp); + make_cleanup_ui_file_delete (fp); ALL_TRACEPOINTS (tp) { if (tp->addr_string) - fprintf (fp, "trace %s\n", tp->addr_string); + fprintf_unfiltered (fp, "trace %s\n", tp->addr_string); else { sprintf_vma (tmp, tp->loc->address); - fprintf (fp, "trace *0x%s\n", tmp); + fprintf_unfiltered (fp, "trace *0x%s\n", tmp); } if (tp->pass_count) - fprintf (fp, " passcount %d\n", tp->pass_count); + fprintf_unfiltered (fp, " passcount %d\n", tp->pass_count); if (tp->commands) { - fprintf (fp, " actions\n"); - indent = i1; - for (line = tp->commands; line; line = line->next) + volatile struct gdb_exception ex; + + fprintf_unfiltered (fp, " actions\n"); + + ui_out_redirect (uiout, fp); + TRY_CATCH (ex, RETURN_MASK_ERROR) { - struct cmd_list_element *cmd; + print_command_lines (uiout, tp->commands, 2); + } + ui_out_redirect (uiout, NULL); - QUIT; /* allow user to bail out with ^C */ - actionline = line->line; - while (isspace ((int) *actionline)) - actionline++; + if (ex.reason < 0) + throw_exception (ex); - fprintf (fp, "%s%s\n", indent, actionline); - if (*actionline != '#') /* skip for comment lines */ - { - cmd = lookup_cmd (&actionline, cmdlist, "", -1, 1); - if (cmd == 0) - error (_("Bad action list item: %s"), actionline); - if (cmd_cfunc_eq (cmd, while_stepping_pseudocommand)) - indent = i2; - else if (cmd_cfunc_eq (cmd, end_actions_pseudocommand)) - indent = i1; - } - } + fprintf_unfiltered (fp, " end\n"); } } do_cleanups (cleanup); --Boundary-00=_USTqLfxmwwCTQZJ--