[Bug gdb/24502] New: Color control codes should not appear in logging output

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/24502] New: Color control codes should not appear in logging output

konrad.schwarz at siemens dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24502

            Bug ID: 24502
           Summary: Color control codes should not appear in logging
                    output
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: sergiodj at redhat dot com
                CC: tromey at sourceware dot org
  Target Milestone: ---

Created attachment 11759
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11759&action=edit
Example of messy backtrace. I shouldn't have to run extra commands to make
logging work (although a workaround would be appreciated :)

Upstream forward of https://bugzilla.redhat.com/show_bug.cgi?id=1704406:

Description of problem: Color control codes should not appear in logging output


Version-Release number of selected component (if applicable):
gdb-8.2.91.20190401-23.fc30


How reproducible: Always


Steps to Reproduce:
1. Open a backtrace with 'coredumpctl gdb'
2. (gdb) set logging on
3. (gdb) bt

Actual results: The logged backtrace (in gdb.txt) is all but unreadable due to
the presence of terminal color control sequences.


Expected results: Strip out the terminal control sequences before logging to
gdb.txt.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/24502] Color control codes should not appear in logging output

konrad.schwarz at siemens dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24502

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
I don't log much but back when I was implementing this, I think
I just used 'less -R' to view the logs.

However, it seems like a reasonable request to me.
I guess we'd need a new subclass of stdio_file that filters
the escapes.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/24502] Color control codes should not appear in logging output

konrad.schwarz at siemens dot com
In reply to this post by konrad.schwarz at siemens dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24502

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
I wrote a patch for this, but I didn't write a test yet.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/24502] Color control codes should not appear in logging output

konrad.schwarz at siemens dot com
In reply to this post by konrad.schwarz at siemens dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24502

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
Patch: https://sourceware.org/ml/gdb-patches/2019-06/msg00150.html

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/24502] Color control codes should not appear in logging output

konrad.schwarz at siemens dot com
In reply to this post by konrad.schwarz at siemens dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24502

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <[hidden email]>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0735b091aba72d4b35aebb671a02c5cb4a837fe9

commit 0735b091aba72d4b35aebb671a02c5cb4a837fe9
Author: Tom Tromey <[hidden email]>
Date:   Tue Apr 30 11:17:15 2019 -0600

    Do not emit style escape sequences to log file

    PR gdb/24502 requests that the "set logging" log file not contain
    style escape sequences emitted by gdb.

    This seemed like a reasonable request to me, so this patch implements
    filtering for the log file.

    This also updates a comment in ui-style.h that I noticed while writing
    the patch.

    Tested on x86-64 Fedora 29.

    gdb/ChangeLog
    2019-06-14  Tom Tromey  <[hidden email]>

        PR gdb/24502:
        * ui-style.h (skip_ansi_escape): Update comment.
        * ui-file.h (class no_terminal_escape_file): New class.
        * ui-file.c (no_terminal_escape_file::write)
        (no_terminal_escape_file::puts): New methods.
        * cli/cli-logging.c (handle_redirections): Use
        no_terminal_escape_file.

    gdb/testsuite/ChangeLog
    2019-06-14  Tom Tromey  <[hidden email]>

        PR gdb/24502:
        * gdb.base/style-logging.exp: New file.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/24502] Color control codes should not appear in logging output

konrad.schwarz at siemens dot com
In reply to this post by konrad.schwarz at siemens dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24502

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |9.1

--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
Fixed.

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