public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug cli/8822] log commands along with their output (make logging more flexible)
Date: Thu, 11 Aug 2022 06:26:31 +0000	[thread overview]
Message-ID: <bug-8822-4717-zOAlHBsrgF@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-8822-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=8822

--- Comment #9 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom Tromey from comment #8)
> I was going to suggest trace-commands today, but I see it's been done.
> I wonder if a new logging mode could print the prompt and the
> command instead of the "+".

Using this:
...
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 5f81db418bc..6a59607aa47 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -495,8 +495,13 @@ print_command_trace (const char *fmt, ...)
   if (!source_verbose && !trace_commands)
     return;

-  for (i=0; i < command_nest_depth; i++)
-    gdb_printf ("+");
+  if (0)
+    {
+      for (i=0; i < command_nest_depth; i++)
+       gdb_printf ("+");
+    }
+  else
+    gdb_printf ("%s", get_prompt ().c_str ());

   va_list args;

...
I get:
...
$ gdb -q -batch -ex "set trace-commands on" -ex "inferior" -ex "set prompt
(bla) " -ex "inferior"
(gdb) inferior
[Current inferior is 1 [<null>] (<noexec>)]
(gdb) set prompt (bla) 
(bla) inferior
[Current inferior is 1 [<null>] (<noexec>)]
...

Doesn't take into account annotations though, for that we need top_level_prompt
instead.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2022-08-11  6:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-8822-4717@http.sourceware.org/bugzilla/>
2022-08-10 17:18 ` tromey at sourceware dot org
2022-08-11  6:26 ` vries at gcc dot gnu.org [this message]
     [not found] <20040722184800.8822.lee@bustech.com>
2010-01-22 17:07 ` ppluzhnikov at google dot com

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=bug-8822-4717-zOAlHBsrgF@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).