GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Functions
macrotab.c File Reference
#include "defs.h"
#include "gdbsupport/gdb_obstack.h"
#include "gdbsupport/pathstuff.h"
#include "splay-tree.h"
#include "filenames.h"
#include "symtab.h"
#include "symfile.h"
#include "objfiles.h"
#include "macrotab.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_keynew_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_filenew_source_file (struct macro_table *t, const char *filename)
 
static void free_macro_source_file (struct macro_source_file *src)
 
struct macro_source_filemacro_set_main (struct macro_table *t, const char *filename)
 
struct macro_source_filemacro_main (struct macro_table *t)
 
void macro_allow_redefinitions (struct macro_table *t)
 
struct macro_source_filemacro_include (struct macro_source_file *source, int line, const char *included)
 
struct macro_source_filemacro_lookup_inclusion (struct macro_source_file *source, const char *name)
 
static struct macro_definitionnew_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_keycheck_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_internal (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 special_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_definitionfixup_definition (const char *filename, int line, struct macro_definition *def)
 
struct macro_definitionmacro_lookup_definition (struct macro_source_file *source, int line, const char *name)
 
struct macro_source_filemacro_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, gdb::function_view< macro_callback_fn > fn)
 
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, gdb::function_view< macro_callback_fn > fn)
 
struct macro_tablenew_macro_table (struct obstack *obstack, gdb::bcache *b, struct compunit_symtab *cust)
 
void free_macro_table (struct macro_table *table)
 
std::string macro_source_fullname (struct macro_source_file *file)
 

Function Documentation

◆ check_for_redefinition()

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

◆ compare_locations()

static int compare_locations ( struct macro_source_file * file1,
int line1,
struct macro_source_file * file2,
int line2 )
static

◆ find_definition()

static splay_tree_node find_definition ( const char * name,
struct macro_source_file * file,
int line )
static

◆ fixup_definition()

static struct macro_definition * fixup_definition ( const char * filename,
int line,
struct macro_definition * def )
static

◆ foreach_macro()

static int foreach_macro ( splay_tree_node node,
void * arg )
static

◆ foreach_macro_in_scope()

static int foreach_macro_in_scope ( splay_tree_node node,
void * info )
static

◆ free_macro_source_file()

static void free_macro_source_file ( struct macro_source_file * src)
static

◆ free_macro_table()

void free_macro_table ( struct macro_table * table)

◆ inclusion_depth()

static int inclusion_depth ( struct macro_source_file * file)
static

Definition at line 189 of file macrotab.c.

Referenced by compare_locations(), and macro_lookup_inclusion().

◆ key_compare()

static int key_compare ( struct macro_key * key,
const char * name,
struct macro_source_file * file,
int line )
static

◆ macro_alloc()

static void * macro_alloc ( int size,
struct macro_table * t )
static

Definition at line 87 of file macrotab.c.

References macro_table::obstack, size, and xmalloc().

Referenced by new_macro_definition(), new_macro_key(), new_macro_table(), and new_source_file().

◆ macro_allow_redefinitions()

void macro_allow_redefinitions ( struct macro_table * t)

Definition at line 443 of file macrotab.c.

References macro_table::obstack, and macro_table::redef_ok.

◆ macro_bcache()

static const void * macro_bcache ( struct macro_table * t,
const void * addr,
int len )
static

Definition at line 114 of file macrotab.c.

References macro_table::bcache, gdb::bcache::insert(), and xmalloc().

Referenced by macro_bcache_str(), and new_macro_definition().

◆ macro_bcache_free()

static void macro_bcache_free ( struct macro_table * t,
void * obj )
static

Definition at line 141 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().

◆ macro_bcache_str()

static const char * macro_bcache_str ( struct macro_table * t,
const char * s )
static

Definition at line 132 of file macrotab.c.

References macro_bcache().

Referenced by new_macro_definition(), new_macro_key(), and new_source_file().

◆ macro_define_function()

void macro_define_function ( struct macro_source_file * source,
int line,
const char * name,
int argc,
const char ** argv,
const char * replacement )

◆ macro_define_internal()

static void macro_define_internal ( struct macro_source_file * source,
int line,
const char * name,
enum macro_kind kind,
int argc,
const char ** argv,
const char * replacement )
static

◆ macro_define_object()

void macro_define_object ( struct macro_source_file * source,
int line,
const char * name,
const char * replacement )

◆ macro_define_object_internal()

static void macro_define_object_internal ( struct macro_source_file * source,
int line,
const char * name,
const char * replacement,
enum macro_special_kind special_kind )
static

◆ macro_define_special()

void macro_define_special ( struct macro_table * table)

◆ macro_definition_location()

struct macro_source_file * macro_definition_location ( struct macro_source_file * source,
int line,
const char * name,
int * definition_line )

Definition at line 923 of file macrotab.c.

References find_definition(), name, macro_key::start_file, and macro_key::start_line.

Referenced by info_macro_command().

◆ macro_for_each()

void macro_for_each ( struct macro_table * table,
gdb::function_view< macro_callback_fn > fn )

◆ macro_for_each_in_scope()

void macro_for_each_in_scope ( struct macro_source_file * file,
int line,
gdb::function_view< macro_callback_fn > fn )

◆ macro_free()

static void macro_free ( void * object,
struct macro_table * t )
static

◆ macro_include()

struct macro_source_file * macro_include ( struct macro_source_file * source,
int line,
const char * included )

◆ macro_lookup_definition()

struct macro_definition * macro_lookup_definition ( struct macro_source_file * source,
int line,
const char * name )

◆ macro_lookup_inclusion()

struct macro_source_file * macro_lookup_inclusion ( struct macro_source_file * source,
const char * name )

◆ macro_main()

struct macro_source_file * macro_main ( struct macro_table * t)

◆ macro_set_main()

struct macro_source_file * macro_set_main ( struct macro_table * t,
const char * filename )

Definition at line 420 of file macrotab.c.

References macro_source_file::filename, macro_table::main_source, and new_source_file().

Referenced by macro_start_file().

◆ macro_source_fullname()

std::string macro_source_fullname ( struct macro_source_file * file)

◆ macro_tree_compare()

static int macro_tree_compare ( splay_tree_key untyped_key1,
splay_tree_key untyped_key2 )
static

Definition at line 337 of file macrotab.c.

References key_compare(), macro_key::name, macro_key::start_file, and macro_key::start_line.

Referenced by new_macro_table().

◆ macro_tree_delete_key()

static void macro_tree_delete_key ( void * untyped_key)
static

Definition at line 370 of file macrotab.c.

References macro_bcache_free(), macro_free(), macro_key::name, and macro_key::table.

Referenced by new_macro_table().

◆ macro_tree_delete_value()

static void macro_tree_delete_value ( void * untyped_definition)
static

◆ macro_undef()

void macro_undef ( struct macro_source_file * source,
int line,
const char * name )

◆ new_macro_definition()

static struct macro_definition * new_macro_definition ( struct macro_table * t,
enum macro_kind kind,
int argc,
const char ** argv,
const char * replacement )
static

◆ new_macro_key()

static struct macro_key * new_macro_key ( struct macro_table * t,
const char * name,
struct macro_source_file * file,
int line )
static

◆ new_macro_table()

struct macro_table * new_macro_table ( struct obstack * obstack,
gdb::bcache * b,
struct compunit_symtab * cust )

◆ new_source_file()

static struct macro_source_file * new_source_file ( struct macro_table * t,
const char * filename )
static

Definition at line 385 of file macrotab.c.

References f(), macro_source_file::filename, macro_alloc(), and macro_bcache_str().

Referenced by macro_include(), and macro_set_main().