GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions | Variables
index-write.c File Reference
#include "defs.h"
#include "dwarf2/index-write.h"
#include "addrmap.h"
#include "cli/cli-decode.h"
#include "gdbsupport/byte-vector.h"
#include "gdbsupport/filestuff.h"
#include "gdbsupport/gdb_unlinker.h"
#include "gdbsupport/pathstuff.h"
#include "gdbsupport/scoped_fd.h"
#include "complaints.h"
#include "dwarf2/index-common.h"
#include "dwarf2.h"
#include "dwarf2/read.h"
#include "dwarf2/dwz.h"
#include "gdb/gdb-index.h"
#include "gdbcmd.h"
#include "objfiles.h"
#include "ada-lang.h"
#include "dwarf2/tag.h"
#include <algorithm>
#include <cmath>
#include <forward_list>
#include <set>
#include <unordered_map>
#include <unordered_set>

Go to the source code of this file.

Classes

class  data_buf
 
struct  symtab_index_entry
 
struct  mapped_symtab
 
class  c_str_view
 
class  c_str_view_hasher
 
class  vector_hasher< T >
 
struct  addrmap_index_data
 
class  debug_names
 
class  debug_names::debug_str_lookup
 
class  debug_names::index_key
 
class  debug_names::index_key_hasher
 
class  debug_names::symbol_value
 
class  debug_names::offset_vec
 
class  debug_names::offset_vec_tmpl< OffsetSize >
 
class  debug_names::dwarf
 
class  debug_names::dwarf_tmpl< OffsetSize >
 
struct  index_wip_file
 

Macros

#define DW2_GDB_INDEX_SYMBOL_STATIC_SET_VALUE(cu_index, value)
 
#define DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE(cu_index, value)
 
#define DW2_GDB_INDEX_CU_SET_VALUE(cu_index, value)
 
#define X(n)
 

Typedefs

using cu_index_map = std::unordered_map<const dwarf2_per_cu_data *, unsigned int>
 

Functions

static void file_write (FILE *file, const void *data, size_t size)
 
template<typename Elem , typename Alloc >
static void file_write (FILE *file, const std::vector< Elem, Alloc > &vec)
 
static symtab_index_entryfind_slot (struct mapped_symtab *symtab, const char *name)
 
static void hash_expand (struct mapped_symtab *symtab)
 
static void add_index_entry (struct mapped_symtab *symtab, const char *name, int is_static, gdb_index_symbol_kind kind, offset_type cu_index)
 
static void write_hash_table (mapped_symtab *symtab, data_buf &output, data_buf &cpool)
 
static void add_address_entry (data_buf &addr_vec, CORE_ADDR start, CORE_ADDR end, unsigned int cu_index)
 
static void write_address_map (const addrmap *addrmap, data_buf &addr_vec, cu_index_map &cu_index_htab)
 
static bool check_dwarf64_offsets (dwarf2_per_bfd *per_bfd)
 
static void assert_file_size (FILE *file, size_t expected_size)
 
static void write_gdbindex_1 (FILE *out_file, const data_buf &cu_list, const data_buf &types_cu_list, const data_buf &addr_vec, const data_buf &symtab_vec, const data_buf &constant_pool)
 
static void write_cooked_index (cooked_index *table, const cu_index_map &cu_index_htab, struct mapped_symtab *symtab)
 
static void write_gdbindex (dwarf2_per_bfd *per_bfd, cooked_index *table, FILE *out_file, FILE *dwz_out_file)
 
static void write_debug_names (dwarf2_per_bfd *per_bfd, cooked_index *table, FILE *out_file, FILE *out_file_str)
 
void write_dwarf_index (dwarf2_per_bfd *per_bfd, const char *dir, const char *basename, const char *dwz_basename, dw_index_kind index_kind)
 
static void save_gdb_index_command (const char *arg, int from_tty)
 
void _initialize_dwarf_index_write ()
 

Variables

static const gdb_byte dwarf5_gdb_augmentation [] = { 'G', 'D', 'B', 0 }
 

Macro Definition Documentation

◆ DW2_GDB_INDEX_CU_SET_VALUE

#define DW2_GDB_INDEX_CU_SET_VALUE ( cu_index,
value )
Value:
do { \
gdb_assert (((value) & ~GDB_INDEX_CU_MASK) == 0); \
GDB_INDEX_CU_SET_VALUE((cu_index), (value)); \
} while (0)
Definition value.h:130

Definition at line 65 of file index-write.c.

Referenced by add_index_entry().

◆ DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE

#define DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE ( cu_index,
value )
Value:
do { \
gdb_assert ((value) >= GDB_INDEX_SYMBOL_KIND_TYPE \
&& (value) <= GDB_INDEX_SYMBOL_KIND_OTHER); \
GDB_INDEX_SYMBOL_KIND_SET_VALUE((cu_index), (value)); \
} while (0)

