GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Enumerations | Functions | Variables
dictionary.c File Reference
#include "defs.h"
#include <ctype.h>
#include "gdbsupport/gdb_obstack.h"
#include "symtab.h"
#include "buildsym.h"
#include "dictionary.h"
#include "gdbsupport/gdb-safe-ctype.h"
#include <unordered_map>
#include "language.h"

Go to the source code of this file.

Classes

struct  dict_vector
 
struct  dictionary_hashed
 
struct  dictionary_hashed_expandable
 
struct  dictionary_linear
 
struct  dictionary_linear_expandable
 
struct  dictionary
 
struct  multidictionary
 
struct  std::hash< enum language >
 

Namespaces

namespace  std
 

Macros

#define DICT_VECTOR(d)   (d)->vector
 
#define DICT_LANGUAGE(d)   (d)->language
 
#define DICT_HASHED_NBUCKETS(d)   (d)->data.hashed.nbuckets
 
#define DICT_HASHED_BUCKETS(d)   (d)->data.hashed.buckets
 
#define DICT_HASHED_BUCKET(d, i)   DICT_HASHED_BUCKETS (d) [i]
 
#define DICT_HASHED_EXPANDABLE_NSYMS(d)   (d)->data.hashed_expandable.nsyms
 
#define DICT_LINEAR_NSYMS(d)   (d)->data.linear.nsyms
 
#define DICT_LINEAR_SYMS(d)   (d)->data.linear.syms
 
#define DICT_LINEAR_SYM(d, i)   DICT_LINEAR_SYMS (d) [i]
 
#define DICT_LINEAR_EXPANDABLE_CAPACITY(d)    (d)->data.linear_expandable.capacity
 
#define DICT_EXPANDABLE_INITIAL_CAPACITY   10
 
#define DICT_HASHTABLE_SIZE(n)   ((n)/5 + 1)
 
#define DICT_ITERATOR_DICT(iter)   (iter)->dict
 
#define DICT_ITERATOR_INDEX(iter)   (iter)->index
 
#define DICT_ITERATOR_CURRENT(iter)   (iter)->current
 

Enumerations

enum  dict_type { DICT_HASHED , DICT_HASHED_EXPANDABLE , DICT_LINEAR , DICT_LINEAR_EXPANDABLE }
 

Functions

static void add_symbol_nonexpandable (struct dictionary *dict, struct symbol *sym)
 
static void free_obstack (struct dictionary *dict)
 
static struct symboliterator_first_hashed (const struct dictionary *dict, struct dict_iterator *iterator)
 
static struct symboliterator_next_hashed (struct dict_iterator *iterator)
 
static struct symboliter_match_first_hashed (const struct dictionary *dict, const lookup_name_info &name, struct dict_iterator *iterator)
 
static struct symboliter_match_next_hashed (const lookup_name_info &name, struct dict_iterator *iterator)
 
static int size_hashed (const struct dictionary *dict)
 
static void free_hashed_expandable (struct dictionary *dict)
 
static void add_symbol_hashed_expandable (struct dictionary *dict, struct symbol *sym)
 
static int size_hashed_expandable (const struct dictionary *dict)
 
static struct symboliterator_first_linear (const struct dictionary *dict, struct dict_iterator *iterator)
 
static struct symboliterator_next_linear (struct dict_iterator *iterator)
 
static struct symboliter_match_first_linear (const struct dictionary *dict, const lookup_name_info &name, struct dict_iterator *iterator)
 
static struct symboliter_match_next_linear (const lookup_name_info &name, struct dict_iterator *iterator)
 
static int size_linear (const struct dictionary *dict)
 
static void free_linear_expandable (struct dictionary *dict)
 
static void add_symbol_linear_expandable (struct dictionary *dict, struct symbol *sym)
 
static struct symboliterator_hashed_advance (struct dict_iterator *iter)
 
static void insert_symbol_hashed (struct dictionary *dict, struct symbol *sym)
 
static void expand_hashtable (struct dictionary *dict)
 
static struct dictionarydict_create_hashed (struct obstack *obstack, enum language language, const std::vector< symbol * > &symbol_list)
 
static struct dictionarydict_create_hashed_expandable (enum language language)
 
