From: Vladimir Prus <vladimir@codesourcery.com>
To: Stan Shebs <stan@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [MI tracepoints 2/9] unify breakpoint commands and tracepoint actions
Date: Tue, 23 Mar 2010 21:37:00 -0000 [thread overview]
Message-ID: <201003240037.24522.vladimir@codesourcery.com> (raw)
In-Reply-To: <4BA78648.6090202@codesourcery.com>
[-- Attachment #1: Type: Text/Plain, Size: 695 bytes --]
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
[-- Attachment #2: fix.diff --]
[-- Type: text/x-patch, Size: 3266 bytes --]
commit 3303beea79612354b2bf6795b854582f2e2f4ae5
Author: vladimir <vladimir@e7755896-6108-0410-9592-8049d3e74e28>
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 <vladimir@codesourcery.com>
+
+ Fix tracepoint saving.
+
+ * breakpoint.c (tracepoint_save_command):
+ Relay to print_command_lines.
+
2009-08-10 Pedro Alves <pedro@codesourcery.com>
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);
next prev parent reply other threads:[~2010-03-23 21:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-14 8:47 Vladimir Prus
2010-03-15 17:48 ` Stan Shebs
2010-03-15 21:00 ` Tom Tromey
2010-03-16 11:38 ` Vladimir Prus
2010-03-22 15:01 ` Stan Shebs
2010-03-23 21:37 ` Vladimir Prus [this message]
2010-03-16 0:56 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201003240037.24522.vladimir@codesourcery.com \
--to=vladimir@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=stan@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox