mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-26 13:56:22 +08:00
From Craig Silverstein: Speed up ODR violation reporting.
This commit is contained in:
@ -118,7 +118,8 @@ ResetLineStateMachine(struct LineStateMachine* lsm, bool default_is_stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<int size, bool big_endian>
|
template<int size, bool big_endian>
|
||||||
Sized_dwarf_line_info<size, big_endian>::Sized_dwarf_line_info(Object* object)
|
Sized_dwarf_line_info<size, big_endian>::Sized_dwarf_line_info(Object* object,
|
||||||
|
off_t read_shndx)
|
||||||
: data_valid_(false), buffer_(NULL), symtab_buffer_(NULL),
|
: data_valid_(false), buffer_(NULL), symtab_buffer_(NULL),
|
||||||
directories_(), files_(), current_header_index_(-1)
|
directories_(), files_(), current_header_index_(-1)
|
||||||
{
|
{
|
||||||
@ -171,7 +172,7 @@ Sized_dwarf_line_info<size, big_endian>::Sized_dwarf_line_info(Object* object)
|
|||||||
// Now that we have successfully read all the data, parse the debug
|
// Now that we have successfully read all the data, parse the debug
|
||||||
// info.
|
// info.
|
||||||
this->data_valid_ = true;
|
this->data_valid_ = true;
|
||||||
this->read_line_mappings();
|
this->read_line_mappings(read_shndx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the DWARF header.
|
// Read the DWARF header.
|
||||||
@ -495,7 +496,8 @@ Sized_dwarf_line_info<size, big_endian>::process_one_opcode(
|
|||||||
|
|
||||||
template<int size, bool big_endian>
|
template<int size, bool big_endian>
|
||||||
unsigned const char*
|
unsigned const char*
|
||||||
Sized_dwarf_line_info<size, big_endian>::read_lines(unsigned const char* lineptr)
|
Sized_dwarf_line_info<size, big_endian>::read_lines(unsigned const char* lineptr,
|
||||||
|
off_t shndx)
|
||||||
{
|
{
|
||||||
struct LineStateMachine lsm;
|
struct LineStateMachine lsm;
|
||||||
|
|
||||||
@ -517,7 +519,8 @@ Sized_dwarf_line_info<size, big_endian>::read_lines(unsigned const char* lineptr
|
|||||||
{
|
{
|
||||||
size_t oplength;
|
size_t oplength;
|
||||||
bool add_line = this->process_one_opcode(lineptr, &lsm, &oplength);
|
bool add_line = this->process_one_opcode(lineptr, &lsm, &oplength);
|
||||||
if (add_line)
|
if (add_line
|
||||||
|
&& (shndx == -1U || lsm.shndx == -1U || shndx == lsm.shndx))
|
||||||
{
|
{
|
||||||
Offset_to_lineno_entry entry
|
Offset_to_lineno_entry entry
|
||||||
= { lsm.address, this->current_header_index_,
|
= { lsm.address, this->current_header_index_,
|
||||||
@ -570,7 +573,7 @@ Sized_dwarf_line_info<size, big_endian>::read_relocs()
|
|||||||
|
|
||||||
template<int size, bool big_endian>
|
template<int size, bool big_endian>
|
||||||
void
|
void
|
||||||
Sized_dwarf_line_info<size, big_endian>::read_line_mappings()
|
Sized_dwarf_line_info<size, big_endian>::read_line_mappings(off_t shndx)
|
||||||
{
|
{
|
||||||
gold_assert(this->data_valid_ == true);
|
gold_assert(this->data_valid_ == true);
|
||||||
|
|
||||||
@ -580,7 +583,7 @@ Sized_dwarf_line_info<size, big_endian>::read_line_mappings()
|
|||||||
const unsigned char* lineptr = this->buffer_;
|
const unsigned char* lineptr = this->buffer_;
|
||||||
lineptr = this->read_header_prolog(lineptr);
|
lineptr = this->read_header_prolog(lineptr);
|
||||||
lineptr = this->read_header_tables(lineptr);
|
lineptr = this->read_header_tables(lineptr);
|
||||||
lineptr = this->read_lines(lineptr);
|
lineptr = this->read_lines(lineptr, shndx);
|
||||||
this->buffer_ = lineptr;
|
this->buffer_ = lineptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -788,25 +791,29 @@ Dwarf_line_info::one_addr2line(Object* object,
|
|||||||
{
|
{
|
||||||
if (parameters->get_size() == 32 && !parameters->is_big_endian())
|
if (parameters->get_size() == 32 && !parameters->is_big_endian())
|
||||||
#ifdef HAVE_TARGET_32_LITTLE
|
#ifdef HAVE_TARGET_32_LITTLE
|
||||||
return Sized_dwarf_line_info<32, false>(object).addr2line(shndx, offset);
|
return Sized_dwarf_line_info<32, false>(object, shndx).addr2line(shndx,
|
||||||
|
offset);
|
||||||
#else
|
#else
|
||||||
gold_unreachable();
|
gold_unreachable();
|
||||||
#endif
|
#endif
|
||||||
else if (parameters->get_size() == 32 && parameters->is_big_endian())
|
else if (parameters->get_size() == 32 && parameters->is_big_endian())
|
||||||
#ifdef HAVE_TARGET_32_BIG
|
#ifdef HAVE_TARGET_32_BIG
|
||||||
return Sized_dwarf_line_info<32, true>(object).addr2line(shndx, offset);
|
return Sized_dwarf_line_info<32, true>(object, shndx).addr2line(shndx,
|
||||||
|
offset);
|
||||||
#else
|
#else
|
||||||
gold_unreachable();
|
gold_unreachable();
|
||||||
#endif
|
#endif
|
||||||
else if (parameters->get_size() == 64 && !parameters->is_big_endian())
|
else if (parameters->get_size() == 64 && !parameters->is_big_endian())
|
||||||
#ifdef HAVE_TARGET_64_LITTLE
|
#ifdef HAVE_TARGET_64_LITTLE
|
||||||
return Sized_dwarf_line_info<64, false>(object).addr2line(shndx, offset);
|
return Sized_dwarf_line_info<64, false>(object, shndx).addr2line(shndx,
|
||||||
|
offset);
|
||||||
#else
|
#else
|
||||||
gold_unreachable();
|
gold_unreachable();
|
||||||
#endif
|
#endif
|
||||||
else if (parameters->get_size() == 64 && parameters->is_big_endian())
|
else if (parameters->get_size() == 64 && parameters->is_big_endian())
|
||||||
#ifdef HAVE_TARGET_64_BIT
|
#ifdef HAVE_TARGET_64_BIT
|
||||||
return Sized_dwarf_line_info<64, true>(object).addr2line(shndx, offset);
|
return Sized_dwarf_line_info<64, true>(object, shndx).addr2line(shndx,
|
||||||
|
offset);
|
||||||
#else
|
#else
|
||||||
gold_unreachable();
|
gold_unreachable();
|
||||||
#endif
|
#endif
|
||||||
|
@ -89,15 +89,19 @@ class Sized_dwarf_line_info : public Dwarf_line_info
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Initializes a .debug_line reader for a given object file.
|
// Initializes a .debug_line reader for a given object file.
|
||||||
Sized_dwarf_line_info(Object* object);
|
// If SHNDX is specified and non-negative, only read the debug
|
||||||
|
// information that pertains to the specified section.
|
||||||
|
Sized_dwarf_line_info(Object* object, off_t read_shndx = -1U);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string
|
std::string
|
||||||
do_addr2line(unsigned int shndx, off_t offset);
|
do_addr2line(unsigned int shndx, off_t offset);
|
||||||
|
|
||||||
// Start processing line info, and populates the offset_map_.
|
// Start processing line info, and populates the offset_map_.
|
||||||
|
// If SHNDX is non-negative, only store debug information that
|
||||||
|
// pertains to the specified section.
|
||||||
void
|
void
|
||||||
read_line_mappings();
|
read_line_mappings(off_t shndx);
|
||||||
|
|
||||||
// Reads the relocation section associated with .debug_line and
|
// Reads the relocation section associated with .debug_line and
|
||||||
// stores relocation information in reloc_map_.
|
// stores relocation information in reloc_map_.
|
||||||
@ -117,9 +121,11 @@ class Sized_dwarf_line_info : public Dwarf_line_info
|
|||||||
const unsigned char*
|
const unsigned char*
|
||||||
read_header_tables(const unsigned char* lineptr);
|
read_header_tables(const unsigned char* lineptr);
|
||||||
|
|
||||||
// Reads the DWARF2/3 line information.
|
// Reads the DWARF2/3 line information. If shndx is non-negative,
|
||||||
|
// discard all line information that doesn't pertain to the given
|
||||||
|
// section.
|
||||||
const unsigned char*
|
const unsigned char*
|
||||||
read_lines(const unsigned char* lineptr);
|
read_lines(const unsigned char* lineptr, off_t shndx);
|
||||||
|
|
||||||
// Process a single line info opcode at START using the state
|
// Process a single line info opcode at START using the state
|
||||||
// machine at LSM. Return true if we should define a line using the
|
// machine at LSM. Return true if we should define a line using the
|
||||||
|
Reference in New Issue
Block a user