GDB (xrefs)

Macros | Enumerations | Functions | Variables
/tmp/gdb-8.1/gdb/c-lang.c File Reference
`#include "defs.h"`
`#include "symtab.h"`
`#include "gdbtypes.h"`
`#include "expression.h"`
`#include "parser-defs.h"`
`#include "language.h"`
`#include "varobj.h"`
`#include "c-lang.h"`
`#include "valprint.h"`
`#include "macroscope.h"`
`#include "charset.h"`
`#include "demangle.h"`
`#include "cp-abi.h"`
`#include "cp-support.h"`
`#include "gdb_obstack.h"`
`#include <ctype.h>`
`#include "gdbcore.h"`

Go to the source code of this file.

## Macros
#define | ADVANCE

## Enumerations
enum | c_primitive_types { c_primitive_type_int, c_primitive_type_long, c_primitive_type_short, c_primitive_type_char, c_primitive_type_float, c_primitive_type_double, c_primitive_type_void, c_primitive_type_long_long, c_primitive_type_signed_char, c_primitive_type_unsigned_char, c_primitive_type_unsigned_short, c_primitive_type_unsigned_int, c_primitive_type_unsigned_long, c_primitive_type_unsigned_long_long, c_primitive_type_long_double, c_primitive_type_complex, c_primitive_type_double_complex, c_primitive_type_decfloat, c_primitive_type_decdouble, c_primitive_type_declong, nr_c_primitive_types }
enum | cplus_primitive_types { cplus_primitive_type_int, cplus_primitive_type_long, cplus_primitive_type_short, cplus_primitive_type_char, cplus_primitive_type_float, cplus_primitive_type_double, cplus_primitive_type_void, cplus_primitive_type_long_long, cplus_primitive_type_signed_char, cplus_primitive_type_unsigned_char, cplus_primitive_type_unsigned_short, cplus_primitive_type_unsigned_int, cplus_primitive_type_unsigned_long, cplus_primitive_type_unsigned_long_long, cplus_primitive_type_long_double, cplus_primitive_type_complex, cplus_primitive_type_double_complex, cplus_primitive_type_bool, cplus_primitive_type_decfloat, cplus_primitive_type_decdouble, cplus_primitive_type_declong, cplus_primitive_type_char16_t, cplus_primitive_type_char32_t, cplus_primitive_type_wchar_t, nr_cplus_primitive_types }

## Functions
static const char * | charset_for_string_type (c_string_type str_type, struct gdbarch *gdbarch)
static c_string_type | classify_type (struct type *elttype, struct gdbarch *gdbarch, const char **encoding)
void | c_emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
void | c_printchar (int c, struct type *type, struct ui_file *stream)
void | c_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string, unsigned int length, const char *user_encoding, int force_ellipses, const struct value_print_options *options)
void | c_get_string (struct value *value, gdb_byte **buffer, int *length, struct type **char_type, const char **charset)
static char * | convert_ucn (char *p, char *limit, const char *dest_charset, struct obstack *output, int length)
static void | emit_numeric_character (struct type *type, unsigned long value, struct obstack *output)
static char * | convert_octal (struct type *type, char *p, char *limit, struct obstack *output)
static char * | convert_hex (struct type *type, char *p, char *limit, struct obstack *output)
static char * | convert_escape (struct type *type, const char *dest_charset, char *p, char *limit, struct obstack *output)
static void | parse_one_string (struct obstack *output, char *data, int len, const char *dest_charset, struct type *type)
struct value * | evaluate_subexp_c (struct type *expect_type, struct expression *exp, int *pos, enum noside noside)
gdb::unique_xmalloc_ptr< char > | c_watch_location_expression (struct type *type, CORE_ADDR addr)
void | c_language_arch_info (struct gdbarch *gdbarch, struct language_arch_info *lai)
static void | cplus_language_arch_info (struct gdbarch *gdbarch, struct language_arch_info *lai)