static struct dictionarydict_create_linear (struct obstack *obstack, enum language language, const std::vector< symbol * > &symbol_list)
 
static struct dictionarydict_create_linear_expandable (enum language language)
 
static void dict_free (struct dictionary *dict)
 
static void dict_add_symbol (struct dictionary *dict, struct symbol *sym)
 
static void dict_add_pending (struct dictionary *dict, const std::vector< symbol * > &symbol_list)
 
static struct symboldict_iterator_first (const struct dictionary *dict, struct dict_iterator *iterator)
 
static struct symboldict_iterator_next (struct dict_iterator *iterator)
 
static struct symboldict_iter_match_first (const struct dictionary *dict, const lookup_name_info &name, struct dict_iterator *iterator)
 
static struct symboldict_iter_match_next (const lookup_name_info &name, struct dict_iterator *iterator)
 
static int dict_size (const struct dictionary *dict)
 
static std::unordered_map< enum language, std::vector< symbol * > > collate_pending_symbols_by_language (const struct pending *symbol_list)
 
struct multidictionarymdict_create_hashed (struct obstack *obstack, const struct pending *symbol_list)
 
struct multidictionarymdict_create_hashed_expandable (enum language language)
 
struct multidictionarymdict_create_linear (struct obstack *obstack, const struct pending *symbol_list)
 
struct multidictionarymdict_create_linear_expandable (enum language language)
 
void mdict_free (struct multidictionary *mdict)
 
static struct dictionaryfind_language_dictionary (const struct multidictionary *mdict, enum language language)
 
static struct dictionarycreate_new_language_dictionary (struct multidictionary *mdict, enum language language)
 
void mdict_add_symbol (struct multidictionary *mdict, struct symbol *sym)
 
void mdict_add_pending (struct multidictionary *mdict, const struct pending *symbol_list)
 
struct symbolmdict_iterator_first (const multidictionary *mdict, struct mdict_iterator *miterator)
 
struct symbolmdict_iterator_next (struct mdict_iterator *miterator)
 
struct symbolmdict_iter_match_first (const struct multidictionary *mdict, const lookup_name_info &name, struct mdict_iterator *miterator)
 
struct symbolmdict_iter_match_next (const lookup_name_info &name, struct mdict_iterator *miterator)
 
int mdict_size (const struct multidictionary *mdict)
 

Variables

static const struct dict_vector dict_hashed_vector
 
static const struct dict_vector dict_hashed_expandable_vector
 
static const struct dict_vector dict_linear_vector
 
static const struct dict_vector dict_linear_expandable_vector
 

Macro Definition Documentation

◆ DICT_EXPANDABLE_INITIAL_CAPACITY

#define DICT_EXPANDABLE_INITIAL_CAPACITY   10

Definition at line 205 of file dictionary.c.

Referenced by dict_create_hashed_expandable(), and dict_create_linear_expandable().

◆ DICT_HASHED_BUCKET

#define DICT_HASHED_BUCKET ( d,
i )   DICT_HASHED_BUCKETS (d) [i]

Definition at line 190 of file dictionary.c.

Referenced by iter_match_first_hashed(), iterator_hashed_advance(), and size_hashed().

◆ DICT_HASHED_BUCKETS

#define DICT_HASHED_BUCKETS ( d)    (d)->data.hashed.buckets

◆ DICT_HASHED_EXPANDABLE_NSYMS

#define DICT_HASHED_EXPANDABLE_NSYMS ( d)    (d)->data.hashed_expandable.nsyms

◆ DICT_HASHED_NBUCKETS

#define DICT_HASHED_NBUCKETS ( d)    (d)->data.hashed.nbuckets

◆ DICT_HASHTABLE_SIZE

#define DICT_HASHTABLE_SIZE ( n)    ((n)/5 + 1)

Definition at line 210 of file dictionary.c.

Referenced by add_symbol_hashed_expandable(), and dict_create_hashed().

◆ DICT_ITERATOR_CURRENT

#define DICT_ITERATOR_CURRENT ( iter)    (iter)->current

◆ DICT_ITERATOR_DICT

#define DICT_ITERATOR_DICT ( iter)    (iter)->dict

◆ DICT_ITERATOR_INDEX

