* symtab.c, symtab.h, source.c: Change find_line_pc_range to take
a struct symtab_and_line argument, rather than a symtab and a line. Re-write it to be based on the address rather than bogusly adding one to the line number and hoping that has something to do with the end of the line.
This commit is contained in:
parent
f2e945df05
commit
b86a1b3baa
|
@ -1,5 +1,11 @@
|
||||||
Mon Nov 1 09:40:21 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
Mon Nov 1 09:40:21 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
||||||
|
|
||||||
|
* symtab.c, symtab.h, source.c: Change find_line_pc_range to take
|
||||||
|
a struct symtab_and_line argument, rather than a symtab and a line.
|
||||||
|
Re-write it to be based on the address rather than bogusly adding
|
||||||
|
one to the line number and hoping that has something to do with the
|
||||||
|
end of the line.
|
||||||
|
|
||||||
* config/m88k/m88k.mh (NATDEPFILES): Remove exec.o.
|
* config/m88k/m88k.mh (NATDEPFILES): Remove exec.o.
|
||||||
|
|
||||||
* paread.c (pa_symtab_read): Change comments to say ignoring
|
* paread.c (pa_symtab_read): Change comments to say ignoring
|
||||||
|
|
51
gdb/symtab.c
51
gdb/symtab.c
|
@ -1280,37 +1280,44 @@ find_line_pc (symtab, line)
|
||||||
Returns 0 if could not find the specified line. */
|
Returns 0 if could not find the specified line. */
|
||||||
|
|
||||||
int
|
int
|
||||||
find_line_pc_range (symtab, thisline, startptr, endptr)
|
find_line_pc_range (sal, startptr, endptr)
|
||||||
struct symtab *symtab;
|
struct symtab_and_line sal;
|
||||||
int thisline;
|
|
||||||
CORE_ADDR *startptr, *endptr;
|
CORE_ADDR *startptr, *endptr;
|
||||||
{
|
{
|
||||||
struct linetable *l;
|
struct linetable *l;
|
||||||
int ind;
|
int ind;
|
||||||
int exact_match; /* did we get an exact linenumber match */
|
int exact_match; /* did we get an exact linenumber match */
|
||||||
|
CORE_ADDR startaddr;
|
||||||
|
struct symtab_and_line found_sal;
|
||||||
|
|
||||||
if (symtab == 0)
|
startaddr = sal.pc;
|
||||||
|
if (startaddr == 0)
|
||||||
|
{
|
||||||
|
startaddr = find_line_pc (sal.symtab, sal.line);
|
||||||
|
}
|
||||||
|
if (startaddr == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (find_line_symtab (symtab, thisline, &l, &ind, &exact_match))
|
/* This whole function is based on address. For example, if line 10 has
|
||||||
{
|
two parts, one from 0x100 to 0x200 and one from 0x300 to 0x400, then
|
||||||
*startptr = l->item[ind].pc;
|
"info line *0x123" should say the line goes from 0x100 to 0x200
|
||||||
/* If we have not seen an entry for the specified line,
|
and "info line *0x355" should say the line goes from 0x300 to 0x400.
|
||||||
assume that means the specified line has zero bytes. */
|
This also insures that we never give a range like "starts at 0x134
|
||||||
if (!exact_match || ind == l->nitems-1)
|
and ends at 0x12c". */
|
||||||
*endptr = *startptr;
|
|
||||||
else
|
|
||||||
/* Perhaps the following entry is for the following line.
|
|
||||||
It's worth a try. */
|
|
||||||
if (ind+1 < l->nitems
|
|
||||||
&& l->item[ind+1].line == thisline + 1)
|
|
||||||
*endptr = l->item[ind+1].pc;
|
|
||||||
else
|
|
||||||
*endptr = find_line_pc (symtab, thisline+1);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
found_sal = find_pc_line (startaddr, 0);
|
||||||
|
if (found_sal.line != sal.line)
|
||||||
|
{
|
||||||
|
/* The specified line (sal) has zero bytes. */
|
||||||
|
*startptr = found_sal.pc;
|
||||||
|
*endptr = found_sal.pc;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*startptr = found_sal.pc;
|
||||||
|
*endptr = found_sal.end;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Given a line table and a line number, return the index into the line
|
/* Given a line table and a line number, return the index into the line
|
||||||
|
|
21
gdb/symtab.h
21
gdb/symtab.h
|
@ -85,8 +85,9 @@ struct general_symbol_info
|
||||||
/* Which section is this symbol in? This is an index into
|
/* Which section is this symbol in? This is an index into
|
||||||
section_offsets for this objfile. Negative means that the symbol
|
section_offsets for this objfile. Negative means that the symbol
|
||||||
does not get relocated relative to a section.
|
does not get relocated relative to a section.
|
||||||
Disclaimer: currently this is just used for xcoff, so don't expect
|
Disclaimer: currently this is just used for xcoff, so don't
|
||||||
all symbol-reading code to set it correctly. */
|
expect all symbol-reading code to set it correctly (the ELF code
|
||||||
|
also tries to set it correctly). */
|
||||||
|
|
||||||
int section;
|
int section;
|
||||||
};
|
};
|
||||||
|
@ -680,7 +681,7 @@ struct section_offsets
|
||||||
|
|
||||||
#define ANOFFSET(secoff, whichone) (secoff->offsets[whichone])
|
#define ANOFFSET(secoff, whichone) (secoff->offsets[whichone])
|
||||||
|
|
||||||
/* Each source file is represented by a struct symtab.
|
/* Each source file or header is represented by a struct symtab.
|
||||||
These objects are chained through the `next' field. */
|
These objects are chained through the `next' field. */
|
||||||
|
|
||||||
struct symtab
|
struct symtab
|
||||||
|
@ -690,12 +691,14 @@ struct symtab
|
||||||
|
|
||||||
struct symtab *next;
|
struct symtab *next;
|
||||||
|
|
||||||
/* List of all symbol scope blocks for this symtab. */
|
/* List of all symbol scope blocks for this symtab. May be shared
|
||||||
|
between different symtabs (and normally is for all the symtabs
|
||||||
|
in a given compilation unit). */
|
||||||
|
|
||||||
struct blockvector *blockvector;
|
struct blockvector *blockvector;
|
||||||
|
|
||||||
/* Table mapping core addresses to line numbers for this file.
|
/* Table mapping core addresses to line numbers for this file.
|
||||||
Can be NULL if none. */
|
Can be NULL if none. Never shared between different symtabs. */
|
||||||
|
|
||||||
struct linetable *linetable;
|
struct linetable *linetable;
|
||||||
|
|
||||||
|
@ -722,7 +725,8 @@ struct symtab
|
||||||
free_contents => do a tree walk and free each object.
|
free_contents => do a tree walk and free each object.
|
||||||
free_nothing => do nothing; some other symtab will free
|
free_nothing => do nothing; some other symtab will free
|
||||||
the data this one uses.
|
the data this one uses.
|
||||||
free_linetable => free just the linetable. */
|
free_linetable => free just the linetable. FIXME: Is this redundant
|
||||||
|
with the primary field? */
|
||||||
|
|
||||||
enum free_code
|
enum free_code
|
||||||
{
|
{
|
||||||
|
@ -992,8 +996,6 @@ lookup_minimal_symbol PARAMS ((const char *, struct objfile *));
|
||||||
extern struct minimal_symbol *
|
extern struct minimal_symbol *
|
||||||
lookup_minimal_symbol_by_pc PARAMS ((CORE_ADDR));
|
lookup_minimal_symbol_by_pc PARAMS ((CORE_ADDR));
|
||||||
|
|
||||||
extern struct minimal_symbol *lookup_next_minimal_symbol PARAMS ((CORE_ADDR));
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
init_minimal_symbol_collection PARAMS ((void));
|
init_minimal_symbol_collection PARAMS ((void));
|
||||||
|
|
||||||
|
@ -1034,7 +1036,8 @@ extern CORE_ADDR
|
||||||
find_line_pc PARAMS ((struct symtab *, int));
|
find_line_pc PARAMS ((struct symtab *, int));
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
find_line_pc_range PARAMS ((struct symtab *, int, CORE_ADDR *, CORE_ADDR *));
|
find_line_pc_range PARAMS ((struct symtab_and_line, int,
|
||||||
|
CORE_ADDR *, CORE_ADDR *));
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
resolve_sal_pc PARAMS ((struct symtab_and_line *));
|
resolve_sal_pc PARAMS ((struct symtab_and_line *));
|
||||||
|
|
Loading…
Reference in New Issue