From patchwork Mon Jan 7 12:42:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 30985 Received: (qmail 8225 invoked by alias); 7 Jan 2019 12:42:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 7863 invoked by uid 89); 7 Jan 2019 12:42:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm1-f53.google.com Received: from mail-wm1-f53.google.com (HELO mail-wm1-f53.google.com) (209.85.128.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 07 Jan 2019 12:42:33 +0000 Received: by mail-wm1-f53.google.com with SMTP id y139so733445wmc.5 for ; Mon, 07 Jan 2019 04:42:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=iB0nJqOuBqzQNyHTegoBdjQGcjiJtrNkf5BlfKBP950=; b=SxOxNoVqspbBGrSRGBlqtv+qIbnkZbcjXK28Y2xNoBmW+5dkNj3rciX91nvYbzGhzA t5OhLOtmUNxvOg+SVG3EqFOTsTWFRl/LsLG3Ti1crd+guoVk5NtDcxGkEIjLv8C9JVjr BRsFkOo5VQTeZmnyAqVXZQtsTwNYzTt9SOgSAY7k0U6wDOZtK5Guf/s74wjDzRY9uCoH jvxiGI4Fcd9CnD8EFK0cSVtVw1y/qMlriuSoyM5W7ulEUffsutUglcq8hbdxtXFmbWC+ inL5T3Lz9MigekFHqZe44nB3WQ7XzATibFG4/7ZeA1610nlIckFTXi+VLegVXcy0fXVR 9ldw== Return-Path: Received: from localhost (host86-172-198-47.range86-172.btcentralplus.com. [86.172.198.47]) by smtp.gmail.com with ESMTPSA id z17sm44937888wrv.2.2019.01.07.04.42.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Jan 2019 04:42:30 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org, Tom Tromey Cc: Andrew Burgess Subject: [PATCH 1/4] gdb: Fix skip of `\r` before `\n` in source output Date: Mon, 7 Jan 2019 12:42:21 +0000 Message-Id: In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes 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'. --- gdb/ChangeLog | 5 +++++ gdb/source.c | 7 +------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gdb/source.c b/gdb/source.c index ad6c6466b44..e77789c0dba 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