mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-26 05:47:26 +08:00
* libcoff-in.h (struct coff_section_tdata): Add offset, i,
function, and line_base fields. * libcoff.h: Rebuild. * coffgen.c (coff_find_nearest_line): Use section tdata to cache information, rather than using static variables.
This commit is contained in:
@ -1,5 +1,11 @@
|
|||||||
Mon Sep 25 11:48:02 1995 Ian Lance Taylor <ian@cygnus.com>
|
Mon Sep 25 11:48:02 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||||
|
|
||||||
|
* libcoff-in.h (struct coff_section_tdata): Add offset, i,
|
||||||
|
function, and line_base fields.
|
||||||
|
* libcoff.h: Rebuild.
|
||||||
|
* coffgen.c (coff_find_nearest_line): Use section tdata to cache
|
||||||
|
information, rather than using static variables.
|
||||||
|
|
||||||
* sunos.c (sunos_read_dynamic_info): Adjust offsets in an NMAGIC
|
* sunos.c (sunos_read_dynamic_info): Adjust offsets in an NMAGIC
|
||||||
file. From Peter DeWolf <pld@amt.tay1.dec.com>.
|
file. From Peter DeWolf <pld@amt.tay1.dec.com>.
|
||||||
|
|
||||||
|
@ -1774,20 +1774,14 @@ coff_find_nearest_line (abfd, section, ignore_symbols, offset, filename_ptr,
|
|||||||
CONST char **functionname_ptr;
|
CONST char **functionname_ptr;
|
||||||
unsigned int *line_ptr;
|
unsigned int *line_ptr;
|
||||||
{
|
{
|
||||||
static bfd *cache_abfd;
|
|
||||||
static asection *cache_section;
|
|
||||||
static bfd_vma cache_offset;
|
|
||||||
static unsigned int cache_i;
|
|
||||||
static CONST char *cache_function;
|
|
||||||
static unsigned int line_base = 0;
|
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
unsigned int line_base;
|
||||||
coff_data_type *cof = coff_data (abfd);
|
coff_data_type *cof = coff_data (abfd);
|
||||||
/* Run through the raw syments if available */
|
/* Run through the raw syments if available */
|
||||||
combined_entry_type *p;
|
combined_entry_type *p;
|
||||||
combined_entry_type *pend;
|
combined_entry_type *pend;
|
||||||
alent *l;
|
alent *l;
|
||||||
|
struct coff_section_tdata *sec_data;
|
||||||
|
|
||||||
*filename_ptr = 0;
|
*filename_ptr = 0;
|
||||||
*functionname_ptr = 0;
|
*functionname_ptr = 0;
|
||||||
@ -1857,20 +1851,23 @@ coff_find_nearest_line (abfd, section, ignore_symbols, offset, filename_ptr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Now wander though the raw linenumbers of the section */
|
/* Now wander though the raw linenumbers of the section */
|
||||||
/* If this is the same BFD as we were previously called with and
|
/* If we have been called on this section before, and the offset we
|
||||||
this is the same section, and the offset we want is further down
|
want is further down then we can prime the lookup loop. */
|
||||||
then we can prime the lookup loop. */
|
sec_data = coff_section_data (abfd, section);
|
||||||
if (abfd == cache_abfd &&
|
if (sec_data != NULL
|
||||||
section == cache_section &&
|
&& sec_data->i > 0
|
||||||
offset >= cache_offset)
|
&& offset >= sec_data->offset)
|
||||||
{
|
{
|
||||||
i = cache_i;
|
i = sec_data->i;
|
||||||
*functionname_ptr = cache_function;
|
*functionname_ptr = sec_data->function;
|
||||||
|
line_base = sec_data->line_base;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
i = 0;
|
i = 0;
|
||||||
|
line_base = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
l = §ion->lineno[i];
|
l = §ion->lineno[i];
|
||||||
|
|
||||||
for (; i < section->lineno_count; i++)
|
for (; i < section->lineno_count; i++)
|
||||||
@ -1915,11 +1912,21 @@ coff_find_nearest_line (abfd, section, ignore_symbols, offset, filename_ptr,
|
|||||||
l++;
|
l++;
|
||||||
}
|
}
|
||||||
|
|
||||||
cache_abfd = abfd;
|
/* Cache the results for the next call. */
|
||||||
cache_section = section;
|
if (sec_data == NULL)
|
||||||
cache_offset = offset;
|
{
|
||||||
cache_i = i;
|
section->used_by_bfd =
|
||||||
cache_function = *functionname_ptr;
|
((PTR) bfd_zalloc (abfd,
|
||||||
|
sizeof (struct coff_section_tdata)));
|
||||||
|
sec_data = section->used_by_bfd;
|
||||||
|
}
|
||||||
|
if (sec_data != NULL)
|
||||||
|
{
|
||||||
|
sec_data->offset = offset;
|
||||||
|
sec_data->i = i;
|
||||||
|
sec_data->function = *functionname_ptr;
|
||||||
|
sec_data->line_base = line_base;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -115,6 +115,11 @@ struct coff_section_tdata
|
|||||||
bfd_byte *contents;
|
bfd_byte *contents;
|
||||||
/* If this is true, the contents entry may not be freed. */
|
/* If this is true, the contents entry may not be freed. */
|
||||||
boolean keep_contents;
|
boolean keep_contents;
|
||||||
|
/* Information cached by coff_find_nearest_line. */
|
||||||
|
bfd_vma offset;
|
||||||
|
unsigned int i;
|
||||||
|
const char *function;
|
||||||
|
int line_base;
|
||||||
/* Available for individual backends. */
|
/* Available for individual backends. */
|
||||||
PTR tdata;
|
PTR tdata;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user