aboutsummaryrefslogtreecommitdiff
path: root/gdb/source.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2019-01-06 23:31:45 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2019-01-08 12:19:40 +0000
commit62ea19c1000856c2633a952c52269fca4143931a (patch)
tree749ed1533c58cc0d8e79eb07f5f072eedf301c2b /gdb/source.c
parenta9859e01726d085db79cff88550fdb38e2434e42 (diff)
downloadgdb-62ea19c1000856c2633a952c52269fca4143931a.zip
gdb-62ea19c1000856c2633a952c52269fca4143931a.tar.gz
gdb-62ea19c1000856c2633a952c52269fca4143931a.tar.bz2
gdb: Fix skip of `\r` before `\n` in source output
In this commit: commit 62f29fda90cf1d5a1899f57ef78452471c707fd6 Date: Tue Oct 9 22:21:05 2018 -0600 Highlight source code using GNU Source Highlight A bug was introduced such that when displaying source code from a file with lines `\r\n` GDB would print `^M` at the end of each line. This caused a regression on the test gdb.fortran/nested-funcs.exp, which happens to have `\r\n` line endings. gdb/ChangeLog: * source.c (print_source_lines_base): Fix skip of '\r' if next character is '\n'.
Diffstat (limited to 'gdb/source.c')
-rw-r--r--gdb/source.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/gdb/source.c b/gdb/source.c
index ad6c646..e77789c 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1379,12 +1379,7 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
else if (c == '\r')
{
/* Skip a \r character, but only before a \n. */
- if (iter[1] == '\n')
- {
- ++iter;
- c = '\n';
- }
- else
+ if (*iter != '\n')
printf_filtered ("^%c", c + 0100);
}
else