## Variables
const struct op_print | c_op_print_tab []
const struct exp_descriptor | exp_descriptor_c
static const char * | c_extensions []
const struct language_defn | c_language_defn
static const char * | cplus_extensions []
const struct language_defn | cplus_language_defn
static const char * | asm_extensions []
const struct language_defn | asm_language_defn
const struct language_defn | minimal_language_defn

## Macro Definition Documentation

## ◆ ADVANCE

#define ADVANCE

Value:
do { \
++p; \
if (p == limit) \
error (_("Malformed escape sequence")); \
} while (0)
_
#define _(String)
Definition: gdb_locale.h:35

Definition at line 461 of file c-lang.c.

Referenced by convert_escape().

## Enumeration Type Documentation

## ◆ c_primitive_types

enum c_primitive_types

Enumerator
c_primitive_type_int |
c_primitive_type_long |
c_primitive_type_short |
c_primitive_type_char |
c_primitive_type_float |
c_primitive_type_double |
c_primitive_type_void |
c_primitive_type_long_long |
c_primitive_type_signed_char |
c_primitive_type_unsigned_char |
c_primitive_type_unsigned_short |
c_primitive_type_unsigned_int |
c_primitive_type_unsigned_long |
c_primitive_type_unsigned_long_long |
c_primitive_type_long_double |
c_primitive_type_complex |
c_primitive_type_double_complex |
c_primitive_type_decfloat |
c_primitive_type_decdouble |
c_primitive_type_declong |
nr_c_primitive_types |

Definition at line 759 of file c-lang.c.

## ◆ cplus_primitive_types

enum cplus_primitive_types

Enumerator
cplus_primitive_type_int |
cplus_primitive_type_long |
cplus_primitive_type_short |
cplus_primitive_type_char |
cplus_primitive_type_float |
cplus_primitive_type_double |
cplus_primitive_type_void |
cplus_primitive_type_long_long |
cplus_primitive_type_signed_char |
cplus_primitive_type_unsigned_char |
cplus_primitive_type_unsigned_short |
cplus_primitive_type_unsigned_int |
cplus_primitive_type_unsigned_long |
cplus_primitive_type_unsigned_long_long |
cplus_primitive_type_long_double |
cplus_primitive_type_complex |
cplus_primitive_type_double_complex |
cplus_primitive_type_bool |
cplus_primitive_type_decfloat |
cplus_primitive_type_decdouble |
cplus_primitive_type_declong |
cplus_primitive_type_char16_t |
cplus_primitive_type_char32_t |
cplus_primitive_type_wchar_t |
nr_cplus_primitive_types |

Definition at line 881 of file c-lang.c.

## Function Documentation

## ◆ c_emit_char()

void c_emit_char | ( | int | c,
|  | struct type * | type,
|  | struct ui_file * | stream,
|  | int | quoter
| ) |  |

Definition at line 143 of file c-lang.c.

References classify_type(), generic_emit_char(), and get_type_arch().

## ◆ c_get_string()

void c_get_string | ( | struct value * | value,
|  | gdb_byte ** | buffer,
|  | int * | length,
|  | struct type ** | char_type,
|  | const char ** | charset
| ) |  |

Definition at line 236 of file c-lang.c.

References _, c_textual_element_type(), check_typedef(), classify_type(), err, error(), extract_unsigned_integer(), gdbarch_byte_order(), get_discrete_bounds(), get_type_arch(), type::length, lval_internalvar, memory_error(), not_lval, read_string(), string, TARGET_XFER_E_IO, TYPE_CODE, TYPE_CODE_ARRAY, TYPE_CODE_PTR, TYPE_CODE_RANGE, TYPE_FIELD_TYPE, TYPE_LENGTH, TYPE_NFIELDS, TYPE_TARGET_TYPE, type_to_string(), UINT_MAX, value_as_address(), value_contents(), VALUE_LVAL, value_type(), xfree(), and xmalloc().

## ◆ c_language_arch_info()

