mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-17 04:43:17 +08:00
From Craig Silverstein: Dwarf_line_info can work with Object rather
than Sized_relobj.
This commit is contained in:
@ -117,9 +117,8 @@ ResetLineStateMachine(struct LineStateMachine* lsm, bool default_is_stmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<int size, bool big_endian>
|
template<int size, bool big_endian>
|
||||||
Dwarf_line_info<size, big_endian>::Dwarf_line_info(
|
Dwarf_line_info<size, big_endian>::Dwarf_line_info(Object* object)
|
||||||
Sized_relobj<size, big_endian>* object)
|
: data_valid_(false), buffer_(NULL), symtab_buffer_(NULL),
|
||||||
: data_valid_(true), buffer_(NULL), symtab_buffer_(NULL),
|
|
||||||
directories_(1), files_(1)
|
directories_(1), files_(1)
|
||||||
{
|
{
|
||||||
unsigned int debug_shndx;
|
unsigned int debug_shndx;
|
||||||
@ -133,10 +132,7 @@ Dwarf_line_info<size, big_endian>::Dwarf_line_info(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (this->buffer_ == NULL)
|
if (this->buffer_ == NULL)
|
||||||
{
|
|
||||||
this->data_valid_ = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// Find the relocation section for ".debug_line".
|
// Find the relocation section for ".debug_line".
|
||||||
bool got_relocs = false;
|
bool got_relocs = false;
|
||||||
@ -155,10 +151,7 @@ Dwarf_line_info<size, big_endian>::Dwarf_line_info(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!got_relocs)
|
if (!got_relocs)
|
||||||
{
|
|
||||||
this->data_valid_ = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// Finally, we need the symtab section to interpret the relocs.
|
// Finally, we need the symtab section to interpret the relocs.
|
||||||
unsigned int symtab_shndx;
|
unsigned int symtab_shndx;
|
||||||
@ -172,13 +165,11 @@ Dwarf_line_info<size, big_endian>::Dwarf_line_info(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (this->symtab_buffer_ == NULL)
|
if (this->symtab_buffer_ == NULL)
|
||||||
{
|
|
||||||
this->data_valid_ = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// 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->read_line_mappings();
|
this->read_line_mappings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -557,8 +548,7 @@ template<int size, bool big_endian>
|
|||||||
void
|
void
|
||||||
Dwarf_line_info<size, big_endian>::read_line_mappings()
|
Dwarf_line_info<size, big_endian>::read_line_mappings()
|
||||||
{
|
{
|
||||||
if (this->data_valid_ == false)
|
gold_assert(this->data_valid_ == true);
|
||||||
return;
|
|
||||||
|
|
||||||
read_relocs();
|
read_relocs();
|
||||||
while (this->buffer_ < this->buffer_end_)
|
while (this->buffer_ < this->buffer_end_)
|
||||||
|
@ -46,7 +46,7 @@ class 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.
|
||||||
Dwarf_line_info(Sized_relobj<size, big_endian>* object);
|
Dwarf_line_info(Object* object);
|
||||||
|
|
||||||
// Given a section number and an offset, returns the associated
|
// Given a section number and an offset, returns the associated
|
||||||
// file and line-number, as a string: "file:lineno". If unable
|
// file and line-number, as a string: "file:lineno". If unable
|
||||||
|
Reference in New Issue
Block a user