diff options
author | Tom Tromey <tromey@adacore.com> | 2019-04-09 12:52:46 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2019-04-19 13:09:58 -0600 |
commit | 014bc49bfcf15d53c65d956ed337ab3217431483 (patch) | |
tree | c04464539fcfb59bd8d227c65a282e6b3b3333d6 /gdb/source.c | |
parent | bf9a7cea9c88de232f07151614562f81b52630a0 (diff) | |
download | binutils-014bc49bfcf15d53c65d956ed337ab3217431483.zip binutils-014bc49bfcf15d53c65d956ed337ab3217431483.tar.gz binutils-014bc49bfcf15d53c65d956ed337ab3217431483.tar.bz2 |
Fix "list" when control characters are seen
PR symtab/24423 points out that control characters in a source file
cause a hang in the "list" command, a regression introduced by the
styling changes.
This patch, from the PR, fixes the bug. I've included a minimal
change to the "list" test that exercises this code.
I recall that this bug was discussed on gdb-patches, and I thought
there was a patch there as well, but I was unable to find it.
2019-04-19 Ilya Yu. Malakhov <malakhov@mcst.ru>
PR symtab/24423:
* source.c (print_source_lines_base): Advance "iter" when a
control character is seen.
gdb/testsuite/ChangeLog
2019-04-19 Tom Tromey <tromey@adacore.com>
PR symtab/24423:
* gdb.base/list0.h (foo): Add a control-l character.
Diffstat (limited to 'gdb/source.c')
-rw-r--r-- | gdb/source.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/source.c b/gdb/source.c index f99215f..b61880a 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1368,7 +1368,7 @@ print_source_lines_base (struct symtab *s, int line, int stopline, char c = *iter; if (c == '\033' && skip_ansi_escape (iter, &skip_bytes)) iter += skip_bytes; - else if (c < 040 && c != '\t') + else if (c >= 0 && c < 040 && c != '\t') break; else if (c == 0177) break; @@ -1397,9 +1397,13 @@ print_source_lines_base (struct symtab *s, int line, int stopline, { xsnprintf (buf, sizeof (buf), "^%c", *iter + 0100); uiout->text (buf); + ++iter; } else if (*iter == 0177) - uiout->text ("^?"); + { + uiout->text ("^?"); + ++iter; + } } uiout->text ("\n"); } |