void c_language_arch_info | ( | struct gdbarch * | gdbarch,
|  | struct language_arch_info * | lai
| ) |  |

Definition at line 784 of file c-lang.c.

References language_arch_info::bool_type_default, builtin_type::builtin_char, builtin_type::builtin_complex, builtin_type::builtin_decdouble, builtin_type::builtin_decfloat, builtin_type::builtin_declong, builtin_type::builtin_double, builtin_type::builtin_double_complex, builtin_type::builtin_float, builtin_type::builtin_int, builtin_type::builtin_long, builtin_type::builtin_long_double, builtin_type::builtin_long_long, builtin_type::builtin_short, builtin_type::builtin_signed_char, builtin_type(), builtin_type::builtin_unsigned_char, builtin_type::builtin_unsigned_int, builtin_type::builtin_unsigned_long, builtin_type::builtin_unsigned_long_long, builtin_type::builtin_unsigned_short, builtin_type::builtin_void, c_primitive_type_char, c_primitive_type_complex, c_primitive_type_decdouble, c_primitive_type_decfloat, c_primitive_type_declong, c_primitive_type_double, c_primitive_type_double_complex, c_primitive_type_float, c_primitive_type_int, c_primitive_type_long, c_primitive_type_long_double, c_primitive_type_long_long, c_primitive_type_short, c_primitive_type_signed_char, c_primitive_type_unsigned_char, c_primitive_type_unsigned_int, c_primitive_type_unsigned_long, c_primitive_type_unsigned_long_long, c_primitive_type_unsigned_short, c_primitive_type_void, GDBARCH_OBSTACK_CALLOC, nr_c_primitive_types, language_arch_info::primitive_type_vector, and language_arch_info::string_char_type.

## ◆ c_printchar()

void c_printchar | ( | int | c,
|  | struct type * | type,
|  | struct ui_file * | stream
| ) |  |

Definition at line 153 of file c-lang.c.

References C_CHAR, C_CHAR_16, C_CHAR_32, C_WIDE_CHAR, classify_type(), fputc_filtered(), get_type_arch(), and LA_EMIT_CHAR.

Referenced by dwarf2_compute_name().

## ◆ c_printstr()

void c_printstr | ( | struct ui_file * | stream,
|  | struct type * | type,
|  | const gdb_byte * | string,
|  | unsigned int | length,
|  | const char * | user_encoding,
|  | int | force_ellipses,
|  | const struct value_print_options * | options
| ) |  |

Definition at line 186 of file c-lang.c.

References C_CHAR, C_STRING, C_STRING_16, C_STRING_32, C_WIDE_STRING, classify_type(), fputs_filtered(), generic_printstr(), and get_type_arch().

Referenced by rust_printstr().

## ◆ c_watch_location_expression()

gdb::unique_xmalloc_ptr<char> c_watch_location_expression | ( | struct type * | type,
|  | CORE_ADDR | addr
| ) |  |

Definition at line 712 of file c-lang.c.

References check_typedef(), core_addr_to_string(), name, string, TYPE_TARGET_TYPE, type_to_string(), and xstrprintf().

## ◆ charset_for_string_type()

static const char* charset_for_string_type | ( | c_string_type | str_type,
|  | struct gdbarch * | gdbarch
| ) |  |
| static

Definition at line 42 of file c-lang.c.

References _, C_CHAR, C_STRING, C_STRING_16, C_STRING_32, C_WIDE_STRING, gdbarch_byte_order(), internal_error(), target_charset(), and target_wide_charset().

Referenced by classify_type(), and evaluate_subexp_c().

## ◆ classify_type()

static c_string_type classify_type | ( | struct type * | elttype,
|  | struct gdbarch * | gdbarch,
|  | const char ** | encoding
| ) |  |
| static

Definition at line 73 of file c-lang.c.

References C_CHAR, C_CHAR_16, C_CHAR_32, C_WIDE_CHAR, charset_for_string_type(), check_typedef(), name, TYPE_CODE, TYPE_CODE_CHAR, TYPE_CODE_TYPEDEF, TYPE_NAME, and TYPE_TARGET_TYPE.

