Constification of parse_linespec and fallout:
https://sourceware.org/ml/gdb-patches/2013-09/msg01017.html https://sourceware.org/ml/gdb-patches/2013-09/msg01018.html https://sourceware.org/ml/gdb-patches/2013-09/msg01019.html https://sourceware.org/ml/gdb-patches/2013-09/msg01020.html
This commit is contained in:
parent
62574b938f
commit
d7561cbbf2
26 changed files with 289 additions and 132 deletions
119
gdb/ChangeLog
119
gdb/ChangeLog
|
@ -1,3 +1,122 @@
|
||||||
|
2013-10-01 Keith Seitz <keiths@redhat.com>
|
||||||
|
|
||||||
|
* linespec.c (struct ls_parser): Make 'saved_arg' const.
|
||||||
|
(parse_linespec): Make 'argptr' const.
|
||||||
|
Remove temporary cast of 'argptr' to const char **.
|
||||||
|
(decode_line_full): Pass const pointer to parse_linespec.
|
||||||
|
(decode_line_1): Likewise.
|
||||||
|
(decode_objc): Make local variable 'new_argptr' const.
|
||||||
|
(find_function_symbols): Remove temporary cast to char *
|
||||||
|
to find_imps.
|
||||||
|
* objc-lang.c (find_imps): Make argument 'method' const.
|
||||||
|
Return const.
|
||||||
|
* objc-lang.h (find_imps): Likewise.
|
||||||
|
|
||||||
|
2013-10-01 Keith Seitz <keiths@redhat.com>
|
||||||
|
|
||||||
|
* completer.c (skip_quoted_chars): Make all arguments const.
|
||||||
|
Return const.
|
||||||
|
(skip_quoted): Likewise.
|
||||||
|
* completer.h (skip_quoted_chars): Likewise.
|
||||||
|
(skip_quoted): Likewise.
|
||||||
|
* defs.h (skip_quoted): Remove duplicate declaration.
|
||||||
|
* jv-exp.y: Include completer.h.
|
||||||
|
(yylex): Remove unneccessary cast to char * fro skip_quoted.
|
||||||
|
* p-exp.y: Include completer.h.
|
||||||
|
|
||||||
|
2013-10-01 Keith Seitz <keiths@redhat.com>
|
||||||
|
|
||||||
|
* c-exp.y (parse_number): Make first argument const.
|
||||||
|
Make a copy of the input to manipulate.
|
||||||
|
(c_parse_escape): Make first argument const.
|
||||||
|
Make local variable 'tokptr' const.
|
||||||
|
(parse_string_or_char): Make first two arguments const.
|
||||||
|
(macro_original_text): Make const.
|
||||||
|
(lex_one_token): Make local variable 'tokstart' const.
|
||||||
|
Likewise for local variables named 'p'.
|
||||||
|
Cast away const for struct stoken (temporary).
|
||||||
|
* c-lang.h (c_parse_escpae): Make first argument const.
|
||||||
|
* cli/cli-cmds.c (echo_command): Make local variable 'p'
|
||||||
|
const.
|
||||||
|
* cli/cli-setshow.c (do_set_command): Likewise for 'p' in
|
||||||
|
var_string case.
|
||||||
|
* f-exp.y (parse_number): Make first argument const.
|
||||||
|
(match_string_literal): Make local variable 'tokstart'
|
||||||
|
const.
|
||||||
|
(yylex): Make local variable 'p' const.
|
||||||
|
Cast away const for struct stoken (temporary).
|
||||||
|
* go-exp.y (parse_number): Make first argument const.
|
||||||
|
(parse_string_or_char): Likewise.
|
||||||
|
Make local variable 'tokstart' const.
|
||||||
|
(lex_one_token): Likewise for numerous locals called 'p'.
|
||||||
|
Cast away const for struct stoken (temporary).
|
||||||
|
* jv-exp.y (parse_number): Make first argument const.
|
||||||
|
Make local variables 'tokstart' and 'tokptr' const.
|
||||||
|
Cast away const for call to skip_quoted (temporary).
|
||||||
|
(yylex): Make local variable 'p' const.
|
||||||
|
Cast away const for struct stoken (temporary).
|
||||||
|
* m2-exp.y (parse_number): Make local variable 'p' const.
|
||||||
|
(yylex): Likewise for 'tokstart'.
|
||||||
|
Cast away const for struct stoken (temporary).
|
||||||
|
Make local variable 'p' const.
|
||||||
|
* macroexp.c (get_character_constant): Pass a const string
|
||||||
|
to c_parse_escape.
|
||||||
|
(get_string_literal): Likewise.
|
||||||
|
(macro_expand_next): Make first argument const.
|
||||||
|
Cast away const for init_shared_buffer.
|
||||||
|
* macroexp.h (macro_expand_next): Make first argument const.
|
||||||
|
* p-exp.y (yylex): Make a local copy of 'lexptr'.
|
||||||
|
Pass a const string to c_parse_escape.
|
||||||
|
Make local variables 'p' and 'namestart' const.
|
||||||
|
* parse.c (lexptr): Make const.
|
||||||
|
(prev_lexptr): Likewise.
|
||||||
|
(find_template_name_end): Return const.
|
||||||
|
Make argument const, too.
|
||||||
|
(parse_exp_in_context): Make first argument const.
|
||||||
|
Remove the entire const_hack.
|
||||||
|
(parse_exp_in_context_1): Make first argument const.
|
||||||
|
* parser-defs.h (find_template_name_end): Return const.
|
||||||
|
Make argument const, too.
|
||||||
|
(lexptr): Make const.
|
||||||
|
(prev_lexptr): Likewise.
|
||||||
|
* utils.c (parse_escape): Make second argument const.
|
||||||
|
* utils.h (parse_escape): Likewise.
|
||||||
|
|
||||||
|
2013-10-01 Keith Seitz <keiths@redhat.com>
|
||||||
|
|
||||||
|
* ada-exp.y (write_object_renaming): Update: struct stoken.ptr
|
||||||
|
is now const.
|
||||||
|
(block_lookup): Make 'raw_name' and 'name' const.
|
||||||
|
* ada-lex.l (processString): Update for struct stoken.ptr.
|
||||||
|
* c-exp.y (qualified_name : TYPENAME COLONCOLON '~' name): Likewise.
|
||||||
|
(operator_stoken): Likewise.
|
||||||
|
(lex_one_token): Remove temporary cast to char * for
|
||||||
|
'yylval.sval.ptr'.
|
||||||
|
* f-exp.y (yylex): Likewise.
|
||||||
|
* gdb-types.c (lookup_struct_elt_type): Make argument 'name' const.
|
||||||
|
* gdbtypes.h (lookup_struct_elt_type): Likewisee.
|
||||||
|
* go-exp.y (lex_one_token): Remove temporary cast to char * for
|
||||||
|
'yylval.sval.ptr'.
|
||||||
|
* jv-exp.y (QualifiedName): Update for struct stoken.ptr.
|
||||||
|
(yylex): Remove temporary cast to char * for 'yylval.sval.ptr'.
|
||||||
|
* linespec.c (struct ls_parser): Make 'stream' const.
|
||||||
|
(find_parameter_list_end): Make argument 'input' and local
|
||||||
|
variable 'p' const.
|
||||||
|
(linespec_lexer_lex_string): Make local variables 'start' and
|
||||||
|
'p' const.
|
||||||
|
Use skip_spaces_const instead of skip_spaces.
|
||||||
|
(linespec_lexer_peek_token): Make local variable 'saved_stream'
|
||||||
|
const.
|
||||||
|
(parse_linespec): Temporarily cast 'argptr' to const for
|
||||||
|
'parser->lexer.stream'.
|
||||||
|
* m2-exp.y (yylex): Remove temporary cast to char * for
|
||||||
|
'yylval.sval.ptr'.
|
||||||
|
* objc-lang.c (add_msglist): Make local variable 'p' const.
|
||||||
|
* p-exp.y (exp : exp '['): Update for struct stoken.ptr.
|
||||||
|
(exp : STRING): Make 'sp' const.
|
||||||
|
(parse_number): Make argument 'p' const.
|
||||||
|
* parser-defs.h (struct stoken): Make 'ptr' const.
|
||||||
|
|
||||||
2013-10-01 Doug Evans <dje@google.com>
|
2013-10-01 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
* cli/cli-decode.c: Remove unnecessary inclusion of tui/tui.h.
|
* cli/cli-decode.c: Remove unnecessary inclusion of tui/tui.h.
|
||||||
|
|
|
@ -136,7 +136,7 @@ static void write_name_assoc (struct stoken);
|
||||||
|
|
||||||
static void write_exp_op_with_string (enum exp_opcode, struct stoken);
|
static void write_exp_op_with_string (enum exp_opcode, struct stoken);
|
||||||
|
|
||||||
static struct block *block_lookup (struct block *, char *);
|
static struct block *block_lookup (struct block *, const char *);
|
||||||
|
|
||||||
static LONGEST convert_char_literal (struct type *, LONGEST);
|
static LONGEST convert_char_literal (struct type *, LONGEST);
|
||||||
|
|
||||||
|
@ -952,6 +952,8 @@ write_object_renaming (const struct block *orig_left_context,
|
||||||
{
|
{
|
||||||
struct stoken field_name;
|
struct stoken field_name;
|
||||||
const char *end;
|
const char *end;
|
||||||
|
char *buf;
|
||||||
|
|
||||||
renaming_expr += 1;
|
renaming_expr += 1;
|
||||||
|
|
||||||
if (slice_state != SIMPLE_INDEX)
|
if (slice_state != SIMPLE_INDEX)
|
||||||
|
@ -960,9 +962,10 @@ write_object_renaming (const struct block *orig_left_context,
|
||||||
if (end == NULL)
|
if (end == NULL)
|
||||||
end = renaming_expr + strlen (renaming_expr);
|
end = renaming_expr + strlen (renaming_expr);
|
||||||
field_name.length = end - renaming_expr;
|
field_name.length = end - renaming_expr;
|
||||||
field_name.ptr = malloc (end - renaming_expr + 1);
|
buf = malloc (end - renaming_expr + 1);
|
||||||
strncpy (field_name.ptr, renaming_expr, end - renaming_expr);
|
field_name.ptr = buf;
|
||||||
field_name.ptr[end - renaming_expr] = '\000';
|
strncpy (buf, renaming_expr, end - renaming_expr);
|
||||||
|
buf[end - renaming_expr] = '\000';
|
||||||
renaming_expr = end;
|
renaming_expr = end;
|
||||||
write_exp_op_with_string (STRUCTOP_STRUCT, field_name);
|
write_exp_op_with_string (STRUCTOP_STRUCT, field_name);
|
||||||
break;
|
break;
|
||||||
|
@ -980,9 +983,9 @@ write_object_renaming (const struct block *orig_left_context,
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct block*
|
static struct block*
|
||||||
block_lookup (struct block *context, char *raw_name)
|
block_lookup (struct block *context, const char *raw_name)
|
||||||
{
|
{
|
||||||
char *name;
|
const char *name;
|
||||||
struct ada_symbol_info *syms;
|
struct ada_symbol_info *syms;
|
||||||
int nsyms;
|
int nsyms;
|
||||||
struct symtab *symtab;
|
struct symtab *symtab;
|
||||||
|
|
|
@ -497,7 +497,8 @@ processString (const char *text, int len)
|
||||||
const char *lim = text + len;
|
const char *lim = text + len;
|
||||||
struct stoken result;
|
struct stoken result;
|
||||||
|
|
||||||
q = result.ptr = obstack_alloc (&temp_parse_space, len);
|
q = obstack_alloc (&temp_parse_space, len);
|
||||||
|
result.ptr = q;
|
||||||
p = text;
|
p = text;
|
||||||
while (p < lim)
|
while (p < lim)
|
||||||
{
|
{
|
||||||
|
|
53
gdb/c-exp.y
53
gdb/c-exp.y
|
@ -164,7 +164,7 @@ void yyerror (char *);
|
||||||
|
|
||||||
%{
|
%{
|
||||||
/* YYSTYPE gets defined by %union */
|
/* YYSTYPE gets defined by %union */
|
||||||
static int parse_number (char *, int, int, YYSTYPE *);
|
static int parse_number (const char *, int, int, YYSTYPE *);
|
||||||
static struct stoken operator_stoken (const char *);
|
static struct stoken operator_stoken (const char *);
|
||||||
static void check_parameter_typelist (VEC (type_ptr) *);
|
static void check_parameter_typelist (VEC (type_ptr) *);
|
||||||
static void write_destructor_name (struct stoken);
|
static void write_destructor_name (struct stoken);
|
||||||
|
@ -970,18 +970,20 @@ qualified_name: TYPENAME COLONCOLON name
|
||||||
{
|
{
|
||||||
struct type *type = $1.type;
|
struct type *type = $1.type;
|
||||||
struct stoken tmp_token;
|
struct stoken tmp_token;
|
||||||
|
char *buf;
|
||||||
|
|
||||||
CHECK_TYPEDEF (type);
|
CHECK_TYPEDEF (type);
|
||||||
if (TYPE_CODE (type) != TYPE_CODE_STRUCT
|
if (TYPE_CODE (type) != TYPE_CODE_STRUCT
|
||||||
&& TYPE_CODE (type) != TYPE_CODE_UNION
|
&& TYPE_CODE (type) != TYPE_CODE_UNION
|
||||||
&& TYPE_CODE (type) != TYPE_CODE_NAMESPACE)
|
&& TYPE_CODE (type) != TYPE_CODE_NAMESPACE)
|
||||||
error (_("`%s' is not defined as an aggregate type."),
|
error (_("`%s' is not defined as an aggregate type."),
|
||||||
TYPE_SAFE_NAME (type));
|
TYPE_SAFE_NAME (type));
|
||||||
|
buf = alloca ($4.length + 2);
|
||||||
tmp_token.ptr = (char*) alloca ($4.length + 2);
|
tmp_token.ptr = buf;
|
||||||
tmp_token.length = $4.length + 1;
|
tmp_token.length = $4.length + 1;
|
||||||
tmp_token.ptr[0] = '~';
|
buf[0] = '~';
|
||||||
memcpy (tmp_token.ptr+1, $4.ptr, $4.length);
|
memcpy (buf+1, $4.ptr, $4.length);
|
||||||
tmp_token.ptr[tmp_token.length] = 0;
|
buf[tmp_token.length] = 0;
|
||||||
|
|
||||||
/* Check for valid destructor name. */
|
/* Check for valid destructor name. */
|
||||||
destructor_name_p (tmp_token.ptr, $1.type);
|
destructor_name_p (tmp_token.ptr, $1.type);
|
||||||
|
@ -1651,13 +1653,16 @@ operator_stoken (const char *op)
|
||||||
{
|
{
|
||||||
static const char *operator_string = "operator";
|
static const char *operator_string = "operator";
|
||||||
struct stoken st = { NULL, 0 };
|
struct stoken st = { NULL, 0 };
|
||||||
|
char *buf;
|
||||||
|
|
||||||
st.length = strlen (operator_string) + strlen (op);
|
st.length = strlen (operator_string) + strlen (op);
|
||||||
st.ptr = malloc (st.length + 1);
|
buf = malloc (st.length + 1);
|
||||||
strcpy (st.ptr, operator_string);
|
strcpy (buf, operator_string);
|
||||||
strcat (st.ptr, op);
|
strcat (buf, op);
|
||||||
|
st.ptr = buf;
|
||||||
|
|
||||||
/* The toplevel (c_parse) will free the memory allocated here. */
|
/* The toplevel (c_parse) will free the memory allocated here. */
|
||||||
make_cleanup (free, st.ptr);
|
make_cleanup (free, buf);
|
||||||
return st;
|
return st;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1699,7 +1704,7 @@ check_parameter_typelist (VEC (type_ptr) *params)
|
||||||
/*** Needs some error checking for the float case ***/
|
/*** Needs some error checking for the float case ***/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere)
|
parse_number (const char *buf, int len, int parsed_float, YYSTYPE *putithere)
|
||||||
{
|
{
|
||||||
/* FIXME: Shouldn't these be unsigned? We don't deal with negative values
|
/* FIXME: Shouldn't these be unsigned? We don't deal with negative values
|
||||||
here, and we do kind of silly things like cast to unsigned. */
|
here, and we do kind of silly things like cast to unsigned. */
|
||||||
|
@ -1721,6 +1726,10 @@ parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere)
|
||||||
ULONGEST high_bit;
|
ULONGEST high_bit;
|
||||||
struct type *signed_type;
|
struct type *signed_type;
|
||||||
struct type *unsigned_type;
|
struct type *unsigned_type;
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
p = alloca (len);
|
||||||
|
memcpy (p, buf, len);
|
||||||
|
|
||||||
if (parsed_float)
|
if (parsed_float)
|
||||||
{
|
{
|
||||||
|
@ -1941,9 +1950,9 @@ static int tempbuf_init;
|
||||||
character was emitted, 0 otherwise. */
|
character was emitted, 0 otherwise. */
|
||||||
|
|
||||||
int
|
int
|
||||||
c_parse_escape (char **ptr, struct obstack *output)
|
c_parse_escape (const char **ptr, struct obstack *output)
|
||||||
{
|
{
|
||||||
char *tokptr = *ptr;
|
const char *tokptr = *ptr;
|
||||||
int result = 1;
|
int result = 1;
|
||||||
|
|
||||||
/* Some escape sequences undergo character set conversion. Those we
|
/* Some escape sequences undergo character set conversion. Those we
|
||||||
|
@ -2102,8 +2111,8 @@ c_parse_escape (char **ptr, struct obstack *output)
|
||||||
CHAR, depending on what was parsed. *HOST_CHARS is set to the
|
CHAR, depending on what was parsed. *HOST_CHARS is set to the
|
||||||
number of host characters in the literal. */
|
number of host characters in the literal. */
|
||||||
static int
|
static int
|
||||||
parse_string_or_char (char *tokptr, char **outptr, struct typed_stoken *value,
|
parse_string_or_char (const char *tokptr, const char **outptr,
|
||||||
int *host_chars)
|
struct typed_stoken *value, int *host_chars)
|
||||||
{
|
{
|
||||||
int quote;
|
int quote;
|
||||||
enum c_string_type type;
|
enum c_string_type type;
|
||||||
|
@ -2321,7 +2330,7 @@ static const struct token ident_tokens[] =
|
||||||
we evaluate ADDRESS in the scope of the current frame, but we
|
we evaluate ADDRESS in the scope of the current frame, but we
|
||||||
evaluate CONDITION in the scope of the breakpoint's location. So
|
evaluate CONDITION in the scope of the breakpoint's location. So
|
||||||
it's simply wrong to try to macro-expand the whole thing at once. */
|
it's simply wrong to try to macro-expand the whole thing at once. */
|
||||||
static char *macro_original_text;
|
static const char *macro_original_text;
|
||||||
|
|
||||||
/* We save all intermediate macro expansions on this obstack for the
|
/* We save all intermediate macro expansions on this obstack for the
|
||||||
duration of a single parse. The expansion text may sometimes have
|
duration of a single parse. The expansion text may sometimes have
|
||||||
|
@ -2411,7 +2420,7 @@ lex_one_token (void)
|
||||||
int c;
|
int c;
|
||||||
int namelen;
|
int namelen;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
char *tokstart;
|
const char *tokstart;
|
||||||
int saw_structop = last_was_structop;
|
int saw_structop = last_was_structop;
|
||||||
char *copy;
|
char *copy;
|
||||||
|
|
||||||
|
@ -2538,7 +2547,7 @@ lex_one_token (void)
|
||||||
{
|
{
|
||||||
/* It's a number. */
|
/* It's a number. */
|
||||||
int got_dot = 0, got_e = 0, toktype;
|
int got_dot = 0, got_e = 0, toktype;
|
||||||
char *p = tokstart;
|
const char *p = tokstart;
|
||||||
int hex = input_radix > 10;
|
int hex = input_radix > 10;
|
||||||
|
|
||||||
if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
|
if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
|
||||||
|
@ -2590,7 +2599,7 @@ lex_one_token (void)
|
||||||
|
|
||||||
case '@':
|
case '@':
|
||||||
{
|
{
|
||||||
char *p = &tokstart[1];
|
const char *p = &tokstart[1];
|
||||||
size_t len = strlen ("entry");
|
size_t len = strlen ("entry");
|
||||||
|
|
||||||
if (parse_language->la_language == language_objc)
|
if (parse_language->la_language == language_objc)
|
||||||
|
@ -2692,7 +2701,8 @@ lex_one_token (void)
|
||||||
characters; for comparison expressions, e.g. "a < b > c",
|
characters; for comparison expressions, e.g. "a < b > c",
|
||||||
there must be spaces before the '<', etc. */
|
there must be spaces before the '<', etc. */
|
||||||
|
|
||||||
char * p = find_template_name_end (tokstart + namelen);
|
const char *p = find_template_name_end (tokstart + namelen);
|
||||||
|
|
||||||
if (p)
|
if (p)
|
||||||
namelen = p - tokstart;
|
namelen = p - tokstart;
|
||||||
}
|
}
|
||||||
|
@ -2723,7 +2733,8 @@ lex_one_token (void)
|
||||||
&& (tokstart[namelen] == ' ' || tokstart[namelen] == '\t')
|
&& (tokstart[namelen] == ' ' || tokstart[namelen] == '\t')
|
||||||
&& ! scanning_macro_expansion ())
|
&& ! scanning_macro_expansion ())
|
||||||
{
|
{
|
||||||
char *p = tokstart + namelen + 1;
|
const char *p = tokstart + namelen + 1;
|
||||||
|
|
||||||
while (*p == ' ' || *p == '\t')
|
while (*p == ' ' || *p == '\t')
|
||||||
p++;
|
p++;
|
||||||
if (*p >= '0' && *p <= '9')
|
if (*p >= '0' && *p <= '9')
|
||||||
|
|
|
@ -61,7 +61,7 @@ extern int c_parse (void);
|
||||||
|
|
||||||
extern void c_error (char *);
|
extern void c_error (char *);
|
||||||
|
|
||||||
extern int c_parse_escape (char **, struct obstack *);
|
extern int c_parse_escape (const char **, struct obstack *);
|
||||||
|
|
||||||
/* Defined in c-typeprint.c */
|
/* Defined in c-typeprint.c */
|
||||||
extern void c_print_type (struct type *, const char *,
|
extern void c_print_type (struct type *, const char *,
|
||||||
|
|
|
@ -666,7 +666,7 @@ source_command (char *args, int from_tty)
|
||||||
static void
|
static void
|
||||||
echo_command (char *text, int from_tty)
|
echo_command (char *text, int from_tty)
|
||||||
{
|
{
|
||||||
char *p = text;
|
const char *p = text;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
if (text)
|
if (text)
|
||||||
|
|
|
@ -160,7 +160,7 @@ do_set_command (char *arg, int from_tty, struct cmd_list_element *c)
|
||||||
case var_string:
|
case var_string:
|
||||||
{
|
{
|
||||||
char *new;
|
char *new;
|
||||||
char *p;
|
const char *p;
|
||||||
char *q;
|
char *q;
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
|
|
|
@ -911,11 +911,12 @@ line_completion_function (const char *text, int matches,
|
||||||
QUOTECHARS or BREAKCHARS is NULL, use the same values used by the
|
QUOTECHARS or BREAKCHARS is NULL, use the same values used by the
|
||||||
completer. */
|
completer. */
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
skip_quoted_chars (char *str, char *quotechars, char *breakchars)
|
skip_quoted_chars (const char *str, const char *quotechars,
|
||||||
|
const char *breakchars)
|
||||||
{
|
{
|
||||||
char quote_char = '\0';
|
char quote_char = '\0';
|
||||||
char *scan;
|
const char *scan;
|
||||||
|
|
||||||
if (quotechars == NULL)
|
if (quotechars == NULL)
|
||||||
quotechars = gdb_completer_quote_characters;
|
quotechars = gdb_completer_quote_characters;
|
||||||
|
@ -953,8 +954,8 @@ skip_quoted_chars (char *str, char *quotechars, char *breakchars)
|
||||||
characters and word break characters used by the completer).
|
characters and word break characters used by the completer).
|
||||||
Returns pointer to the location after the "word". */
|
Returns pointer to the location after the "word". */
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
skip_quoted (char *str)
|
skip_quoted (const char *str)
|
||||||
{
|
{
|
||||||
return skip_quoted_chars (str, NULL, NULL);
|
return skip_quoted_chars (str, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,8 +50,9 @@ extern char *gdb_completion_word_break_characters (void);
|
||||||
|
|
||||||
/* Exported to linespec.c */
|
/* Exported to linespec.c */
|
||||||
|
|
||||||
extern char *skip_quoted_chars (char *, char *, char *);
|
extern const char *skip_quoted_chars (const char *, const char *,
|
||||||
|
const char *);
|
||||||
|
|
||||||
extern char *skip_quoted (char *);
|
extern const char *skip_quoted (const char *);
|
||||||
|
|
||||||
#endif /* defined (COMPLETER_H) */
|
#endif /* defined (COMPLETER_H) */
|
||||||
|
|
|
@ -311,8 +311,6 @@ extern void print_transfer_performance (struct ui_file *stream,
|
||||||
|
|
||||||
typedef void initialize_file_ftype (void);
|
typedef void initialize_file_ftype (void);
|
||||||
|
|
||||||
extern char *skip_quoted (char *);
|
|
||||||
|
|
||||||
extern char *gdb_readline (char *);
|
extern char *gdb_readline (char *);
|
||||||
|
|
||||||
extern char *gdb_readline_wrapper (char *);
|
extern char *gdb_readline_wrapper (char *);
|
||||||
|
|
10
gdb/f-exp.y
10
gdb/f-exp.y
|
@ -157,7 +157,7 @@ static int match_string_literal (void);
|
||||||
|
|
||||||
%{
|
%{
|
||||||
/* YYSTYPE gets defined by %union */
|
/* YYSTYPE gets defined by %union */
|
||||||
static int parse_number (char *, int, int, YYSTYPE *);
|
static int parse_number (const char *, int, int, YYSTYPE *);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%type <voidval> exp type_exp start variable
|
%type <voidval> exp type_exp start variable
|
||||||
|
@ -669,7 +669,7 @@ name_not_typename : NAME
|
||||||
/*** Needs some error checking for the float case ***/
|
/*** Needs some error checking for the float case ***/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere)
|
parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
||||||
{
|
{
|
||||||
LONGEST n = 0;
|
LONGEST n = 0;
|
||||||
LONGEST prevn = 0;
|
LONGEST prevn = 0;
|
||||||
|
@ -920,7 +920,7 @@ growbuf_by_size (int count)
|
||||||
static int
|
static int
|
||||||
match_string_literal (void)
|
match_string_literal (void)
|
||||||
{
|
{
|
||||||
char *tokptr = lexptr;
|
const char *tokptr = lexptr;
|
||||||
|
|
||||||
for (tempbufindex = 0, tokptr++; *tokptr != '\0'; tokptr++)
|
for (tempbufindex = 0, tokptr++; *tokptr != '\0'; tokptr++)
|
||||||
{
|
{
|
||||||
|
@ -955,7 +955,7 @@ yylex (void)
|
||||||
int c;
|
int c;
|
||||||
int namelen;
|
int namelen;
|
||||||
unsigned int i,token;
|
unsigned int i,token;
|
||||||
char *tokstart;
|
const char *tokstart;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
|
|
||||||
|
@ -1054,7 +1054,7 @@ yylex (void)
|
||||||
{
|
{
|
||||||
/* It's a number. */
|
/* It's a number. */
|
||||||
int got_dot = 0, got_e = 0, got_d = 0, toktype;
|
int got_dot = 0, got_e = 0, got_d = 0, toktype;
|
||||||
char *p = tokstart;
|
const char *p = tokstart;
|
||||||
int hex = input_radix > 10;
|
int hex = input_radix > 10;
|
||||||
|
|
||||||
if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
|
if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
|
||||||
|
|
|
@ -1353,7 +1353,7 @@ lookup_template_type (char *name, struct type *type,
|
||||||
If NAME is the name of a baseclass type, return that type. */
|
If NAME is the name of a baseclass type, return that type. */
|
||||||
|
|
||||||
struct type *
|
struct type *
|
||||||
lookup_struct_elt_type (struct type *type, char *name, int noerr)
|
lookup_struct_elt_type (struct type *type, const char *name, int noerr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *typename;
|
char *typename;
|
||||||
|
|
|
@ -1508,7 +1508,7 @@ extern const char *type_name_no_tag (const struct type *);
|
||||||
|
|
||||||
extern const char *type_name_no_tag_or_error (struct type *type);
|
extern const char *type_name_no_tag_or_error (struct type *type);
|
||||||
|
|
||||||
extern struct type *lookup_struct_elt_type (struct type *, char *, int);
|
extern struct type *lookup_struct_elt_type (struct type *, const char *, int);
|
||||||
|
|
||||||
extern struct type *make_pointer_type (struct type *, struct type **);
|
extern struct type *make_pointer_type (struct type *, struct type **);
|
||||||
|
|
||||||
|
|
17
gdb/go-exp.y
17
gdb/go-exp.y
|
@ -158,7 +158,7 @@ void yyerror (char *);
|
||||||
|
|
||||||
%{
|
%{
|
||||||
/* YYSTYPE gets defined by %union. */
|
/* YYSTYPE gets defined by %union. */
|
||||||
static int parse_number (char *, int, int, YYSTYPE *);
|
static int parse_number (const char *, int, int, YYSTYPE *);
|
||||||
static int parse_go_float (struct gdbarch *gdbarch, const char *p, int len,
|
static int parse_go_float (struct gdbarch *gdbarch, const char *p, int len,
|
||||||
DOUBLEST *d, struct type **t);
|
DOUBLEST *d, struct type **t);
|
||||||
%}
|
%}
|
||||||
|
@ -704,7 +704,7 @@ parse_go_float (struct gdbarch *gdbarch, const char *p, int len,
|
||||||
as our YYSTYPE is different than c-exp.y's */
|
as our YYSTYPE is different than c-exp.y's */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere)
|
parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
||||||
{
|
{
|
||||||
/* FIXME: Shouldn't these be unsigned? We don't deal with negative values
|
/* FIXME: Shouldn't these be unsigned? We don't deal with negative values
|
||||||
here, and we do kind of silly things like cast to unsigned. */
|
here, and we do kind of silly things like cast to unsigned. */
|
||||||
|
@ -908,8 +908,8 @@ static int tempbuf_init;
|
||||||
number of host characters in the literal. */
|
number of host characters in the literal. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
parse_string_or_char (char *tokptr, char **outptr, struct typed_stoken *value,
|
parse_string_or_char (const char *tokptr, const char **outptr,
|
||||||
int *host_chars)
|
struct typed_stoken *value, int *host_chars)
|
||||||
{
|
{
|
||||||
int quote;
|
int quote;
|
||||||
|
|
||||||
|
@ -1049,7 +1049,7 @@ lex_one_token (void)
|
||||||
int c;
|
int c;
|
||||||
int namelen;
|
int namelen;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
char *tokstart;
|
const char *tokstart;
|
||||||
int saw_structop = last_was_structop;
|
int saw_structop = last_was_structop;
|
||||||
char *copy;
|
char *copy;
|
||||||
|
|
||||||
|
@ -1143,7 +1143,7 @@ lex_one_token (void)
|
||||||
{
|
{
|
||||||
/* It's a number. */
|
/* It's a number. */
|
||||||
int got_dot = 0, got_e = 0, toktype;
|
int got_dot = 0, got_e = 0, toktype;
|
||||||
char *p = tokstart;
|
const char *p = tokstart;
|
||||||
int hex = input_radix > 10;
|
int hex = input_radix > 10;
|
||||||
|
|
||||||
if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
|
if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
|
||||||
|
@ -1190,7 +1190,7 @@ lex_one_token (void)
|
||||||
|
|
||||||
case '@':
|
case '@':
|
||||||
{
|
{
|
||||||
char *p = &tokstart[1];
|
const char *p = &tokstart[1];
|
||||||
size_t len = strlen ("entry");
|
size_t len = strlen ("entry");
|
||||||
|
|
||||||
while (isspace (*p))
|
while (isspace (*p))
|
||||||
|
@ -1283,7 +1283,8 @@ lex_one_token (void)
|
||||||
&& strncmp (tokstart, "thread", namelen) == 0
|
&& strncmp (tokstart, "thread", namelen) == 0
|
||||||
&& (tokstart[namelen] == ' ' || tokstart[namelen] == '\t'))
|
&& (tokstart[namelen] == ' ' || tokstart[namelen] == '\t'))
|
||||||
{
|
{
|
||||||
char *p = tokstart + namelen + 1;
|
const char *p = tokstart + namelen + 1;
|
||||||
|
|
||||||
while (*p == ' ' || *p == '\t')
|
while (*p == ' ' || *p == '\t')
|
||||||
p++;
|
p++;
|
||||||
if (*p >= '0' && *p <= '9')
|
if (*p >= '0' && *p <= '9')
|
||||||
|
|
20
gdb/jv-exp.y
20
gdb/jv-exp.y
|
@ -47,6 +47,7 @@
|
||||||
#include "symfile.h" /* Required by objfiles.h. */
|
#include "symfile.h" /* Required by objfiles.h. */
|
||||||
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
|
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
|
||||||
#include "block.h"
|
#include "block.h"
|
||||||
|
#include "completer.h"
|
||||||
|
|
||||||
#define parse_type builtin_type (parse_gdbarch)
|
#define parse_type builtin_type (parse_gdbarch)
|
||||||
#define parse_java_type builtin_java_type (parse_gdbarch)
|
#define parse_java_type builtin_java_type (parse_gdbarch)
|
||||||
|
@ -154,7 +155,7 @@ static void insert_exp (int, struct expression *);
|
||||||
|
|
||||||
%{
|
%{
|
||||||
/* YYSTYPE gets defined by %union */
|
/* YYSTYPE gets defined by %union */
|
||||||
static int parse_number (char *, int, int, YYSTYPE *);
|
static int parse_number (const char *, int, int, YYSTYPE *);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%type <lval> rcurly Dims Dims_opt
|
%type <lval> rcurly Dims Dims_opt
|
||||||
|
@ -345,10 +346,13 @@ QualifiedName:
|
||||||
$$.ptr = $1.ptr; /* Optimization. */
|
$$.ptr = $1.ptr; /* Optimization. */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$$.ptr = (char *) malloc ($$.length + 1);
|
char *buf;
|
||||||
make_cleanup (free, $$.ptr);
|
|
||||||
sprintf ($$.ptr, "%.*s.%.*s",
|
buf = malloc ($$.length + 1);
|
||||||
|
make_cleanup (free, buf);
|
||||||
|
sprintf (buf, "%.*s.%.*s",
|
||||||
$1.length, $1.ptr, $3.length, $3.ptr);
|
$1.length, $1.ptr, $3.length, $3.ptr);
|
||||||
|
$$.ptr = buf;
|
||||||
} }
|
} }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -696,7 +700,7 @@ Expression:
|
||||||
/*** Needs some error checking for the float case ***/
|
/*** Needs some error checking for the float case ***/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere)
|
parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
||||||
{
|
{
|
||||||
ULONGEST n = 0;
|
ULONGEST n = 0;
|
||||||
ULONGEST limit, limit_div_base;
|
ULONGEST limit, limit_div_base;
|
||||||
|
@ -858,8 +862,8 @@ yylex (void)
|
||||||
int c;
|
int c;
|
||||||
int namelen;
|
int namelen;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
char *tokstart;
|
const char *tokstart;
|
||||||
char *tokptr;
|
const char *tokptr;
|
||||||
int tempbufindex;
|
int tempbufindex;
|
||||||
static char *tempbuf;
|
static char *tempbuf;
|
||||||
static int tempbufsize;
|
static int tempbufsize;
|
||||||
|
@ -966,7 +970,7 @@ yylex (void)
|
||||||
{
|
{
|
||||||
/* It's a number. */
|
/* It's a number. */
|
||||||
int got_dot = 0, got_e = 0, toktype;
|
int got_dot = 0, got_e = 0, toktype;
|
||||||
char *p = tokstart;
|
const char *p = tokstart;
|
||||||
int hex = input_radix > 10;
|
int hex = input_radix > 10;
|
||||||
|
|
||||||
if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
|
if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
|
||||||
|
|
|
@ -278,10 +278,10 @@ struct ls_parser
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
/* Save head of input stream. */
|
/* Save head of input stream. */
|
||||||
char *saved_arg;
|
const char *saved_arg;
|
||||||
|
|
||||||
/* Head of the input stream. */
|
/* Head of the input stream. */
|
||||||
char **stream;
|
const char **stream;
|
||||||
#define PARSER_STREAM(P) (*(P)->lexer.stream)
|
#define PARSER_STREAM(P) (*(P)->lexer.stream)
|
||||||
|
|
||||||
/* The current token. */
|
/* The current token. */
|
||||||
|
@ -320,7 +320,7 @@ static CORE_ADDR linespec_expression_to_pc (const char **exp_ptr);
|
||||||
|
|
||||||
static struct symtabs_and_lines decode_objc (struct linespec_state *self,
|
static struct symtabs_and_lines decode_objc (struct linespec_state *self,
|
||||||
linespec_p ls,
|
linespec_p ls,
|
||||||
char **argptr);
|
const char **argptr);
|
||||||
|
|
||||||
static VEC (symtab_ptr) *symtabs_from_filename (const char *);
|
static VEC (symtab_ptr) *symtabs_from_filename (const char *);
|
||||||
|
|
||||||
|
@ -515,12 +515,12 @@ is_closing_quote_enclosed (const char *p)
|
||||||
This helper function assists with lexing string segments
|
This helper function assists with lexing string segments
|
||||||
which might contain valid (non-terminating) commas. */
|
which might contain valid (non-terminating) commas. */
|
||||||
|
|
||||||
static char *
|
static const char *
|
||||||
find_parameter_list_end (char *input)
|
find_parameter_list_end (const char *input)
|
||||||
{
|
{
|
||||||
char end_char, start_char;
|
char end_char, start_char;
|
||||||
int depth;
|
int depth;
|
||||||
char *p;
|
const char *p;
|
||||||
|
|
||||||
start_char = *input;
|
start_char = *input;
|
||||||
if (start_char == '(')
|
if (start_char == '(')
|
||||||
|
@ -557,7 +557,7 @@ static linespec_token
|
||||||
linespec_lexer_lex_string (linespec_parser *parser)
|
linespec_lexer_lex_string (linespec_parser *parser)
|
||||||
{
|
{
|
||||||
linespec_token token;
|
linespec_token token;
|
||||||
char *start = PARSER_STREAM (parser);
|
const char *start = PARSER_STREAM (parser);
|
||||||
|
|
||||||
token.type = LSTOKEN_STRING;
|
token.type = LSTOKEN_STRING;
|
||||||
|
|
||||||
|
@ -607,7 +607,7 @@ linespec_lexer_lex_string (linespec_parser *parser)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *p;
|
const char *p;
|
||||||
|
|
||||||
/* Otherwise, only identifier characters are permitted.
|
/* Otherwise, only identifier characters are permitted.
|
||||||
Spaces are the exception. In general, we keep spaces,
|
Spaces are the exception. In general, we keep spaces,
|
||||||
|
@ -621,7 +621,7 @@ linespec_lexer_lex_string (linespec_parser *parser)
|
||||||
{
|
{
|
||||||
if (isspace (*PARSER_STREAM (parser)))
|
if (isspace (*PARSER_STREAM (parser)))
|
||||||
{
|
{
|
||||||
p = skip_spaces (PARSER_STREAM (parser));
|
p = skip_spaces_const (PARSER_STREAM (parser));
|
||||||
/* When we get here we know we've found something followed by
|
/* When we get here we know we've found something followed by
|
||||||
a space (we skip over parens and templates below).
|
a space (we skip over parens and templates below).
|
||||||
So if we find a keyword now, we know it is a keyword and not,
|
So if we find a keyword now, we know it is a keyword and not,
|
||||||
|
@ -681,7 +681,7 @@ linespec_lexer_lex_string (linespec_parser *parser)
|
||||||
else if (*PARSER_STREAM (parser) == '<'
|
else if (*PARSER_STREAM (parser) == '<'
|
||||||
|| *PARSER_STREAM (parser) == '(')
|
|| *PARSER_STREAM (parser) == '(')
|
||||||
{
|
{
|
||||||
char *p;
|
const char *p;
|
||||||
|
|
||||||
p = find_parameter_list_end (PARSER_STREAM (parser));
|
p = find_parameter_list_end (PARSER_STREAM (parser));
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
|
@ -733,7 +733,7 @@ linespec_lexer_lex_one (linespec_parser *parser)
|
||||||
if (parser->lexer.current.type == LSTOKEN_CONSUMED)
|
if (parser->lexer.current.type == LSTOKEN_CONSUMED)
|
||||||
{
|
{
|
||||||
/* Skip any whitespace. */
|
/* Skip any whitespace. */
|
||||||
PARSER_STREAM (parser) = skip_spaces (PARSER_STREAM (parser));
|
PARSER_STREAM (parser) = skip_spaces_const (PARSER_STREAM (parser));
|
||||||
|
|
||||||
/* Check for a keyword, they end the linespec. */
|
/* Check for a keyword, they end the linespec. */
|
||||||
keyword = NULL;
|
keyword = NULL;
|
||||||
|
@ -819,7 +819,7 @@ static linespec_token
|
||||||
linespec_lexer_peek_token (linespec_parser *parser)
|
linespec_lexer_peek_token (linespec_parser *parser)
|
||||||
{
|
{
|
||||||
linespec_token next;
|
linespec_token next;
|
||||||
char *saved_stream = PARSER_STREAM (parser);
|
const char *saved_stream = PARSER_STREAM (parser);
|
||||||
linespec_token saved_token = parser->lexer.current;
|
linespec_token saved_token = parser->lexer.current;
|
||||||
|
|
||||||
next = linespec_lexer_consume_token (parser);
|
next = linespec_lexer_consume_token (parser);
|
||||||
|
@ -2144,7 +2144,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec_p ls)
|
||||||
/* Parse the linespec in ARGPTR. */
|
/* Parse the linespec in ARGPTR. */
|
||||||
|
|
||||||
static struct symtabs_and_lines
|
static struct symtabs_and_lines
|
||||||
parse_linespec (linespec_parser *parser, char **argptr)
|
parse_linespec (linespec_parser *parser, const char **argptr)
|
||||||
{
|
{
|
||||||
linespec_token token;
|
linespec_token token;
|
||||||
struct symtabs_and_lines values;
|
struct symtabs_and_lines values;
|
||||||
|
@ -2426,6 +2426,7 @@ decode_line_full (char **argptr, int flags,
|
||||||
VEC (const_char_ptr) *filters = NULL;
|
VEC (const_char_ptr) *filters = NULL;
|
||||||
linespec_parser parser;
|
linespec_parser parser;
|
||||||
struct linespec_state *state;
|
struct linespec_state *state;
|
||||||
|
const char *copy, *orig;
|
||||||
|
|
||||||
gdb_assert (canonical != NULL);
|
gdb_assert (canonical != NULL);
|
||||||
/* The filter only makes sense for 'all'. */
|
/* The filter only makes sense for 'all'. */
|
||||||
|
@ -2441,7 +2442,9 @@ decode_line_full (char **argptr, int flags,
|
||||||
cleanups = make_cleanup (linespec_parser_delete, &parser);
|
cleanups = make_cleanup (linespec_parser_delete, &parser);
|
||||||
save_current_program_space ();
|
save_current_program_space ();
|
||||||
|
|
||||||
result = parse_linespec (&parser, argptr);
|
orig = copy = *argptr;
|
||||||
|
result = parse_linespec (&parser, ©);
|
||||||
|
*argptr += copy - orig;
|
||||||
state = PARSER_STATE (&parser);
|
state = PARSER_STATE (&parser);
|
||||||
|
|
||||||
gdb_assert (result.nelts == 1 || canonical->pre_expanded);
|
gdb_assert (result.nelts == 1 || canonical->pre_expanded);
|
||||||
|
@ -2496,13 +2499,16 @@ decode_line_1 (char **argptr, int flags,
|
||||||
struct symtabs_and_lines result;
|
struct symtabs_and_lines result;
|
||||||
linespec_parser parser;
|
linespec_parser parser;
|
||||||
struct cleanup *cleanups;
|
struct cleanup *cleanups;
|
||||||
|
const char *copy, *orig;
|
||||||
|
|
||||||
linespec_parser_new (&parser, flags, current_language, default_symtab,
|
linespec_parser_new (&parser, flags, current_language, default_symtab,
|
||||||
default_line, NULL);
|
default_line, NULL);
|
||||||
cleanups = make_cleanup (linespec_parser_delete, &parser);
|
cleanups = make_cleanup (linespec_parser_delete, &parser);
|
||||||
save_current_program_space ();
|
save_current_program_space ();
|
||||||
|
|
||||||
result = parse_linespec (&parser, argptr);
|
orig = copy = *argptr;
|
||||||
|
result = parse_linespec (&parser, ©);
|
||||||
|
*argptr += copy - orig;
|
||||||
|
|
||||||
do_cleanups (cleanups);
|
do_cleanups (cleanups);
|
||||||
return result;
|
return result;
|
||||||
|
@ -2602,12 +2608,12 @@ linespec_expression_to_pc (const char **exp_ptr)
|
||||||
the existing C++ code to let the user choose one. */
|
the existing C++ code to let the user choose one. */
|
||||||
|
|
||||||
static struct symtabs_and_lines
|
static struct symtabs_and_lines
|
||||||
decode_objc (struct linespec_state *self, linespec_p ls, char **argptr)
|
decode_objc (struct linespec_state *self, linespec_p ls, const char **argptr)
|
||||||
{
|
{
|
||||||
struct collect_info info;
|
struct collect_info info;
|
||||||
VEC (const_char_ptr) *symbol_names = NULL;
|
VEC (const_char_ptr) *symbol_names = NULL;
|
||||||
struct symtabs_and_lines values;
|
struct symtabs_and_lines values;
|
||||||
char *new_argptr;
|
const char *new_argptr;
|
||||||
struct cleanup *cleanup = make_cleanup (VEC_cleanup (const_char_ptr),
|
struct cleanup *cleanup = make_cleanup (VEC_cleanup (const_char_ptr),
|
||||||
&symbol_names);
|
&symbol_names);
|
||||||
|
|
||||||
|
@ -3053,7 +3059,7 @@ find_function_symbols (struct linespec_state *state,
|
||||||
info.file_symtabs = file_symtabs;
|
info.file_symtabs = file_symtabs;
|
||||||
|
|
||||||
/* Try NAME as an Objective-C selector. */
|
/* Try NAME as an Objective-C selector. */
|
||||||
find_imps ((char *) name, &symbol_names);
|
find_imps (name, &symbol_names);
|
||||||
if (!VEC_empty (const_char_ptr, symbol_names))
|
if (!VEC_empty (const_char_ptr, symbol_names))
|
||||||
add_all_symbol_names_from_pspace (&info, NULL, symbol_names);
|
add_all_symbol_names_from_pspace (&info, NULL, symbol_names);
|
||||||
else
|
else
|
||||||
|
|
|
@ -662,7 +662,7 @@ type
|
||||||
static int
|
static int
|
||||||
parse_number (int olen)
|
parse_number (int olen)
|
||||||
{
|
{
|
||||||
char *p = lexptr;
|
const char *p = lexptr;
|
||||||
LONGEST n = 0;
|
LONGEST n = 0;
|
||||||
LONGEST prevn = 0;
|
LONGEST prevn = 0;
|
||||||
int c,i,ischar=0;
|
int c,i,ischar=0;
|
||||||
|
@ -814,7 +814,7 @@ yylex (void)
|
||||||
int c;
|
int c;
|
||||||
int namelen;
|
int namelen;
|
||||||
int i;
|
int i;
|
||||||
char *tokstart;
|
const char *tokstart;
|
||||||
char quote;
|
char quote;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
|
@ -927,7 +927,7 @@ yylex (void)
|
||||||
{
|
{
|
||||||
/* It's a number. */
|
/* It's a number. */
|
||||||
int got_dot = 0, got_e = 0;
|
int got_dot = 0, got_e = 0;
|
||||||
char *p = tokstart;
|
const char *p = tokstart;
|
||||||
int toktype;
|
int toktype;
|
||||||
|
|
||||||
for (++p ;; ++p)
|
for (++p ;; ++p)
|
||||||
|
|
|
@ -360,8 +360,11 @@ get_character_constant (struct macro_buffer *tok, char *p, char *end)
|
||||||
}
|
}
|
||||||
else if (*p == '\\')
|
else if (*p == '\\')
|
||||||
{
|
{
|
||||||
p++;
|
const char *s, *o;
|
||||||
char_count += c_parse_escape (&p, NULL);
|
|
||||||
|
s = o = ++p;
|
||||||
|
char_count += c_parse_escape (&s, NULL);
|
||||||
|
p += s - o;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -414,8 +417,11 @@ get_string_literal (struct macro_buffer *tok, char *p, char *end)
|
||||||
"constants."));
|
"constants."));
|
||||||
else if (*p == '\\')
|
else if (*p == '\\')
|
||||||
{
|
{
|
||||||
p++;
|
const char *s, *o;
|
||||||
c_parse_escape (&p, NULL);
|
|
||||||
|
s = o = ++p;
|
||||||
|
c_parse_escape (&s, NULL);
|
||||||
|
p += s - o;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
p++;
|
p++;
|
||||||
|
@ -1434,7 +1440,7 @@ macro_expand_once (const char *source,
|
||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
macro_expand_next (char **lexptr,
|
macro_expand_next (const char **lexptr,
|
||||||
macro_lookup_ftype *lookup_func,
|
macro_lookup_ftype *lookup_func,
|
||||||
void *lookup_baton)
|
void *lookup_baton)
|
||||||
{
|
{
|
||||||
|
@ -1442,7 +1448,7 @@ macro_expand_next (char **lexptr,
|
||||||
struct cleanup *back_to;
|
struct cleanup *back_to;
|
||||||
|
|
||||||
/* Set up SRC to refer to the input text, pointed to by *lexptr. */
|
/* Set up SRC to refer to the input text, pointed to by *lexptr. */
|
||||||
init_shared_buffer (&src, *lexptr, strlen (*lexptr));
|
init_shared_buffer (&src, (char *) *lexptr, strlen (*lexptr));
|
||||||
|
|
||||||
/* Set up DEST to receive the expansion, if there is one. */
|
/* Set up DEST to receive the expansion, if there is one. */
|
||||||
init_buffer (&dest, 0);
|
init_buffer (&dest, 0);
|
||||||
|
|
|
@ -80,7 +80,7 @@ char *macro_expand_once (const char *source,
|
||||||
much have to do tokenization to find the end of the string that
|
much have to do tokenization to find the end of the string that
|
||||||
needs to be macro-expanded. Our C/C++ tokenizer isn't really
|
needs to be macro-expanded. Our C/C++ tokenizer isn't really
|
||||||
designed to be called by anything but the yacc parser engine. */
|
designed to be called by anything but the yacc parser engine. */
|
||||||
char *macro_expand_next (char **lexptr,
|
char *macro_expand_next (const char **lexptr,
|
||||||
macro_lookup_ftype *lookup_func,
|
macro_lookup_ftype *lookup_func,
|
||||||
void *lookup_baton);
|
void *lookup_baton);
|
||||||
|
|
||||||
|
|
|
@ -426,7 +426,8 @@ start_msglist(void)
|
||||||
void
|
void
|
||||||
add_msglist(struct stoken *str, int addcolon)
|
add_msglist(struct stoken *str, int addcolon)
|
||||||
{
|
{
|
||||||
char *s, *p;
|
char *s;
|
||||||
|
const char *p;
|
||||||
int len, plen;
|
int len, plen;
|
||||||
|
|
||||||
if (str == 0) /* Unnamed arg, or... */
|
if (str == 0) /* Unnamed arg, or... */
|
||||||
|
@ -1071,7 +1072,7 @@ uniquify_strings (VEC (const_char_ptr) **strings)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function: find_imps (char *selector, struct symbol **sym_arr)
|
* Function: find_imps (const char *selector, struct symbol **sym_arr)
|
||||||
*
|
*
|
||||||
* Input: a string representing a selector
|
* Input: a string representing a selector
|
||||||
* a pointer to an array of symbol pointers
|
* a pointer to an array of symbol pointers
|
||||||
|
@ -1100,8 +1101,8 @@ uniquify_strings (VEC (const_char_ptr) **strings)
|
||||||
* be the index of the first non-debuggable one).
|
* be the index of the first non-debuggable one).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
find_imps (char *method, VEC (const_char_ptr) **symbol_names)
|
find_imps (const char *method, VEC (const_char_ptr) **symbol_names)
|
||||||
{
|
{
|
||||||
char type = '\0';
|
char type = '\0';
|
||||||
char *class = NULL;
|
char *class = NULL;
|
||||||
|
|
|
@ -36,7 +36,8 @@ extern char *objc_demangle (const char *mangled, int options);
|
||||||
|
|
||||||
extern int find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc);
|
extern int find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc);
|
||||||
|
|
||||||
extern char *find_imps (char *method, VEC (const_char_ptr) **symbol_names);
|
extern const char *
|
||||||
|
find_imps (const char *method, VEC (const_char_ptr) **symbol_names);
|
||||||
|
|
||||||
extern struct value *value_nsstring (struct gdbarch *gdbarch,
|
extern struct value *value_nsstring (struct gdbarch *gdbarch,
|
||||||
char *ptr, int len);
|
char *ptr, int len);
|
||||||
|
|
42
gdb/p-exp.y
42
gdb/p-exp.y
|
@ -55,6 +55,7 @@
|
||||||
#include "symfile.h" /* Required by objfiles.h. */
|
#include "symfile.h" /* Required by objfiles.h. */
|
||||||
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols. */
|
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols. */
|
||||||
#include "block.h"
|
#include "block.h"
|
||||||
|
#include "completer.h"
|
||||||
|
|
||||||
#define parse_type builtin_type (parse_gdbarch)
|
#define parse_type builtin_type (parse_gdbarch)
|
||||||
|
|
||||||
|
@ -158,7 +159,7 @@ static char * uptok (char *, int);
|
||||||
|
|
||||||
%{
|
%{
|
||||||
/* YYSTYPE gets defined by %union */
|
/* YYSTYPE gets defined by %union */
|
||||||
static int parse_number (char *, int, int, YYSTYPE *);
|
static int parse_number (const char *, int, int, YYSTYPE *);
|
||||||
|
|
||||||
static struct type *current_type;
|
static struct type *current_type;
|
||||||
static struct internalvar *intvar;
|
static struct internalvar *intvar;
|
||||||
|
@ -352,9 +353,12 @@ exp : exp '['
|
||||||
if (arrayfieldindex)
|
if (arrayfieldindex)
|
||||||
{
|
{
|
||||||
struct stoken stringsval;
|
struct stoken stringsval;
|
||||||
stringsval.ptr = alloca (strlen (arrayname) + 1);
|
char *buf;
|
||||||
|
|
||||||
|
buf = alloca (strlen (arrayname) + 1);
|
||||||
|
stringsval.ptr = buf;
|
||||||
stringsval.length = strlen (arrayname);
|
stringsval.length = strlen (arrayname);
|
||||||
strcpy (stringsval.ptr, arrayname);
|
strcpy (buf, arrayname);
|
||||||
current_type = TYPE_FIELD_TYPE (current_type,
|
current_type = TYPE_FIELD_TYPE (current_type,
|
||||||
arrayfieldindex - 1);
|
arrayfieldindex - 1);
|
||||||
write_exp_elt_opcode (STRUCTOP_STRUCT);
|
write_exp_elt_opcode (STRUCTOP_STRUCT);
|
||||||
|
@ -591,7 +595,8 @@ exp : STRING
|
||||||
the array upper bound is the string length.
|
the array upper bound is the string length.
|
||||||
There is no such thing in C as a completely empty
|
There is no such thing in C as a completely empty
|
||||||
string. */
|
string. */
|
||||||
char *sp = $1.ptr; int count = $1.length;
|
const char *sp = $1.ptr; int count = $1.length;
|
||||||
|
|
||||||
while (count-- > 0)
|
while (count-- > 0)
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (OP_LONG);
|
||||||
|
@ -854,7 +859,7 @@ name_not_typename : NAME
|
||||||
/*** Needs some error checking for the float case ***/
|
/*** Needs some error checking for the float case ***/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere)
|
parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
|
||||||
{
|
{
|
||||||
/* FIXME: Shouldn't these be unsigned? We don't deal with negative values
|
/* FIXME: Shouldn't these be unsigned? We don't deal with negative values
|
||||||
here, and we do kind of silly things like cast to unsigned. */
|
here, and we do kind of silly things like cast to unsigned. */
|
||||||
|
@ -1141,8 +1146,10 @@ yylex (void)
|
||||||
|
|
||||||
prev_lexptr = lexptr;
|
prev_lexptr = lexptr;
|
||||||
|
|
||||||
tokstart = lexptr;
|
|
||||||
explen = strlen (lexptr);
|
explen = strlen (lexptr);
|
||||||
|
tokstart = alloca (explen + 1);
|
||||||
|
memcpy (tokstart, lexptr, explen + 1);
|
||||||
|
|
||||||
/* See if it is a special token of length 3. */
|
/* See if it is a special token of length 3. */
|
||||||
if (explen > 2)
|
if (explen > 2)
|
||||||
for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
|
for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
|
||||||
|
@ -1361,13 +1368,18 @@ yylex (void)
|
||||||
/* Do nothing, loop will terminate. */
|
/* Do nothing, loop will terminate. */
|
||||||
break;
|
break;
|
||||||
case '\\':
|
case '\\':
|
||||||
tokptr++;
|
{
|
||||||
c = parse_escape (parse_gdbarch, &tokptr);
|
const char *s, *o;
|
||||||
if (c == -1)
|
|
||||||
{
|
o = s = ++tokptr;
|
||||||
continue;
|
c = parse_escape (parse_gdbarch, &s);
|
||||||
}
|
*tokptr += s - o;
|
||||||
tempbuf[tempbufindex++] = c;
|
if (c == -1)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
tempbuf[tempbufindex++] = c;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
tempbuf[tempbufindex++] = *tokptr++;
|
tempbuf[tempbufindex++] = *tokptr++;
|
||||||
|
@ -1623,8 +1635,8 @@ yylex (void)
|
||||||
distinction) named x, then this code incorrectly thinks we
|
distinction) named x, then this code incorrectly thinks we
|
||||||
are dealing with nested types rather than a member function. */
|
are dealing with nested types rather than a member function. */
|
||||||
|
|
||||||
char *p;
|
const char *p;
|
||||||
char *namestart;
|
const char *namestart;
|
||||||
struct symbol *best_sym;
|
struct symbol *best_sym;
|
||||||
|
|
||||||
/* Look ahead to detect nested types. This probably should be
|
/* Look ahead to detect nested types. This probably should be
|
||||||
|
|
22
gdb/parse.c
22
gdb/parse.c
|
@ -75,8 +75,8 @@ CORE_ADDR expression_context_pc;
|
||||||
const struct block *innermost_block;
|
const struct block *innermost_block;
|
||||||
int arglist_len;
|
int arglist_len;
|
||||||
static struct type_stack type_stack;
|
static struct type_stack type_stack;
|
||||||
char *lexptr;
|
const char *lexptr;
|
||||||
char *prev_lexptr;
|
const char *prev_lexptr;
|
||||||
int paren_depth;
|
int paren_depth;
|
||||||
int comma_terminates;
|
int comma_terminates;
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ static int prefixify_subexp (struct expression *, struct expression *, int,
|
||||||
static struct expression *parse_exp_in_context (const char **, CORE_ADDR,
|
static struct expression *parse_exp_in_context (const char **, CORE_ADDR,
|
||||||
const struct block *, int,
|
const struct block *, int,
|
||||||
int, int *);
|
int, int *);
|
||||||
static struct expression *parse_exp_in_context_1 (char **, CORE_ADDR,
|
static struct expression *parse_exp_in_context_1 (const char **, CORE_ADDR,
|
||||||
const struct block *, int,
|
const struct block *, int,
|
||||||
int, int *);
|
int, int *);
|
||||||
|
|
||||||
|
@ -733,8 +733,8 @@ handle_register:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
find_template_name_end (char *p)
|
find_template_name_end (const char *p)
|
||||||
{
|
{
|
||||||
int depth = 1;
|
int depth = 1;
|
||||||
int just_seen_right = 0;
|
int just_seen_right = 0;
|
||||||
|
@ -1142,16 +1142,8 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
int comma, int void_context_p, int *out_subexp)
|
int comma, int void_context_p, int *out_subexp)
|
||||||
{
|
{
|
||||||
struct expression *expr;
|
return parse_exp_in_context_1 (stringptr, pc, block, comma,
|
||||||
char *const_hack = *stringptr ? xstrdup (*stringptr) : NULL;
|
|
||||||
char *orig = const_hack;
|
|
||||||
struct cleanup *back_to = make_cleanup (xfree, const_hack);
|
|
||||||
|
|
||||||
expr = parse_exp_in_context_1 (&const_hack, pc, block, comma,
|
|
||||||
void_context_p, out_subexp);
|
void_context_p, out_subexp);
|
||||||
(*stringptr) += const_hack - orig;
|
|
||||||
do_cleanups (back_to);
|
|
||||||
return expr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* As for parse_exp_1, except that if VOID_CONTEXT_P, then
|
/* As for parse_exp_1, except that if VOID_CONTEXT_P, then
|
||||||
|
@ -1162,7 +1154,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
|
||||||
is left untouched. */
|
is left untouched. */
|
||||||
|
|
||||||
static struct expression *
|
static struct expression *
|
||||||
parse_exp_in_context_1 (char **stringptr, CORE_ADDR pc,
|
parse_exp_in_context_1 (const char **stringptr, CORE_ADDR pc,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
int comma, int void_context_p, int *out_subexp)
|
int comma, int void_context_p, int *out_subexp)
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,7 +67,7 @@ extern int arglist_len;
|
||||||
struct stoken
|
struct stoken
|
||||||
{
|
{
|
||||||
/* Pointer to first byte of char-string or first bit of bit-string. */
|
/* Pointer to first byte of char-string or first bit of bit-string. */
|
||||||
char *ptr;
|
const char *ptr;
|
||||||
/* Length of string in bytes for char-string or bits for bit-string. */
|
/* Length of string in bytes for char-string or bits for bit-string. */
|
||||||
int length;
|
int length;
|
||||||
};
|
};
|
||||||
|
@ -201,7 +201,7 @@ extern void write_dollar_variable (struct stoken str);
|
||||||
|
|
||||||
extern void mark_struct_expression (void);
|
extern void mark_struct_expression (void);
|
||||||
|
|
||||||
extern char *find_template_name_end (char *);
|
extern const char *find_template_name_end (const char *);
|
||||||
|
|
||||||
extern void start_arglist (void);
|
extern void start_arglist (void);
|
||||||
|
|
||||||
|
@ -264,11 +264,11 @@ extern int parse_c_float (struct gdbarch *gdbarch, const char *p, int len,
|
||||||
/* During parsing of a C expression, the pointer to the next character
|
/* During parsing of a C expression, the pointer to the next character
|
||||||
is in this variable. */
|
is in this variable. */
|
||||||
|
|
||||||
extern char *lexptr;
|
extern const char *lexptr;
|
||||||
|
|
||||||
/* After a token has been recognized, this variable points to it.
|
/* After a token has been recognized, this variable points to it.
|
||||||
Currently used only for error reporting. */
|
Currently used only for error reporting. */
|
||||||
extern char *prev_lexptr;
|
extern const char *prev_lexptr;
|
||||||
|
|
||||||
/* Current depth in parentheses within the expression. */
|
/* Current depth in parentheses within the expression. */
|
||||||
|
|
||||||
|
|
|
@ -1412,7 +1412,7 @@ host_char_to_target (struct gdbarch *gdbarch, int c, int *target_c)
|
||||||
after the zeros. A value of 0 does not mean end of string. */
|
after the zeros. A value of 0 does not mean end of string. */
|
||||||
|
|
||||||
int
|
int
|
||||||
parse_escape (struct gdbarch *gdbarch, char **string_ptr)
|
parse_escape (struct gdbarch *gdbarch, const char **string_ptr)
|
||||||
{
|
{
|
||||||
int target_char = -2; /* Initialize to avoid GCC warnings. */
|
int target_char = -2; /* Initialize to avoid GCC warnings. */
|
||||||
int c = *(*string_ptr)++;
|
int c = *(*string_ptr)++;
|
||||||
|
|
|
@ -64,7 +64,7 @@ struct timeval get_prompt_for_continue_wait_time (void);
|
||||||
|
|
||||||
extern int parse_pid_to_attach (char *args);
|
extern int parse_pid_to_attach (char *args);
|
||||||
|
|
||||||
extern int parse_escape (struct gdbarch *, char **);
|
extern int parse_escape (struct gdbarch *, const char **);
|
||||||
|
|
||||||
char **gdb_buildargv (const char *);
|
char **gdb_buildargv (const char *);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue