diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2018-05-17 13:05:59 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2018-05-17 13:06:11 -0400 |
commit | b17992c1c02a2d8a832a887c2de23a7f3ab869f8 (patch) | |
tree | 78c68408ee759275a452fbeb5495eb708ebde406 /gdb/Makefile.in | |
parent | 58f0c71853f98afe623ab89c4362682885905ebb (diff) | |
download | gdb-b17992c1c02a2d8a832a887c2de23a7f3ab869f8.zip gdb-b17992c1c02a2d8a832a887c2de23a7f3ab869f8.tar.gz gdb-b17992c1c02a2d8a832a887c2de23a7f3ab869f8.tar.bz2 |
Make format_pieces recognize the \e escape sequence
I noticed that the printf command did not recognize the \e escape
sequence, used amongst other things to use colors:
(gdb) printf "This is \e[32mgreen\e[m!\n"
Unrecognized escape character \e in format string.
This patch makes format_pieces recognize it, which makes that command
print the expected result in glorious color.
I wrote a really simple unit test for format_pieces.
format_pieces::operator[] is unused so I removed it. I added
format_piece::operator==, which is needed to compare vectors of
format_piece.
gdb/ChangeLog:
PR cli/14975
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
unittests/format_pieces-selftests.c.
* common/format.h (format_piece) <operator==>: New.
(format_pieces) <operator[]>: Remove.
* common/format.c (format_pieces::format_pieces): Handle \e.
* unittests/format_pieces-selftests.c: New.
Diffstat (limited to 'gdb/Makefile.in')
-rw-r--r-- | gdb/Makefile.in | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 87d74a7..09a2ad2 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -418,6 +418,7 @@ SUBDIR_UNITTESTS_SRCS = \ unittests/array-view-selftests.c \ unittests/common-utils-selftests.c \ unittests/environ-selftests.c \ + unittests/format_pieces-selftests.c \ unittests/function-view-selftests.c \ unittests/lookup_name_info-selftests.c \ unittests/memory-map-selftests.c \ |