From: Denis PILAT <denis.pilat@st.com>
To: gdb-patches@sourceware.org
Cc: Eli Zaretskii <eliz@gnu.org>
Subject: '\r' only end-of-line
Date: Tue, 10 Oct 2006 15:08:00 -0000 [thread overview]
Message-ID: <452BB767.5000407@st.com> (raw)
In-Reply-To: <452B9EB9.4040709@st.com>
[-- Attachment #1: Type: text/plain, Size: 386 bytes --]
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
[-- Attachment #2: source.c.patch --]
[-- Type: text/plain, Size: 987 bytes --]
2006-10-10 Denis PILAT <denis.pilat@st.com>
* 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);
}
next prev parent reply other threads:[~2006-10-10 15:08 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-09 15:25 [TUI] correctly display windows source files Denis PILAT
2006-10-09 18:01 ` Mark Kettenis
2006-10-09 19:28 ` Eli Zaretskii
2006-10-10 13:23 ` Denis PILAT
2006-10-10 15:08 ` Denis PILAT [this message]
2006-10-10 21:34 ` '\r' only end-of-line Eli Zaretskii
2006-10-11 10:08 ` Denis PILAT
2006-10-11 13:33 ` Daniel Jacobowitz
2006-10-11 13:57 ` Andrew STUBBS
2006-10-11 14:01 ` Daniel Jacobowitz
2006-10-11 14:44 ` Andrew STUBBS
2006-10-11 15:05 ` Daniel Jacobowitz
2006-10-11 17:47 ` Eli Zaretskii
2006-10-11 17:36 ` Eli Zaretskii
2006-10-16 8:51 ` Denis PILAT
2006-10-10 21:24 ` [TUI] correctly display windows source files Eli Zaretskii
2006-10-11 8:02 ` Denis PILAT
2006-10-11 8:39 ` Eli Zaretskii
2006-10-11 11:23 ` Frederic RISS
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=452BB767.5000407@st.com \
--to=denis.pilat@st.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox