From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28379 invoked by alias); 10 Oct 2006 15:08:53 -0000 Received: (qmail 28368 invoked by uid 22791); 10 Oct 2006 15:08:52 -0000 X-Spam-Check-By: sourceware.org Received: from fra-del-03.spheriq.net (HELO fra-del-03.spheriq.net) (195.46.51.99) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 10 Oct 2006 15:08:48 +0000 Received: from fra-out-01.spheriq.net (fra-out-01.spheriq.net [195.46.51.129]) by fra-del-03.spheriq.net with ESMTP id k9AF8jlb032655 for ; Tue, 10 Oct 2006 15:08:45 GMT Received: from fra-cus-01.spheriq.net (fra-cus-01.spheriq.net [195.46.51.37]) by fra-out-01.spheriq.net with ESMTP id k9AF8hjd009239 for ; Tue, 10 Oct 2006 15:08:44 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by fra-cus-01.spheriq.net with ESMTP id k9AF8dg2017475 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Tue, 10 Oct 2006 15:08:42 GMT Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 8FCC9DA46; Tue, 10 Oct 2006 15:08:26 +0000 (GMT) Received: from mail1.cro.st.com (mail1.cro.st.com [164.129.40.131]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 51C79474D7; Tue, 10 Oct 2006 15:08:26 +0000 (GMT) Received: from st.com (crx1177.cro.st.com [164.129.47.77]) by mail1.cro.st.com (MOS 3.5.8-GR) with ESMTP id CIQ69020 (AUTH "denis pilat"); Tue, 10 Oct 2006 17:08:24 +0200 (CEST) Message-ID: <452BB767.5000407@st.com> Date: Tue, 10 Oct 2006 15:08:00 -0000 From: Denis PILAT User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.0.1) Gecko/20020920 Netscape/7.0 MIME-Version: 1.0 To: gdb-patches@sourceware.org Cc: Eli Zaretskii Subject: '\r' only end-of-line References: <452A6905.1040308@st.com> <452B9EB9.4040709@st.com> Content-Type: multipart/mixed; boundary="------------050901070205040203050501" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-10/txt/msg00093.txt.bz2 This is a multi-part message in MIME format. --------------050901070205040203050501 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 386 As discussed in thread http://sources.redhat.com/ml/gdb-patches/2006-10/msg00090.html about the TUI that did not display windows source files, I propose a patch that treats source files where end-of-line are '\r' only. The struct symtab fulfilled by find_source_lines was wrong, the field nlines was set to 1. Therefore these files can not be open in the TUI for instance. Denis --------------050901070205040203050501 Content-Type: text/plain; name="source.c.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="source.c.patch" Content-length: 987 2006-10-10 Denis PILAT * source.c (find_source_lines): Treat the case of source file whith '\r' only end-of-line. Index: source.c =================================================================== --- source.c (revision 528) +++ source.c (working copy) @@ -1074,7 +1074,11 @@ find_source_lines (struct symtab *s, int nlines = 1; while (p != end) { - if (*p++ == '\n' + /* Skip the \r in case of \r\n end-of-line. */ + if (*p == '\r' && *(p + 1) == '\n') + p++; + /* Lines could end with '\n' or '\r' only. */ + if ((*p == '\n' || *p == '\r') /* A newline at the end does not start a new line. */ && p != end) { @@ -1085,8 +1089,9 @@ find_source_lines (struct symtab *s, int (int *) xrealloc ((char *) line_charpos, sizeof (int) * lines_allocated); } - line_charpos[nlines++] = p - data; + line_charpos[nlines++] = p + 1 - data; } + p++; } do_cleanups (old_cleanups); } --------------050901070205040203050501--