#define DICT_ITERATOR_INDEX ( iter)    (iter)->index

◆ DICT_LANGUAGE

#define DICT_LANGUAGE ( d)    (d)->language

◆ DICT_LINEAR_EXPANDABLE_CAPACITY

#define DICT_LINEAR_EXPANDABLE_CAPACITY ( d)     (d)->data.linear_expandable.capacity

Definition at line 200 of file dictionary.c.

Referenced by add_symbol_linear_expandable(), and dict_create_linear_expandable().

◆ DICT_LINEAR_NSYMS

#define DICT_LINEAR_NSYMS ( d)    (d)->data.linear.nsyms

◆ DICT_LINEAR_SYM

#define DICT_LINEAR_SYM ( d,
i )   DICT_LINEAR_SYMS (d) [i]

◆ DICT_LINEAR_SYMS

#define DICT_LINEAR_SYMS ( d)    (d)->data.linear.syms

◆ DICT_VECTOR

#define DICT_VECTOR ( d)    (d)->vector

Enumeration Type Documentation

◆ dict_type

enum dict_type
Enumerator
DICT_HASHED 
DICT_HASHED_EXPANDABLE 
DICT_LINEAR 
DICT_LINEAR_EXPANDABLE 

Definition at line 92 of file dictionary.c.

Function Documentation

◆ add_symbol_hashed_expandable()

static void add_symbol_hashed_expandable ( struct dictionary * dict,
struct symbol * sym )
static

◆ add_symbol_linear_expandable()

static void add_symbol_linear_expandable ( struct dictionary * dict,
struct symbol * sym )
static

◆ add_symbol_nonexpandable()

static void add_symbol_nonexpandable ( struct dictionary * dict,
struct symbol * sym )
static

Definition at line 523 of file dictionary.c.

◆ collate_pending_symbols_by_language()

static std::unordered_map< enum language, std::vector< symbol * > > collate_pending_symbols_by_language ( const struct pending * symbol_list)
static

Definition at line 939 of file dictionary.c.

References pending::next.

Referenced by mdict_add_pending(), mdict_create_hashed(), and mdict_create_linear().

◆ create_new_language_dictionary()

static struct dictionary * create_new_language_dictionary ( struct multidictionary * mdict,
enum language language )
static

◆ dict_add_pending()

static void dict_add_pending ( struct dictionary * dict,
const std::vector< symbol * > & symbol_list )
static

Definition at line 457 of file dictionary.c.

References dict_add_symbol().

Referenced by mdict_add_pending().

◆ dict_add_symbol()

static void dict_add_symbol ( struct dictionary * dict,
struct symbol * sym )
static

Definition at line 448 of file dictionary.c.

References add_symbol(), and DICT_VECTOR.

Referenced by dict_add_pending(), and mdict_add_symbol().

◆ dict_create_hashed()

static struct dictionary * dict_create_hashed ( struct obstack * obstack,
enum language language,
const std::vector< symbol * > & symbol_list )
static

◆ dict_create_hashed_expandable()

static struct dictionary * dict_create_hashed_expandable ( enum language language)
static

◆ dict_create_linear()

static struct dictionary * dict_create_linear ( struct obstack * obstack,
enum language language,
const std::vector< symbol * > & symbol_list )
static

◆ dict_create_linear_expandable()

static struct dictionary * dict_create_linear_expandable ( enum language language)
static

◆ dict_free()

static void dict_free ( struct dictionary * dict)
static

Definition at line 440 of file dictionary.c.

References DICT_VECTOR.

Referenced by mdict_free().

◆ dict_iter_match_first()

static struct symbol * dict_iter_match_first ( const struct dictionary * dict,
const lookup_name_info & name,
struct dict_iterator * iterator )
static

Definition at line 486 of file dictionary.c.

References DICT_VECTOR, and name.

Referenced by mdict_iter_match_first(), and mdict_iter_match_next().

◆ dict_iter_match_next()

static struct symbol * dict_iter_match_next ( const lookup_name_info & name,
struct dict_iterator * iterator )
static

Definition at line 494 of file dictionary.c.

References DICT_ITERATOR_DICT, DICT_VECTOR, and name.

Referenced by mdict_iter_match_next().

◆ dict_iterator_first()

