mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-01 01:45:51 +08:00
Introduce and use dwarf_scanner_base
This introduces dwarf_scanner_base, a base class for all the index readers in the DWARF code. Then, it changes both mapped_index_base and cooked_index_vector to derive from this new base class.
This commit is contained in:
@ -31,6 +31,7 @@
|
|||||||
#include "addrmap.h"
|
#include "addrmap.h"
|
||||||
#include "gdbsupport/iterator-range.h"
|
#include "gdbsupport/iterator-range.h"
|
||||||
#include "gdbsupport/thread-pool.h"
|
#include "gdbsupport/thread-pool.h"
|
||||||
|
#include "dwarf2/mapped-index.h"
|
||||||
|
|
||||||
struct dwarf2_per_cu_data;
|
struct dwarf2_per_cu_data;
|
||||||
|
|
||||||
@ -241,7 +242,7 @@ private:
|
|||||||
cooked_index_vector for storage and final indexing. The index is
|
cooked_index_vector for storage and final indexing. The index is
|
||||||
made by iterating over the entries previously created. */
|
made by iterating over the entries previously created. */
|
||||||
|
|
||||||
class cooked_index_vector
|
class cooked_index_vector : public dwarf_scanner_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -291,6 +292,8 @@ public:
|
|||||||
"main". This will return NULL if no such entry is available. */
|
"main". This will return NULL if no such entry is available. */
|
||||||
const cooked_index_entry *get_main () const;
|
const cooked_index_entry *get_main () const;
|
||||||
|
|
||||||
|
quick_symbol_functions_up make_quick_functions () const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/* GNAT only emits mangled ("encoded") names in the DWARF, and does
|
/* GNAT only emits mangled ("encoded") names in the DWARF, and does
|
||||||
|
@ -47,13 +47,25 @@ struct name_component
|
|||||||
offset_type idx;
|
offset_type idx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Base class of all DWARF scanner types. */
|
||||||
|
|
||||||
|
struct dwarf_scanner_base
|
||||||
|
{
|
||||||
|
dwarf_scanner_base () = default;
|
||||||
|
virtual ~dwarf_scanner_base () = default;
|
||||||
|
DISABLE_COPY_AND_ASSIGN (dwarf_scanner_base);
|
||||||
|
|
||||||
|
/* Return a quick_symbol_functions instance that refers back to this
|
||||||
|
dwarf_scanner_base. */
|
||||||
|
virtual quick_symbol_functions_up make_quick_functions () const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
/* Base class containing bits shared by both .gdb_index and
|
/* Base class containing bits shared by both .gdb_index and
|
||||||
.debug_name indexes. */
|
.debug_name indexes. */
|
||||||
|
|
||||||
struct mapped_index_base
|
struct mapped_index_base : public dwarf_scanner_base
|
||||||
{
|
{
|
||||||
mapped_index_base () = default;
|
mapped_index_base () = default;
|
||||||
virtual ~mapped_index_base() = default;
|
|
||||||
DISABLE_COPY_AND_ASSIGN (mapped_index_base);
|
DISABLE_COPY_AND_ASSIGN (mapped_index_base);
|
||||||
|
|
||||||
/* The name_component table (a sorted vector). See name_component's
|
/* The name_component table (a sorted vector). See name_component's
|
||||||
@ -77,10 +89,6 @@ struct mapped_index_base
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a quick_symbol_functions instance that refers back to this
|
|
||||||
mapped_index_base. */
|
|
||||||
virtual quick_symbol_functions_up make_quick_functions () const = 0;
|
|
||||||
|
|
||||||
/* Build the symbol name component sorted vector, if we haven't
|
/* Build the symbol name component sorted vector, if we haven't
|
||||||
yet. */
|
yet. */
|
||||||
void build_name_components (dwarf2_per_objfile *per_objfile);
|
void build_name_components (dwarf2_per_objfile *per_objfile);
|
||||||
|
@ -5301,7 +5301,8 @@ dwarf2_initialize_objfile (struct objfile *objfile)
|
|||||||
if (per_bfd->cooked_index_table != nullptr)
|
if (per_bfd->cooked_index_table != nullptr)
|
||||||
{
|
{
|
||||||
dwarf_read_debug_printf ("re-using cooked index table");
|
dwarf_read_debug_printf ("re-using cooked index table");
|
||||||
objfile->qf.push_front (make_cooked_index_funcs ());
|
objfile->qf.push_front
|
||||||
|
(per_bfd->cooked_index_table->make_quick_functions ());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18682,6 +18683,12 @@ make_cooked_index_funcs ()
|
|||||||
return quick_symbol_functions_up (new cooked_index_functions);
|
return quick_symbol_functions_up (new cooked_index_functions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quick_symbol_functions_up
|
||||||
|
cooked_index_vector::make_quick_functions () const
|
||||||
|
{
|
||||||
|
return make_cooked_index_funcs ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Read the .debug_loclists or .debug_rnglists header (they are the same format)
|
/* Read the .debug_loclists or .debug_rnglists header (they are the same format)
|
||||||
|
Reference in New Issue
Block a user