public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tom Tromey <tom@tromey.com>,
	Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] gdb: make timestamped_file implement can_emit_style_escape
Date: Mon, 4 Apr 2022 17:58:25 -0400	[thread overview]
Message-ID: <58e348e8-8d76-eda8-dd70-eb4ee889b4fe@polymtl.ca> (raw)
In-Reply-To: <87czhwkczk.fsf@tromey.com>

> Simon> Making
> Simon> timestamped_file implement can_emit_style_escape (returning the value of
> Simon> the stream it wraps) fixes it.  To show that it works, modify some
> Simon> logging statements in auto-load.c to output style filenames.  You can
> Simon> see it in action by setting "set debug auto-load 1" and running a
> Simon> program.  We can incrementally add styling to other debug statements
> Simon> throughout GDB, as needed.
> 
> This looks good to me.

Thanks, will push.

> I've also wondered what it would take to style error() text.  Maybe just
> checking the styling of gdb_stdout when creating the error would be good
> enough, it's not like gdb often stores exceptions and then later reuses
> them.

Indeed.

> Another thought was to have styling always be emitted, then optionally
> strip it out just before display.  However, user 'printf's can also emit
> styles and one wouldn't want to strip those...

Or the error string could be saved in an "unrendered" form that
includes the text and its styling.  And only render it (with or without
style) when we print it.  As an exercise, we can try to think how we
would do it if different uiouts in the same GDB had different methods
of styling, and the error had to be printed on all those uiouts.  We
couldn't bake a styled string when emitting the error, we would have to
render it once for each uiout.

Simon

  reply	other threads:[~2022-04-04 21:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31 17:32 Simon Marchi
2022-04-04 16:52 ` Tom Tromey
2022-04-04 21:58   ` Simon Marchi [this message]
2022-04-04 22:02     ` Simon Marchi
2022-04-05 14:25       ` Tom Tromey
2022-04-05 14:36         ` Simon Marchi
2022-04-05 20:54           ` Tom Tromey
2022-04-05 18:28         ` Pedro Alves
2022-04-05 20:54           ` Tom Tromey

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=58e348e8-8d76-eda8-dd70-eb4ee889b4fe@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).