static struct symbol * dict_iterator_first ( const struct dictionary * dict,
struct dict_iterator * iterator )
static

Definition at line 469 of file dictionary.c.

References DICT_VECTOR.

Referenced by mdict_iterator_first(), and mdict_iterator_next().

◆ dict_iterator_next()

static struct symbol * dict_iterator_next ( struct dict_iterator * iterator)
static

Definition at line 479 of file dictionary.c.

References DICT_ITERATOR_DICT, and DICT_VECTOR.

Referenced by mdict_iterator_next().

◆ dict_size()

static int dict_size ( const struct dictionary * dict)
static

Definition at line 502 of file dictionary.c.

References DICT_VECTOR.

Referenced by mdict_size().

◆ expand_hashtable()

static void expand_hashtable ( struct dictionary * dict)
static

◆ find_language_dictionary()

static struct dictionary * find_language_dictionary ( const struct multidictionary * mdict,
enum language language )
static

◆ free_hashed_expandable()

static void free_hashed_expandable ( struct dictionary * dict)
static

Definition at line 670 of file dictionary.c.

References DICT_HASHED_BUCKETS, and xfree().

◆ free_linear_expandable()

static void free_linear_expandable ( struct dictionary * dict)
static

Definition at line 878 of file dictionary.c.

References DICT_LINEAR_SYMS, and xfree().

◆ free_obstack()

static void free_obstack ( struct dictionary * dict)
static

Definition at line 517 of file dictionary.c.

◆ insert_symbol_hashed()

static void insert_symbol_hashed ( struct dictionary * dict,
struct symbol * sym )
static

◆ iter_match_first_hashed()

static struct symbol * iter_match_first_hashed ( const struct dictionary * dict,
const lookup_name_info & name,
struct dict_iterator * iterator )
static

◆ iter_match_first_linear()

static struct symbol * iter_match_first_linear ( const struct dictionary * dict,
const lookup_name_info & name,
struct dict_iterator * iterator )
static

Definition at line 831 of file dictionary.c.

References DICT_ITERATOR_DICT, DICT_ITERATOR_INDEX, iter_match_next_linear(), and name.

◆ iter_match_next_hashed()

static struct symbol * iter_match_next_hashed ( const lookup_name_info & name,
struct dict_iterator * iterator )
static

◆ iter_match_next_linear()

static struct symbol * iter_match_next_linear ( const lookup_name_info & name,
struct dict_iterator * iterator )
static

◆ iterator_first_hashed()

static struct symbol * iterator_first_hashed ( const struct dictionary * dict,
struct dict_iterator * iterator )
static

Definition at line 531 of file dictionary.c.

References DICT_ITERATOR_DICT, DICT_ITERATOR_INDEX, and iterator_hashed_advance().

◆ iterator_first_linear()

static struct symbol * iterator_first_linear ( const struct dictionary * dict,
struct dict_iterator * iterator )
static

◆ iterator_hashed_advance()

static struct symbol * iterator_hashed_advance ( struct dict_iterator * iter)
static

◆ iterator_next_hashed()

static struct symbol * iterator_next_hashed ( struct dict_iterator * iterator)
static

Definition at line 540 of file dictionary.c.

References DICT_ITERATOR_CURRENT, symbol::hash_next, and iterator_hashed_advance().

◆ iterator_next_linear()

static struct symbol * iterator_next_linear ( struct dict_iterator * iterator)
static

◆ mdict_add_pending()

void mdict_add_pending ( struct multidictionary * mdict,
const struct pending * symbol_list )

◆ mdict_add_symbol()

void mdict_add_symbol ( struct multidictionary * mdict,
struct symbol * sym )

◆ mdict_create_hashed()

struct multidictionary * mdict_create_hashed ( struct obstack * obstack,
const struct pending * symbol_list )

◆ mdict_create_hashed_expandable()

struct multidictionary * mdict_create_hashed_expandable ( enum language language language )

◆ mdict_create_linear()

struct multidictionary * mdict_create_linear ( struct obstack * obstack,
const struct pending * symbol_list )

◆ mdict_create_linear_expandable()

struct multidictionary * mdict_create_linear_expandable ( enum language language language )

◆ mdict_free()

void mdict_free ( struct multidictionary * mdict)