Definition at line 57 of file index-write.c.

Referenced by add_index_entry().

◆ DW2_GDB_INDEX_SYMBOL_STATIC_SET_VALUE

#define DW2_GDB_INDEX_SYMBOL_STATIC_SET_VALUE ( cu_index,
value )
Value:
do { \
gdb_assert ((unsigned int) (value) <= 1); \
GDB_INDEX_SYMBOL_STATIC_SET_VALUE((cu_index), (value)); \
} while (0)

Definition at line 50 of file index-write.c.

Referenced by add_index_entry().

◆ X

#define X ( n)
Value:
do \
{ \
if (n < other.n) \
return true; \
if (n > other.n) \
return false; \
} \
while (0)

Typedef Documentation

◆ cu_index_map

using cu_index_map = std::unordered_map<const dwarf2_per_cu_data *, unsigned int>

Definition at line 435 of file index-write.c.

Function Documentation

◆ _initialize_dwarf_index_write()

void _initialize_dwarf_index_write ( )

Definition at line 1620 of file index-write.c.

Referenced by initialize_all_files().

◆ add_address_entry()

static void add_address_entry ( data_buf & addr_vec,
CORE_ADDR start,
CORE_ADDR end,
unsigned int cu_index )
static

◆ add_index_entry()

static void add_index_entry ( struct mapped_symtab * symtab,
const char * name,
int is_static,
gdb_index_symbol_kind kind,
offset_type cu_index )
static

◆ assert_file_size()

static void assert_file_size ( FILE * file,
size_t expected_size )
static

Definition at line 1064 of file index-write.c.

Referenced by write_debug_names(), and write_gdbindex_1().

◆ check_dwarf64_offsets()

static bool check_dwarf64_offsets ( dwarf2_per_bfd * per_bfd)
static

Definition at line 1049 of file index-write.c.

References dwarf2_per_bfd::all_units.

Referenced by write_debug_names().

◆ file_write() [1/2]

template<typename Elem , typename Alloc >
static void file_write ( FILE * file,
const std::vector< Elem, Alloc > & vec )
static

Definition at line 87 of file index-write.c.

References file_write().

◆ file_write() [2/2]

static void file_write ( FILE * file,
const void * data,
size_t size )
static

Definition at line 77 of file index-write.c.

References size.

Referenced by file_write().

◆ find_slot()

static symtab_index_entry & find_slot ( struct mapped_symtab * symtab,
const char * name )
static

Definition at line 214 of file index-write.c.

References mapped_index_string_hash(), and name.

Referenced by add_index_entry(), and hash_expand().

◆ hash_expand()

static void hash_expand ( struct mapped_symtab * symtab)
static

Definition at line 233 of file index-write.c.

References find_slot().

Referenced by add_index_entry().

◆ save_gdb_index_command()

static void save_gdb_index_command ( const char * arg,
int from_tty )
static

◆ write_address_map()

static void write_address_map ( const addrmap * addrmap,
data_buf & addr_vec,
cu_index_map & cu_index_htab )
static

◆ write_cooked_index()

static void write_cooked_index ( cooked_index * table,
const cu_index_map & cu_index_htab,
struct mapped_symtab * symtab )
static

◆ write_debug_names()

static void write_debug_names ( dwarf2_per_bfd * per_bfd,
cooked_index * table,
FILE * out_file,
FILE * out_file_str )
static

◆ write_dwarf_index()

void write_dwarf_index ( dwarf2_per_bfd * per_bfd,
const char * dir,
const char * basename,
const char * dwz_basename,
dw_index_kind index_kind )

◆ write_gdbindex()

static void write_gdbindex ( dwarf2_per_bfd * per_bfd,
cooked_index * table,
FILE * out_file,
FILE * dwz_out_file )
static

◆ write_gdbindex_1()

static void write_gdbindex_1 ( FILE * out_file,
const data_buf & cu_list,
const data_buf & types_cu_list,
const data_buf & addr_vec,
const data_buf & symtab_vec,
const data_buf & constant_pool )
static

◆ write_hash_table()

static void write_hash_table ( mapped_symtab * symtab,
data_buf & output,
data_buf & cpool )
static

Definition at line 370 of file index-write.c.

References data_buf::append_cstr0(), data_buf::append_offset(), and data_buf::size().

Referenced by write_gdbindex().

Variable Documentation

◆ dwarf5_gdb_augmentation

const gdb_byte dwarf5_gdb_augmentation[] = { 'G', 'D', 'B', 0 }
static

Definition at line 1275 of file index-write.c.

Referenced by write_debug_names().