GDB (xrefs)
|
#include "defs.h"
#include "gdb_obstack.h"
#include "splay-tree.h"
#include "filenames.h"
#include "symtab.h"
#include "symfile.h"
#include "objfiles.h"
#include "macrotab.h"
#include "gdb_assert.h"
#include "bcache.h"
#include "complaints.h"
#include "macroexp.h"
Go to the source code of this file.
Classes | |
struct | macro_table |
struct | macro_key |
struct | macro_for_each_data |
Functions | |
static void * | macro_alloc (int size, struct macro_table *t) |
static void | macro_free (void *object, struct macro_table *t) |
static const void * | macro_bcache (struct macro_table *t, const void *addr, int len) |
static const char * | macro_bcache_str (struct macro_table *t, const char *s) |
static void | macro_bcache_free (struct macro_table *t, void *obj) |
static int | inclusion_depth (struct macro_source_file *file) |
static int | compare_locations (struct macro_source_file *file1, int line1, struct macro_source_file *file2, int line2) |
static int | key_compare (struct macro_key *key, const char *name, struct macro_source_file *file, int line) |
static int | macro_tree_compare (splay_tree_key untyped_key1, splay_tree_key untyped_key2) |
static struct macro_key * | new_macro_key (struct macro_table *t, const char *name, struct macro_source_file *file, int line) |
static void | macro_tree_delete_key (void *untyped_key) |
static struct macro_source_file * | new_source_file (struct macro_table *t, const char *filename) |
static void | free_macro_source_file (struct macro_source_file *src) |
struct macro_source_file * | macro_set_main (struct macro_table *t, const char *filename) |
struct macro_source_file * | macro_main (struct macro_table *t) |
void | macro_allow_redefinitions (struct macro_table *t) |
struct macro_source_file * | macro_include (struct macro_source_file *source, int line, const char *included) |
struct macro_source_file * | macro_lookup_inclusion (struct macro_source_file *source, const char *name) |
static struct macro_definition * | new_macro_definition (struct macro_table *t, enum macro_kind kind, int argc, const char **argv, const char *replacement) |
static void | macro_tree_delete_value (void *untyped_definition) |
static splay_tree_node | find_definition (const char *name, struct macro_source_file *file, int line) |
static struct macro_key * | check_for_redefinition (struct macro_source_file *source, int line, const char *name, enum macro_kind kind, int argc, const char **argv, const char *replacement) |
static void | macro_define_object_internal (struct macro_source_file *source, int line, const char *name, const char *replacement, enum macro_special_kind kind) |
void | macro_define_object (struct macro_source_file *source, int line, const char *name, const char *replacement) |
void | macro_define_special (struct macro_table *table) |
void | macro_define_function (struct macro_source_file *source, int line, const char *name, int argc, const char **argv, const char *replacement) |
void | macro_undef (struct macro_source_file *source, int line, const char *name) |
static struct macro_definition * | fixup_definition (const char *filename, int line, struct macro_definition *def) |
struct macro_definition * | macro_lookup_definition (struct macro_source_file *source, int line, const char *name) |
struct macro_source_file * | macro_definition_location (struct macro_source_file *source, int line, const char *name, int *definition_line) |
static int | foreach_macro (splay_tree_node node, void *arg) |
void | macro_for_each (struct macro_table *table, macro_callback_fn fn, void *user_data) |
static int | foreach_macro_in_scope (splay_tree_node node, void *info) |
void | macro_for_each_in_scope (struct macro_source_file *file, int line, macro_callback_fn fn, void *user_data) |
struct macro_table * | new_macro_table (struct obstack *obstack, struct bcache *b, const char *comp_dir) |
void | free_macro_table (struct macro_table *table) |
char * | macro_source_fullname (struct macro_source_file *file) |
static struct macro_key* check_for_redefinition | ( | struct macro_source_file * | source, |
int | line, | ||
const char * | name, | ||
enum macro_kind | kind, | ||
int | argc, | ||
const char ** | argv, | ||
const char * | replacement | ||
) | [static, read] |
Definition at line 687 of file macrotab.c.
References _, complaint(), find_definition(), macro_function_like, macro_source_fullname(), macro_key::start_file, macro_key::start_line, symfile_complaints, and xfree().
Referenced by macro_define_function(), and macro_define_object_internal().
static int compare_locations | ( | struct macro_source_file * | file1, |
int | line1, | ||
struct macro_source_file * | file2, | ||
int | line2 | ||
) | [static] |
Definition at line 217 of file macrotab.c.
References gdb_assert, macro_source_file::included_at_line, macro_source_file::included_by, and inclusion_depth().
Referenced by find_definition(), foreach_macro_in_scope(), and key_compare().
static splay_tree_node find_definition | ( | const char * | name, |
struct macro_source_file * | file, | ||
int | line | ||
) | [static] |
Definition at line 626 of file macrotab.c.
References compare_locations(), macro_table::definitions, macro_key::end_file, macro_key::end_line, line, name, macro_key::name, macro_key::start_file, macro_key::start_line, and macro_source_file::table.
Referenced by check_for_redefinition(), macro_definition_location(), macro_lookup_definition(), and macro_undef().
static struct macro_definition* fixup_definition | ( | const char * | filename, |
int | line, | ||
struct macro_definition * | def | ||
) | [static, read] |
Definition at line 893 of file macrotab.c.
References macro_definition::argc, macro_FILE, macro_LINE, macro_object_like, macro_stringify(), macro_definition::replacement, xfree(), and xstrprintf().
Referenced by foreach_macro(), foreach_macro_in_scope(), and macro_lookup_definition().
static int foreach_macro | ( | splay_tree_node | node, |
void * | arg | ||
) | [static] |
Definition at line 975 of file macrotab.c.
References fixup_definition(), macro_for_each_data::fn, macro_source_fullname(), macro_key::name, macro_key::start_file, macro_key::start_line, macro_for_each_data::user_data, and xfree().
Referenced by macro_for_each().
static int foreach_macro_in_scope | ( | splay_tree_node | node, |
void * | info | ||
) | [static] |
Definition at line 1007 of file macrotab.c.
References compare_locations(), macro_key::end_file, macro_key::end_line, macro_for_each_data::file, fixup_definition(), macro_for_each_data::fn, macro_for_each_data::line, macro_source_fullname(), macro_key::name, macro_key::start_file, macro_key::start_line, macro_for_each_data::user_data, and xfree().
Referenced by macro_for_each_in_scope().
static void free_macro_source_file | ( | struct macro_source_file * | src | ) | [static] |
Definition at line 403 of file macrotab.c.
References macro_source_file::filename, macro_source_file::includes, macro_bcache_free(), macro_free(), macro_source_file::next_included, and macro_source_file::table.
Referenced by free_macro_table().
void free_macro_table | ( | struct macro_table * | table | ) |
Definition at line 1082 of file macrotab.c.
References macro_table::definitions, free_macro_source_file(), and macro_table::main_source.
Referenced by really_free_pendings().
static int inclusion_depth | ( | struct macro_source_file * | file | ) | [static] |
Definition at line 190 of file macrotab.c.
References macro_source_file::included_by.
Referenced by compare_locations(), and macro_lookup_inclusion().
static int key_compare | ( | struct macro_key * | key, |
const char * | name, | ||
struct macro_source_file * | file, | ||
int | line | ||
) | [static] |
Definition at line 322 of file macrotab.c.
References compare_locations(), macro_key::name, macro_key::start_file, and macro_key::start_line.
Referenced by macro_define_function(), macro_define_object_internal(), and macro_tree_compare().
static void* macro_alloc | ( | int | size, |
struct macro_table * | t | ||
) | [static] |
Definition at line 88 of file macrotab.c.
References macro_table::obstack, and xmalloc().
Referenced by new_macro_definition(), new_macro_key(), new_macro_table(), and new_source_file().
void macro_allow_redefinitions | ( | struct macro_table * | t | ) |
Definition at line 443 of file macrotab.c.
References gdb_assert, macro_table::obstack, and macro_table::redef_ok.
Referenced by _initialize_macroscope().
static const void* macro_bcache | ( | struct macro_table * | t, |
const void * | addr, | ||
int | len | ||
) | [static] |
Definition at line 115 of file macrotab.c.
References macro_table::bcache, bcache(), memcpy(), and xmalloc().
Referenced by macro_bcache_str(), and new_macro_definition().
static void macro_bcache_free | ( | struct macro_table * | t, |
void * | obj | ||
) | [static] |
Definition at line 142 of file macrotab.c.
References macro_table::bcache, and xfree().
Referenced by free_macro_source_file(), macro_tree_delete_key(), and macro_tree_delete_value().
static const char* macro_bcache_str | ( | struct macro_table * | t, |
const char * | s | ||
) | [static] |
Definition at line 133 of file macrotab.c.
References macro_bcache().
Referenced by new_macro_definition(), new_macro_key(), and new_source_file().
void macro_define_function | ( | struct macro_source_file * | source, |
int | line, | ||
const char * | name, | ||
int | argc, | ||
const char ** | argv, | ||
const char * | replacement | ||
) |
Definition at line 802 of file macrotab.c.
References check_for_redefinition(), macro_table::definitions, key_compare(), macro_function_like, new_macro_definition(), new_macro_key(), macro_table::redef_ok, and macro_source_file::table.
Referenced by macro_define_command(), and parse_macro_definition().
void macro_define_object | ( | struct macro_source_file * | source, |
int | line, | ||
const char * | name, | ||
const char * | replacement | ||
) |
Definition at line 783 of file macrotab.c.
References macro_define_object_internal(), and macro_ordinary.
Referenced by macro_define_command(), and parse_macro_definition().
static void macro_define_object_internal | ( | struct macro_source_file * | source, |
int | line, | ||
const char * | name, | ||
const char * | replacement, | ||
enum macro_special_kind | kind | ||
) | [static] |
Definition at line 750 of file macrotab.c.
References check_for_redefinition(), macro_table::definitions, key_compare(), macro_object_like, new_macro_definition(), new_macro_key(), macro_table::redef_ok, and macro_source_file::table.
Referenced by macro_define_object(), and macro_define_special().
void macro_define_special | ( | struct macro_table * | table | ) |
Definition at line 793 of file macrotab.c.
References macro_define_object_internal(), macro_FILE, macro_LINE, and macro_table::main_source.
Referenced by macro_start_file().
struct macro_source_file* macro_definition_location | ( | struct macro_source_file * | source, |
int | line, | ||
const char * | name, | ||
int * | definition_line | ||
) | [read] |
Definition at line 943 of file macrotab.c.
References find_definition(), macro_key::start_file, and macro_key::start_line.
Referenced by info_macro_command().
void macro_for_each | ( | struct macro_table * | table, |
macro_callback_fn | fn, | ||
void * | user_data | ||
) |
Definition at line 994 of file macrotab.c.
References macro_table::definitions, macro_for_each_data::file, macro_for_each_data::fn, foreach_macro(), macro_for_each_data::line, and macro_for_each_data::user_data.
Referenced by info_macro_command(), and macro_list_command().
void macro_for_each_in_scope | ( | struct macro_source_file * | file, |
int | line, | ||
macro_callback_fn | fn, | ||
void * | user_data | ||
) |
Definition at line 1033 of file macrotab.c.
References macro_table::definitions, macro_for_each_data::file, macro_for_each_data::fn, foreach_macro_in_scope(), macro_for_each_data::line, line, macro_source_file::table, and macro_for_each_data::user_data.
Referenced by info_macros_command().
static void macro_free | ( | void * | object, |
struct macro_table * | t | ||
) | [static] |
Definition at line 98 of file macrotab.c.
References macro_table::obstack, and xfree().
Referenced by free_macro_source_file(), macro_tree_delete_key(), macro_tree_delete_value(), and new_macro_table().
struct macro_source_file* macro_include | ( | struct macro_source_file * | source, |
int | line, | ||
const char * | included | ||
) | [read] |
Definition at line 451 of file macrotab.c.
References _, complaint(), macro_source_file::included_at_line, macro_source_file::includes, line, macro_source_fullname(), new_source_file(), macro_source_file::next_included, symfile_complaints, macro_source_file::table, and xfree().
Referenced by macro_start_file().
struct macro_definition* macro_lookup_definition | ( | struct macro_source_file * | source, |
int | line, | ||
const char * | name | ||
) | [read] |
Definition at line 921 of file macrotab.c.
References find_definition(), fixup_definition(), macro_source_fullname(), and xfree().
Referenced by info_macro_command(), and standard_macro_lookup().
struct macro_source_file* macro_lookup_inclusion | ( | struct macro_source_file * | source, |
const char * | name | ||
) | [read] |
Definition at line 512 of file macrotab.c.
References macro_source_file::filename, macro_source_file::includes, inclusion_depth(), macro_lookup_inclusion(), and macro_source_file::next_included.
Referenced by macro_lookup_inclusion(), and sal_macro_scope().
struct macro_source_file* macro_main | ( | struct macro_table * | t | ) | [read] |
Definition at line 434 of file macrotab.c.
References gdb_assert, and macro_table::main_source.
Referenced by macro_define_command(), macro_undef_command(), sal_macro_scope(), standard_macro_lookup(), and user_macro_scope().
struct macro_source_file* macro_set_main | ( | struct macro_table * | t, |
const char * | filename | ||
) | [read] |
Definition at line 420 of file macrotab.c.
References gdb_assert, macro_table::main_source, and new_source_file().
Referenced by _initialize_macroscope(), and macro_start_file().
char* macro_source_fullname | ( | struct macro_source_file * | file | ) |
Definition at line 1094 of file macrotab.c.
References macro_table::comp_dir, macro_source_file::filename, and macro_source_file::table.
Referenced by check_for_redefinition(), foreach_macro(), foreach_macro_in_scope(), macro_include(), macro_lookup_definition(), macro_undef(), and show_pp_source_pos().
static int macro_tree_compare | ( | splay_tree_key | untyped_key1, |
splay_tree_key | untyped_key2 | ||
) | [static] |
Definition at line 338 of file macrotab.c.
References key_compare(), macro_key::name, macro_key::start_file, and macro_key::start_line.
Referenced by new_macro_table().
static void macro_tree_delete_key | ( | void * | untyped_key | ) | [static] |
Definition at line 371 of file macrotab.c.
References macro_bcache_free(), macro_free(), macro_key::name, and macro_key::table.
Referenced by new_macro_table().
static void macro_tree_delete_value | ( | void * | untyped_definition | ) | [static] |
Definition at line 604 of file macrotab.c.
References macro_definition::argc, macro_definition::argv, macro_bcache_free(), macro_free(), macro_function_like, macro_definition::replacement, and macro_definition::table.
Referenced by new_macro_table().
void macro_undef | ( | struct macro_source_file * | source, |
int | line, | ||
const char * | name | ||
) |
Definition at line 830 of file macrotab.c.
References _, complaint(), macro_table::definitions, macro_key::end_file, macro_key::end_line, macro_source_file::filename, find_definition(), line, macro_source_fullname(), macro_key::start_file, macro_key::start_line, symfile_complaints, macro_source_file::table, and xfree().
Referenced by dwarf_decode_macro_bytes(), and macro_undef_command().
static struct macro_definition* new_macro_definition | ( | struct macro_table * | t, |
enum macro_kind | kind, | ||
int | argc, | ||
const char ** | argv, | ||
const char * | replacement | ||
) | [static, read] |
Definition at line 553 of file macrotab.c.
References macro_definition::argc, macro_definition::argv, macro_alloc(), macro_bcache(), macro_bcache_str(), macro_function_like, memset(), macro_definition::replacement, and macro_definition::table.
Referenced by macro_define_function(), and macro_define_object_internal().
static struct macro_key* new_macro_key | ( | struct macro_table * | t, |
const char * | name, | ||
struct macro_source_file * | file, | ||
int | line | ||
) | [static, read] |
Definition at line 352 of file macrotab.c.
References macro_key::end_file, line, macro_alloc(), macro_bcache_str(), memset(), macro_key::name, macro_key::start_file, macro_key::start_line, and macro_key::table.
Referenced by macro_define_function(), and macro_define_object_internal().
struct macro_table* new_macro_table | ( | struct obstack * | obstack, |
struct bcache * | b, | ||
const char * | comp_dir | ||
) | [read] |
Definition at line 1052 of file macrotab.c.
References macro_table::bcache, macro_table::comp_dir, macro_table::definitions, macro_alloc(), macro_free(), macro_tree_compare(), macro_tree_delete_key(), macro_tree_delete_value(), macro_table::main_source, memset(), macro_table::obstack, macro_table::redef_ok, and xmalloc().
Referenced by _initialize_macroscope(), and get_macro_table().
static struct macro_source_file* new_source_file | ( | struct macro_table * | t, |
const char * | filename | ||
) | [static, read] |
Definition at line 386 of file macrotab.c.
References macro_source_file::filename, macro_source_file::includes, macro_alloc(), macro_bcache_str(), memset(), and macro_source_file::table.
Referenced by macro_include(), and macro_set_main().