◆ mdict_iter_match_first()

struct symbol * mdict_iter_match_first ( const struct multidictionary * mdict,
const lookup_name_info & name,
struct mdict_iterator * miterator )

◆ mdict_iter_match_next()

struct symbol * mdict_iter_match_next ( const lookup_name_info & name,
struct mdict_iterator * miterator )

◆ mdict_iterator_first()

struct symbol * mdict_iterator_first ( const multidictionary * mdict,
struct mdict_iterator * miterator )

◆ mdict_iterator_next()

struct symbol * mdict_iterator_next ( struct mdict_iterator * miterator)

◆ mdict_size()

int mdict_size ( const struct multidictionary * mdict)

◆ size_hashed()

static int size_hashed ( const struct dictionary * dict)
static

Definition at line 651 of file dictionary.c.

References DICT_HASHED_BUCKET, DICT_HASHED_NBUCKETS, and symbol::hash_next.

◆ size_hashed_expandable()

static int size_hashed_expandable ( const struct dictionary * dict)
static

Definition at line 690 of file dictionary.c.

References DICT_HASHED_EXPANDABLE_NSYMS.

◆ size_linear()

static int size_linear ( const struct dictionary * dict)
static

Definition at line 870 of file dictionary.c.

References DICT_LINEAR_NSYMS.

Variable Documentation

◆ dict_hashed_expandable_vector

const struct dict_vector dict_hashed_expandable_vector
static
Initial value:
=
{
}
static struct symbol * iterator_first_hashed(const struct dictionary *dict, struct dict_iterator *iterator)
Definition dictionary.c:531
@ DICT_HASHED_EXPANDABLE
Definition dictionary.c:97
static struct symbol * iter_match_next_hashed(const lookup_name_info &name, struct dict_iterator *iterator)
Definition dictionary.c:609
static int size_hashed_expandable(const struct dictionary *dict)
Definition dictionary.c:690
static struct symbol * iterator_next_hashed(struct dict_iterator *iterator)
Definition dictionary.c:540
static void free_hashed_expandable(struct dictionary *dict)
Definition dictionary.c:670
static void add_symbol_hashed_expandable(struct dictionary *dict, struct symbol *sym)
Definition dictionary.c:677
static struct symbol * iter_match_first_hashed(const struct dictionary *dict, const lookup_name_info &name, struct dict_iterator *iterator)
Definition dictionary.c:578

Definition at line 300 of file dictionary.c.

Referenced by dict_create_hashed_expandable().

◆ dict_hashed_vector

const struct dict_vector dict_hashed_vector
static
Initial value:
=
{
}
static int size_hashed(const struct dictionary *dict)
Definition dictionary.c:651
@ DICT_HASHED
Definition dictionary.c:95
static void add_symbol_nonexpandable(struct dictionary *dict, struct symbol *sym)
Definition dictionary.c:523
static void free_obstack(struct dictionary *dict)
Definition dictionary.c:517

Definition at line 288 of file dictionary.c.

Referenced by dict_create_hashed().

◆ dict_linear_expandable_vector

const struct dict_vector dict_linear_expandable_vector
static
Initial value:
=
{
}
@ DICT_LINEAR_EXPANDABLE
Definition dictionary.c:101
static struct symbol * iter_match_first_linear(const struct dictionary *dict, const lookup_name_info &name, struct dict_iterator *iterator)
Definition dictionary.c:831
static struct symbol * iterator_next_linear(struct dict_iterator *iterator)
Definition dictionary.c:820
static struct symbol * iterator_first_linear(const struct dictionary *dict, struct dict_iterator *iterator)
Definition dictionary.c:811
static int size_linear(const struct dictionary *dict)
Definition dictionary.c:870
static void free_linear_expandable(struct dictionary *dict)
Definition dictionary.c:878
static void add_symbol_linear_expandable(struct dictionary *dict, struct symbol *sym)
Definition dictionary.c:886
static struct symbol * iter_match_next_linear(const lookup_name_info &name, struct dict_iterator *iterator)
Definition dictionary.c:842

Definition at line 324 of file dictionary.c.

Referenced by dict_create_linear_expandable().

◆ dict_linear_vector

const struct dict_vector dict_linear_vector
static