* source.c (find_source_lines): Remove LSEEK_NOT_LINEAR code.
(source_line_charpos, source_charpos_line): Remove.
This commit is contained in:
parent
8903c50da7
commit
d4d4db8a72
|
@ -1,3 +1,8 @@
|
|||
2011-04-04 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* source.c (find_source_lines): Remove LSEEK_NOT_LINEAR code.
|
||||
(source_line_charpos, source_charpos_line): Remove.
|
||||
|
||||
2011-04-04 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* symtab.h (domain_enum): Split in two...
|
||||
|
|
66
gdb/source.c
66
gdb/source.c
|
@ -1145,30 +1145,6 @@ find_source_lines (struct symtab *s, int desc)
|
|||
if (mtime && mtime < st.st_mtime)
|
||||
warning (_("Source file is more recent than executable."));
|
||||
|
||||
#ifdef LSEEK_NOT_LINEAR
|
||||
{
|
||||
char c;
|
||||
|
||||
/* Have to read it byte by byte to find out where the chars live. */
|
||||
|
||||
line_charpos[0] = lseek (desc, 0, SEEK_CUR);
|
||||
nlines = 1;
|
||||
while (myread (desc, &c, 1) > 0)
|
||||
{
|
||||
if (c == '\n')
|
||||
{
|
||||
if (nlines == lines_allocated)
|
||||
{
|
||||
lines_allocated *= 2;
|
||||
line_charpos =
|
||||
(int *) xrealloc ((char *) line_charpos,
|
||||
sizeof (int) * lines_allocated);
|
||||
}
|
||||
line_charpos[nlines++] = lseek (desc, 0, SEEK_CUR);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else /* lseek linear. */
|
||||
{
|
||||
struct cleanup *old_cleanups;
|
||||
|
||||
|
@ -1207,53 +1183,13 @@ find_source_lines (struct symtab *s, int desc)
|
|||
}
|
||||
do_cleanups (old_cleanups);
|
||||
}
|
||||
#endif /* lseek linear. */
|
||||
|
||||
s->nlines = nlines;
|
||||
s->line_charpos =
|
||||
(int *) xrealloc ((char *) line_charpos, nlines * sizeof (int));
|
||||
|
||||
}
|
||||
|
||||
/* Return the character position of a line LINE in symtab S.
|
||||
Return 0 if anything is invalid. */
|
||||
|
||||
#if 0 /* Currently unused */
|
||||
|
||||
int
|
||||
source_line_charpos (struct symtab *s, int line)
|
||||
{
|
||||
if (!s)
|
||||
return 0;
|
||||
if (!s->line_charpos || line <= 0)
|
||||
return 0;
|
||||
if (line > s->nlines)
|
||||
line = s->nlines;
|
||||
return s->line_charpos[line - 1];
|
||||
}
|
||||
|
||||
/* Return the line number of character position POS in symtab S. */
|
||||
|
||||
int
|
||||
source_charpos_line (struct symtab *s, int chr)
|
||||
{
|
||||
int line = 0;
|
||||
int *lnp;
|
||||
|
||||
if (s == 0 || s->line_charpos == 0)
|
||||
return 0;
|
||||
lnp = s->line_charpos;
|
||||
/* Files are usually short, so sequential search is Ok. */
|
||||
while (line < s->nlines && *lnp <= chr)
|
||||
{
|
||||
line++;
|
||||
lnp++;
|
||||
}
|
||||
if (line >= s->nlines)
|
||||
line = s->nlines;
|
||||
return line;
|
||||
}
|
||||
|
||||
#endif /* 0 */
|
||||
|
||||
|
||||
/* Get full pathname and line number positions for a symtab.
|
||||
|
|
Loading…
Reference in New Issue