GDB (xrefs)
|
#include "defs.h"
#include "gdb_obstack.h"
#include "bcache.h"
#include "macrotab.h"
#include "macroexp.h"
#include "gdb_assert.h"
#include "c-lang.h"
Go to the source code of this file.
Classes | |
struct | macro_buffer |
struct | macro_name_list |
Functions | |
static void | init_buffer (struct macro_buffer *b, int n) |
static void | init_shared_buffer (struct macro_buffer *buf, char *addr, int len) |
static void | free_buffer (struct macro_buffer *b) |
static char * | free_buffer_return_text (struct macro_buffer *b) |
static void | cleanup_macro_buffer (void *untyped_buf) |
static void | resize_buffer (struct macro_buffer *b, int n) |
static void | appendc (struct macro_buffer *b, int c) |
static void | appendmem (struct macro_buffer *b, char *addr, int len) |
int | macro_is_whitespace (int c) |
int | macro_is_digit (int c) |
int | macro_is_identifier_nondigit (int c) |
static void | set_token (struct macro_buffer *tok, char *start, char *end) |
static int | get_comment (struct macro_buffer *tok, char *p, char *end) |
static int | get_identifier (struct macro_buffer *tok, char *p, char *end) |
static int | get_pp_number (struct macro_buffer *tok, char *p, char *end) |
static int | get_character_constant (struct macro_buffer *tok, char *p, char *end) |
static int | get_string_literal (struct macro_buffer *tok, char *p, char *end) |
static int | get_punctuator (struct macro_buffer *tok, char *p, char *end) |
static int | get_token (struct macro_buffer *tok, struct macro_buffer *src) |
static void | append_tokens_without_splicing (struct macro_buffer *dest, struct macro_buffer *src) |
static void | stringify (struct macro_buffer *dest, const char *arg, int len) |
char * | macro_stringify (const char *str) |
static int | currently_rescanning (struct macro_name_list *list, const char *name) |
static struct macro_buffer * | gather_arguments (const char *name, struct macro_buffer *src, int nargs, int *argc_p) |
static void | scan (struct macro_buffer *dest, struct macro_buffer *src, struct macro_name_list *no_loop, macro_lookup_ftype *lookup_func, void *lookup_baton) |
static int | find_parameter (const struct macro_buffer *tok, int is_varargs, const struct macro_buffer *va_arg_name, int argc, const char *const *argv) |
static void | substitute_args (struct macro_buffer *dest, struct macro_definition *def, int is_varargs, const struct macro_buffer *va_arg_name, int argc, struct macro_buffer *argv, struct macro_name_list *no_loop, macro_lookup_ftype *lookup_func, void *lookup_baton) |
static int | expand (const char *id, struct macro_definition *def, struct macro_buffer *dest, struct macro_buffer *src, struct macro_name_list *no_loop, macro_lookup_ftype *lookup_func, void *lookup_baton) |
static int | maybe_expand (struct macro_buffer *dest, struct macro_buffer *src_first, struct macro_buffer *src_rest, struct macro_name_list *no_loop, macro_lookup_ftype *lookup_func, void *lookup_baton) |
char * | macro_expand (const char *source, macro_lookup_ftype *lookup_func, void *lookup_func_baton) |
char * | macro_expand_once (const char *source, macro_lookup_ftype *lookup_func, void *lookup_func_baton) |
char * | macro_expand_next (const char **lexptr, macro_lookup_ftype *lookup_func, void *lookup_baton) |
static void append_tokens_without_splicing | ( | struct macro_buffer * | dest, |
struct macro_buffer * | src | ||
) | [static] |
Definition at line 585 of file macroexp.c.
References _, appendc(), appendmem(), gdb_assert, get_token(), init_shared_buffer(), internal_error(), macro_buffer::last_token, macro_buffer::len, and macro_buffer::text.
Referenced by scan(), and substitute_args().
static void appendc | ( | struct macro_buffer * | b, |
int | c | ||
) | [static] |
Definition at line 156 of file macroexp.c.
References macro_buffer::len, resize_buffer(), macro_buffer::size, and macro_buffer::text.
Referenced by append_tokens_without_splicing(), macro_expand(), macro_expand_next(), macro_stringify(), and stringify().
static void appendmem | ( | struct macro_buffer * | b, |
char * | addr, | ||
int | len | ||
) | [static] |
Definition at line 170 of file macroexp.c.
References macro_buffer::len, len, memcpy(), resize_buffer(), macro_buffer::size, and macro_buffer::text.
Referenced by append_tokens_without_splicing(), scan(), and substitute_args().
static void cleanup_macro_buffer | ( | void * | untyped_buf | ) | [static] |
Definition at line 130 of file macroexp.c.
References free_buffer().
Referenced by expand(), macro_expand(), and macro_expand_next().
static int currently_rescanning | ( | struct macro_name_list * | list, |
const char * | name | ||
) | [static] |
Definition at line 738 of file macroexp.c.
References macro_name_list::name, and macro_name_list::next.
Referenced by maybe_expand().
static int expand | ( | const char * | id, |
struct macro_definition * | def, | ||
struct macro_buffer * | dest, | ||
struct macro_buffer * | src, | ||
struct macro_name_list * | no_loop, | ||
macro_lookup_ftype * | lookup_func, | ||
void * | lookup_baton | ||
) | [static] |
Definition at line 1179 of file macroexp.c.
References _, macro_definition::argc, macro_definition::argv, cleanup_macro_buffer(), do_cleanups(), error(), free_current_contents(), gather_arguments(), init_buffer(), init_shared_buffer(), internal_error(), macro_buffer::len, len, macro_function_like, macro_object_like, make_cleanup(), macro_name_list::name, macro_name_list::next, null_cleanup(), macro_definition::replacement, scan(), substitute_args(), and macro_buffer::text.
Referenced by maybe_expand().
static int find_parameter | ( | const struct macro_buffer * | tok, |
int | is_varargs, | ||
const struct macro_buffer * | va_arg_name, | ||
int | argc, | ||
const char *const * | argv | ||
) | [static] |
Definition at line 924 of file macroexp.c.
References macro_buffer::is_identifier, macro_buffer::len, memcmp(), and macro_buffer::text.
Referenced by substitute_args().
static void free_buffer | ( | struct macro_buffer * | b | ) | [static] |
Definition at line 109 of file macroexp.c.
References gdb_assert, macro_buffer::shared, macro_buffer::size, macro_buffer::text, and xfree().
Referenced by cleanup_macro_buffer().
static char* free_buffer_return_text | ( | struct macro_buffer * | b | ) | [static] |
Definition at line 120 of file macroexp.c.
References gdb_assert, macro_buffer::shared, macro_buffer::size, and macro_buffer::text.
Referenced by macro_stringify().
static struct macro_buffer* gather_arguments | ( | const char * | name, |
struct macro_buffer * | src, | ||
int | nargs, | ||
int * | argc_p | ||
) | [static, read] |
Definition at line 788 of file macroexp.c.
References _, discard_cleanups(), error(), free_current_contents(), get_token(), init_shared_buffer(), macro_buffer::last_token, macro_buffer::len, make_cleanup(), set_token(), macro_buffer::text, xmalloc(), and xrealloc().
Referenced by expand().
static int get_character_constant | ( | struct macro_buffer * | tok, |
char * | p, | ||
char * | end | ||
) | [static] |
Definition at line 328 of file macroexp.c.
References _, c_parse_escape(), error(), gdb_assert_not_reached, and set_token().
Referenced by get_token().
static int get_comment | ( | struct macro_buffer * | tok, |
char * | p, | ||
char * | end | ||
) | [static] |
Definition at line 225 of file macroexp.c.
References _, error(), and set_token().
Referenced by get_token().
static int get_identifier | ( | struct macro_buffer * | tok, |
char * | p, | ||
char * | end | ||
) | [static] |
Definition at line 267 of file macroexp.c.
References macro_buffer::is_identifier, macro_is_digit(), macro_is_identifier_nondigit(), and set_token().
Referenced by get_token().
static int get_pp_number | ( | struct macro_buffer * | tok, |
char * | p, | ||
char * | end | ||
) | [static] |
Definition at line 289 of file macroexp.c.
References macro_is_digit(), macro_is_identifier_nondigit(), set_token(), and strchr().
Referenced by get_token().
static int get_punctuator | ( | struct macro_buffer * | tok, |
char * | p, | ||
char * | end | ||
) | [static] |
Definition at line 439 of file macroexp.c.
References len, memcmp(), and set_token().
Referenced by get_token().
static int get_string_literal | ( | struct macro_buffer * | tok, |
char * | p, | ||
char * | end | ||
) | [static] |
Definition at line 389 of file macroexp.c.
References _, c_parse_escape(), error(), gdb_assert_not_reached, and set_token().
Referenced by get_token().
static int get_token | ( | struct macro_buffer * | tok, |
struct macro_buffer * | src | ||
) | [static] |
Definition at line 500 of file macroexp.c.
References gdb_assert, get_character_constant(), get_comment(), get_identifier(), get_pp_number(), get_punctuator(), get_string_literal(), macro_buffer::len, macro_is_whitespace(), p, set_token(), macro_buffer::shared, and macro_buffer::text.
Referenced by append_tokens_without_splicing(), gather_arguments(), macro_expand_next(), scan(), and substitute_args().
static void init_buffer | ( | struct macro_buffer * | b, |
int | n | ||
) | [static] |
Definition at line 81 of file macroexp.c.
References macro_buffer::last_token, macro_buffer::len, macro_buffer::shared, macro_buffer::size, macro_buffer::text, and xmalloc().
Referenced by expand(), macro_expand(), macro_expand_next(), and macro_stringify().
static void init_shared_buffer | ( | struct macro_buffer * | buf, |
char * | addr, | ||
int | len | ||
) | [static] |
Definition at line 97 of file macroexp.c.
References macro_buffer::last_token, macro_buffer::len, len, macro_buffer::shared, macro_buffer::size, and macro_buffer::text.
Referenced by append_tokens_without_splicing(), expand(), gather_arguments(), macro_expand(), macro_expand_next(), set_token(), and substitute_args().
char* macro_expand | ( | const char * | source, |
macro_lookup_ftype * | lookup_func, | ||
void * | lookup_func_baton | ||
) |
Definition at line 1411 of file macroexp.c.
References appendc(), cleanup_macro_buffer(), discard_cleanups(), init_buffer(), init_shared_buffer(), macro_buffer::last_token, make_cleanup(), scan(), and macro_buffer::text.
Referenced by macro_expand_command().
char* macro_expand_next | ( | const char ** | lexptr, |
macro_lookup_ftype * | lookup_func, | ||
void * | lookup_baton | ||
) |
Definition at line 1443 of file macroexp.c.
References appendc(), cleanup_macro_buffer(), discard_cleanups(), do_cleanups(), get_token(), init_buffer(), init_shared_buffer(), macro_buffer::last_token, make_cleanup(), maybe_expand(), and macro_buffer::text.
Referenced by lex_one_token().
char* macro_expand_once | ( | const char * | source, |
macro_lookup_ftype * | lookup_func, | ||
void * | lookup_func_baton | ||
) |
Definition at line 1434 of file macroexp.c.
Referenced by macro_expand_once_command().
int macro_is_digit | ( | int | c | ) |
Definition at line 198 of file macroexp.c.
Referenced by extract_identifier(), get_identifier(), and get_pp_number().
Definition at line 205 of file macroexp.c.
Referenced by extract_identifier(), get_identifier(), and get_pp_number().
int macro_is_whitespace | ( | int | c | ) |
Definition at line 187 of file macroexp.c.
Referenced by get_token(), skip_ws(), and stringify().
char* macro_stringify | ( | const char * | str | ) |
Definition at line 703 of file macroexp.c.
References appendc(), free_buffer_return_text(), init_buffer(), len, and stringify().
Referenced by fixup_definition().
static int maybe_expand | ( | struct macro_buffer * | dest, |
struct macro_buffer * | src_first, | ||
struct macro_buffer * | src_rest, | ||
struct macro_name_list * | no_loop, | ||
macro_lookup_ftype * | lookup_func, | ||
void * | lookup_baton | ||
) | [static] |
Definition at line 1318 of file macroexp.c.
References currently_rescanning(), do_cleanups(), expand(), gdb_assert, macro_buffer::is_identifier, macro_buffer::len, make_cleanup(), memcpy(), macro_buffer::shared, macro_buffer::text, xfree(), and xmalloc().
Referenced by macro_expand_next(), and scan().
static void resize_buffer | ( | struct macro_buffer * | b, |
int | n | ||
) | [static] |
Definition at line 139 of file macroexp.c.
References gdb_assert, macro_buffer::shared, macro_buffer::size, macro_buffer::text, and xrealloc().
Referenced by appendc(), and appendmem().
static void scan | ( | struct macro_buffer * | dest, |
struct macro_buffer * | src, | ||
struct macro_name_list * | no_loop, | ||
macro_lookup_ftype * | lookup_func, | ||
void * | lookup_baton | ||
) | [static] |
Definition at line 1368 of file macroexp.c.
References append_tokens_without_splicing(), appendmem(), gdb_assert, get_token(), macro_buffer::last_token, macro_buffer::len, maybe_expand(), macro_buffer::shared, and macro_buffer::text.
Referenced by attach_fields_to_type(), expand(), find_toplevel_char(), gnu_write_inferior(), int_to_threadref(), longlong_hexchars(), macro_expand(), remove_qualifiers(), skip_quoted_chars(), substitute_args(), and threadref_to_int().
static void set_token | ( | struct macro_buffer * | tok, |
char * | start, | ||
char * | end | ||
) | [static] |
Definition at line 214 of file macroexp.c.
References init_shared_buffer(), macro_buffer::is_identifier, and macro_buffer::last_token.
Referenced by gather_arguments(), get_character_constant(), get_comment(), get_identifier(), get_pp_number(), get_punctuator(), get_string_literal(), and get_token().
static void stringify | ( | struct macro_buffer * | dest, |
const char * | arg, | ||
int | len | ||
) | [static] |
Definition at line 657 of file macroexp.c.
References appendc(), macro_buffer::last_token, macro_buffer::len, len, and macro_is_whitespace().
Referenced by macro_stringify(), and substitute_args().
static void substitute_args | ( | struct macro_buffer * | dest, |
struct macro_definition * | def, | ||
int | is_varargs, | ||
const struct macro_buffer * | va_arg_name, | ||
int | argc, | ||
struct macro_buffer * | argv, | ||
struct macro_name_list * | no_loop, | ||
macro_lookup_ftype * | lookup_func, | ||
void * | lookup_baton | ||
) | [static] |
Definition at line 961 of file macroexp.c.
References _, append_tokens_without_splicing(), appendmem(), macro_definition::argc, macro_definition::argv, error(), find_parameter(), gdb_assert, get_token(), init_shared_buffer(), macro_buffer::last_token, macro_buffer::len, len, memcmp(), macro_definition::replacement, scan(), stringify(), and macro_buffer::text.
Referenced by expand().