Referenced by c_emit_char(), c_get_string(), c_printchar(), and c_printstr().

## ◆ convert_escape()

static char* convert_escape | ( | struct type * | type,
|  | const char * | dest_charset,
|  | char * | p,
|  | char * | limit,
|  | struct obstack * | output
| ) |  |
| static

Definition at line 476 of file c-lang.c.

References _, ADVANCE, convert_hex(), convert_octal(), convert_ucn(), error(), and type::length.

Referenced by parse_one_string().

## ◆ convert_hex()

static char* convert_hex | ( | struct type * | type,
|  | char * | p,
|  | char * | limit,
|  | struct obstack * | output
| ) |  |
| static

Definition at line 445 of file c-lang.c.

References emit_numeric_character(), and host_hex_value().

Referenced by convert_escape().

## ◆ convert_octal()

static char* convert_octal | ( | struct type * | type,
|  | char * | p,
|  | char * | limit,
|  | struct obstack * | output
| ) |  |
| static

Definition at line 420 of file c-lang.c.

References emit_numeric_character(), and host_hex_value().

Referenced by convert_escape().

## ◆ convert_ucn()

static char* convert_ucn | ( | char * | p,
|  | char * | limit,
|  | const char * | dest_charset,
|  | struct obstack * | output,
|  | int | length
| ) |  |
| static

Definition at line 378 of file c-lang.c.

References convert_between_encodings(), host_hex_value(), type::length, and translit_none.

Referenced by convert_escape().

## ◆ cplus_language_arch_info()

static void cplus_language_arch_info | ( | struct gdbarch * | gdbarch,
|  | struct language_arch_info * | lai
| ) |  |
| static

Definition at line 910 of file c-lang.c.

References language_arch_info::bool_type_default, language_arch_info::bool_type_symbol, builtin_type::builtin_bool, builtin_type::builtin_char, builtin_type::builtin_char16, builtin_type::builtin_char32, builtin_type::builtin_complex, builtin_type::builtin_decdouble, builtin_type::builtin_decfloat, builtin_type::builtin_declong, builtin_type::builtin_double, builtin_type::builtin_double_complex, builtin_type::builtin_float, builtin_type::builtin_int, builtin_type::builtin_long, builtin_type::builtin_long_double, builtin_type::builtin_long_long, builtin_type::builtin_short, builtin_type::builtin_signed_char, builtin_type(), builtin_type::builtin_unsigned_char, builtin_type::builtin_unsigned_int, builtin_type::builtin_unsigned_long, builtin_type::builtin_unsigned_long_long, builtin_type::builtin_unsigned_short, builtin_type::builtin_void, builtin_type::builtin_wchar, cplus_primitive_type_bool, cplus_primitive_type_char, cplus_primitive_type_char16_t, cplus_primitive_type_char32_t, cplus_primitive_type_complex, cplus_primitive_type_decdouble, cplus_primitive_type_decfloat, cplus_primitive_type_declong, cplus_primitive_type_double, cplus_primitive_type_double_complex, cplus_primitive_type_float, cplus_primitive_type_int, cplus_primitive_type_long, cplus_primitive_type_long_double, cplus_primitive_type_long_long, cplus_primitive_type_short, cplus_primitive_type_signed_char, cplus_primitive_type_unsigned_char, cplus_primitive_type_unsigned_int, cplus_primitive_type_unsigned_long, cplus_primitive_type_unsigned_long_long, cplus_primitive_type_unsigned_short, cplus_primitive_type_void, cplus_primitive_type_wchar_t, GDBARCH_OBSTACK_CALLOC, nr_cplus_primitive_types, language_arch_info::primitive_type_vector, and language_arch_info::string_char_type.

## ◆ emit_numeric_character()

static void emit_numeric_character | ( | struct type * | type,
|  | unsigned long | value,
|  | struct obstack * | output
| ) |  |
| static

Definition at line 404 of file c-lang.c.

References pack_long(), and TYPE_LENGTH.

Referenced by convert_hex(), and convert_octal().

## ◆ evaluate_subexp_c()

struct value* evaluate_subexp_c | ( | struct type * | expect_type,
|  | struct expression * | exp,
|  | int * | pos,
|  | enum noside noside |
| ) |  |

Definition at line 560 of file c-lang.c.

References _, allocate_value(), BYTES_TO_EXP_ELEM, C_CHAR, C_STRING, C_STRING_16, C_STRING_32, C_WIDE_STRING, charset_for_string_type(), check_typedef(), expression::elts, error(), EVAL_SKIP, evaluate_subexp_standard(), expression::gdbarch, get_discrete_bounds(), internal_error(), expression::language_defn, language_string_char_type(), exp_element::longconst, longest_to_int(), lookup_typename(), exp_element::opcode, parse_one_string(), exp_element::string, type, TYPE_CODE, TYPE_CODE_ARRAY, TYPE_CODE_CHAR, TYPE_CODE_INT, TYPE_INDEX_TYPE, TYPE_LENGTH, TYPE_TARGET_TYPE, unpack_long(), value_contents_raw(), value_cstring(), and value_from_longest().

Referenced by evaluate_subexp_opencl().

## ◆ parse_one_string()

static void parse_one_string | ( | struct obstack * | output,
|  | char * | data,
|  | int | len,
|  | const char * | dest_charset,
|  | struct type * | type
| ) |  |
| static

Definition at line 529 of file c-lang.c.

References convert_between_encodings(), convert_escape(), host_charset(), and translit_none.

Referenced by evaluate_subexp_c().

## Variable Documentation

## ◆ asm_extensions

const char* asm_extensions[]
| static

Initial value:
=
{
".s", ".sx", ".S", NULL
}

Definition at line 1026 of file c-lang.c.

## ◆ asm_language_defn

const struct language_defn asm_language_defn

## ◆ c_extensions

const char* c_extensions[]
| static

Initial value:
=
{
".c", NULL
}

Definition at line 827 of file c-lang.c.

## ◆ c_language_defn

const struct language_defn c_language_defn

## ◆ c_op_print_tab

const struct op_print c_op_print_tab[]

Definition at line 724 of file c-lang.c.

## ◆ cplus_extensions

const char* cplus_extensions[]
| static

Initial value:
=
{
".C", ".cc", ".cp", ".cpp", ".cxx", ".c++", NULL
}

Definition at line 972 of file c-lang.c.

## ◆ cplus_language_defn

const struct language_defn cplus_language_defn

## ◆ exp_descriptor_c

const struct exp_descriptor exp_descriptor_c

Initial value:
=
{
print_subexp_standard,
operator_length_standard,
operator_check_standard,
op_name_standard,
dump_subexp_body_standard,
evaluate_subexp_c
}
evaluate_subexp_c
struct value * evaluate_subexp_c(struct type *expect_type, struct expression *exp, int *pos, enum noside noside)
Definition: c-lang.c:560
operator_check_standard
int operator_check_standard(struct expression *exp, int pos, int(*objfile_func)(struct objfile *objfile, void *data), void *data)
Definition: parse.c:1723
dump_subexp_body_standard
int dump_subexp_body_standard(struct expression *exp, struct ui_file *stream, int elt)
Definition: expprint.c:795
print_subexp_standard
void print_subexp_standard(struct expression *exp, int *pos, struct ui_file *stream, enum precedence prec)
Definition: expprint.c:58
operator_length_standard
void operator_length_standard(const struct expression *expr, int endpos, int *oplenp, int *argsp)
Definition: parse.c:837
op_name_standard
const char * op_name_standard(enum exp_opcode opcode)
Definition: expprint.c:695

Definition at line 817 of file c-lang.c.

## ◆ minimal_language_defn

const struct language_defn minimal_language_defn