+2002-09-18 Andrew Cagney <ac131313@redhat.com>
+
+ * breakpoint.c, c-exp.y, defs.h, elfread.c, expression.h,
+ jv-exp.y, language.c, language.h, p-exp.y, parse.c, parser-defs.h,
+ printcmd.c, source.c, stabsread.c, symfile.c, symtab.h, utils.c,
+ valops.c, value.h: Revert previous change.
+
2002-09-18 Michael Snyder <msnyder@redhat.com>
Preliminary support for Objective-C:
current_source_symtab (which is decode_line_1's default). This
should produce the results we want almost all of the time while
leaving default_breakpoint_* alone. */
- /* Also ignore objc method name. FIXME better comment? */
if (default_breakpoint_valid
&& (!current_source_symtab
- || ((strchr ("+-", (*address)[0]) != NULL)
- && ((*address)[1] != '['))))
+ || (strchr ("+-", (*address)[0]) != NULL)))
*sals = decode_line_1 (address, 1, default_breakpoint_symtab,
default_breakpoint_line, addr_string);
else
- *sals = decode_line_1 (address, 1, (struct symtab *) NULL,
- 0, addr_string);
+ *sals = decode_line_1 (address, 1, (struct symtab *) NULL, 0, addr_string);
}
/* For any SAL that didn't have a canonical string, fill one in. */
if (sals->nelts > 0 && *addr_string == NULL)
#include "bfd.h" /* Required by objfiles.h. */
#include "symfile.h" /* Required by objfiles.h. */
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
-#include "completer.h" /* For skip_quoted(). */
/* Flag indicating we're dealing with HP-compiled objects */
extern int hp_som_som_object_present;
language_auto, /* Placeholder for automatic setting */
language_c, /* C */
language_cplus, /* C++ */
- language_objc, /* Objective-C */
language_java, /* Java */
/* OBSOLETE language_chill, */ /* Chill */
language_fortran, /* Fortran */
extern void puts_unfiltered (const char *);
-extern void puts_filtered_tabular (char *string, int width, int right);
-
extern void puts_debug (char *prefix, char *string, char *suffix);
extern void vprintf_filtered (const char *, va_list) ATTR_FORMAT (printf, 1, 0);
typedef void initialize_file_ftype (void);
+extern char *skip_quoted (char *);
+
extern char *gdb_readline (char *);
extern char *gdb_readline_wrapper (char *);
}
else if (sym->section->flags & SEC_CODE)
{
- if (sym->name[0] == '.'
- && (strncmp (sym->name + 1, "objc_", 4) == 0))
- {
- /* Looks like an Objective-C special symbol */
- continue;
- }
- else if (sym->flags & BSF_GLOBAL)
+ if (sym->flags & BSF_GLOBAL)
{
ms_type = mst_text;
}
making three exp_elements. */
OP_FUNCALL,
- /* OP_MSGCALL is followed by a string in the next exp_element and then an
- integer. The string is the selector string. The integer is the number
- of arguments to the message call. That many plus one values are used,
- the first one being the object pointer. This is an Objective C message */
- OP_MSGCALL,
-
/* This is EXACTLY like OP_FUNCALL but is semantically different.
In F77, array subscript expressions, substring expressions
and function calls are all exactly the same syntactically. They may
STRUCTOP_STRUCT,
STRUCTOP_PTR,
- /* C++:
- OP_THIS is just a placeholder for the class instance variable.
+ /* C++ */
+ /* OP_THIS is just a placeholder for the class instance variable.
It just comes in a tight (OP_THIS, OP_THIS) pair. */
OP_THIS,
- /* Objective C: "@selector" pseudo-operator */
- OP_SELECTOR,
-
- /* Objective C: OP_SELF is just a placeholder for the class instance
- variable. It just comes in a tight (OP_SELF, OP_SELF) pair. */
- OP_SELF,
-
/* OP_SCOPE surrounds a type name and a field name. The type
name is encoded as one element, but the field name stays as
a string, which, of course, is variable length. */
OP_NAME,
/* An unparsed expression. Used for Scheme (for now at least) */
- OP_EXPRSTRING,
-
- /* An Objective C Foundation Class NSString constant */
- OP_NSSTRING
+ OP_EXPRSTRING
};
union exp_element
/* From eval.c */
-/* Values of NOSIDE argument to evaluate_subexp. */
+/* Values of NOSIDE argument to eval_subexp. */
enum noside
{
#include "bfd.h" /* Required by objfiles.h. */
#include "symfile.h" /* Required by objfiles.h. */
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
-#include "completer.h" /* For skip_quoted(). */
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
as well as gratuitiously global symbol names, so we can have multiple
{
case language_c:
case language_cplus:
- case language_objc:
if (TYPE_CODE (t1) == TYPE_CODE_FLT)
return TYPE_CODE (t2) == TYPE_CODE_FLT && l2 > l1 ?
VALUE_TYPE (v2) : VALUE_TYPE (v1);
{
case language_c:
case language_cplus:
- case language_objc:
return (TYPE_CODE (type) != TYPE_CODE_INT) &&
(TYPE_CODE (type) != TYPE_CODE_ENUM) ? 0 : 1;
case language_m2:
case language_c:
case language_cplus:
- case language_objc:
return (TYPE_CODE (type) == TYPE_CODE_INT) &&
TYPE_LENGTH (type) == sizeof (char)
? 1 : 0;
case language_c:
case language_cplus:
- case language_objc:
/* C does not have distinct string type. */
return (0);
default:
{
case language_c:
case language_cplus:
- case language_objc:
/* Might be more cleanly handled by having a
TYPE_CODE_INT_NOT_BOOL for (OBSOLETE) CHILL and such
languages, or a TYPE_CODE_INT_OR_BOOL for C. */
{
case language_c:
case language_cplus:
- case language_objc:
return (TYPE_CODE (type) == TYPE_CODE_STRUCT) ||
(TYPE_CODE (type) == TYPE_CODE_UNION) ||
(TYPE_CODE (type) == TYPE_CODE_ARRAY);
#ifdef _LANG_c
case language_c:
case language_cplus:
- case language_objc:
switch (op)
{
case BINOP_DIV:
/* "cast" really means conversion */
/* FIXME -- should be a setting in language_defn */
#define CAST_IS_CONVERSION (current_language->la_language == language_c || \
- current_language->la_language == language_cplus || \
- current_language->la_language == language_objc)
+ current_language->la_language == language_cplus)
extern void language_info (int);
#include "bfd.h" /* Required by objfiles.h. */
#include "symfile.h" /* Required by objfiles.h. */
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
-#include "completer.h" /* For skip_quoted(). */
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
as well as gratuitiously global symbol names, so we can have multiple
args = 1 + longest_to_int (expr->elts[endpos - 2].longconst);
break;
- case OP_MSGCALL: /* Objective C message (method) call */
- oplen = 4;
- args = 1 + longest_to_int (expr->elts[endpos - 2].longconst);
- break;
-
case UNOP_MAX:
case UNOP_MIN:
oplen = 3;
/* fall through */
case OP_M2_STRING:
case OP_STRING:
- case OP_NSSTRING: /* Objective C Foundation Class NSString constant */
- case OP_SELECTOR: /* Objective C "@selector" pseudo-op */
case OP_NAME:
case OP_EXPRSTRING:
oplen = longest_to_int (expr->elts[endpos - 2].longconst);
/* C++ */
case OP_THIS:
- case OP_SELF:
oplen = 2;
break;
args = 1 + longest_to_int (inexpr->elts[inend - 2].longconst);
break;
- case OP_MSGCALL: /* Objective C message (method) call */
- oplen = 4;
- args = 1 + longest_to_int (inexpr->elts[inend - 2].longconst);
- break;
-
case UNOP_MIN:
case UNOP_MAX:
oplen = 3;
/* fall through */
case OP_M2_STRING:
case OP_STRING:
- case OP_NSSTRING: /* Objective C Foundation Class NSString constant */
- case OP_SELECTOR: /* Objective C "@selector" pseudo-op */
case OP_NAME:
case OP_EXPRSTRING:
oplen = longest_to_int (inexpr->elts[inend - 2].longconst);
/* C++ */
case OP_THIS:
- case OP_SELF:
oplen = 2;
break;
int is_a_field_of_this;
};
-struct objc_class_str
- {
- struct stoken stoken;
- struct type *type;
- int class;
- };
-
-
/* For parsing of complicated types.
An array should be preceded in the list by the size of the array. */
enum type_pieces
extern int target_map_name_to_register (char *, int);
-/* for parsing Objective C */
-extern void start_msglist (void);
-extern void add_msglist (struct stoken *str, int addcolon);
-extern int end_msglist (void);
-
/* Function used to avoid direct calls to fprintf
in the code generated by the bison parser. */
printf_filtered ("Symbol \"");
fprintf_symbol_filtered (gdb_stdout, exp,
current_language->la_language, DMGL_ANSI);
- printf_filtered ("\" is a field of the local class variable ");
- if (current_language->la_language == language_objc)
- printf_filtered ("'self'\n"); /* ObjC equivalent of "this" */
- else
- printf_filtered ("'this'\n");
+ printf_filtered ("\" is a field of the local class variable `this'\n");
return;
}
/* Print a list of files and line numbers which a user may choose from
in order to list a function which was specified ambiguously (as with
- `list classname::overloadedfuncname', or 'list objectiveCSelector:).
- The vector in SALS provides the filenames and line numbers.
- NOTE: some of the SALS may have no filename or line information! */
+ `list classname::overloadedfuncname', for example). The vector in
+ SALS provides the filenames and line numbers. */
static void
ambiguous_line_spec (struct symtabs_and_lines *sals)
}
}
-static char *
-objc_find_colon (name)
- char *name;
-{
- char *s = name;
- if (s[0] == '-' || *s == '+')
- {
- if (s[1] != '[')
- {
- error ("invalid symbol name \"%s\"", name);
- }
- s = strchr (s, ']');
- if (s == NULL)
- {
- error ("invalid symbol name \"%s\"", name);
- }
- return strchr (s, ':');
- }
- else
- {
- return strchr (s, ':');
- }
-}
-
/* ARGSUSED */
struct symbol *
define_symbol (CORE_ADDR valu, char *string, int desc, int type,
struct objfile *objfile)
{
register struct symbol *sym;
- char *p = (char *) objc_find_colon (string);
+ char *p = (char *) strchr (string, ':');
int deftype;
int synonym = 0;
register int i;
a typedef for "foo". Unfortunately, cfront never makes the typedef
when translating C++ into C. We make the typedef here so that
"ptype foo" works as expected for cfront translated code. */
- else if ((current_subfile->language == language_cplus)
- || (current_subfile->language == language_objc))
+ else if (current_subfile->language == language_cplus)
synonym = 1;
SYMBOL_TYPE (sym) = read_type (&p, objfile);
/* OBSOLETE add_filename_language (".ch", language_chill); */
/* OBSOLETE add_filename_language (".c186", language_chill); */
/* OBSOLETE add_filename_language (".c286", language_chill); */
- add_filename_language (".m", language_objc);
add_filename_language (".f", language_fortran);
add_filename_language (".F", language_fortran);
add_filename_language (".s", language_asm);
char *demangled_name;
}
cplus_specific;
- struct objc_specific
- {
- char *demangled_name;
- }
- objc_specific;
#if 0
/* OBSOLETE struct chill_specific *//* For Chill */
/* OBSOLETE { */
{ \
SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = NULL; \
} \
- else if (SYMBOL_LANGUAGE (symbol) == language_objc) \
- { \
- SYMBOL_OBJC_DEMANGLED_NAME (symbol) = NULL; \
- } \
/* OBSOLETE else if (SYMBOL_LANGUAGE (symbol) == language_chill) */ \
/* OBSOLETE { */ \
/* OBSOLETE SYMBOL_CHILL_DEMANGLED_NAME (symbol) = NULL; */ \
(SYMBOL_LANGUAGE (symbol) == language_cplus \
|| SYMBOL_LANGUAGE (symbol) == language_java \
? SYMBOL_CPLUS_DEMANGLED_NAME (symbol) \
- : (SYMBOL_LANGUAGE (symbol) == language_objc \
- ? SYMBOL_OBJC_DEMANGLED_NAME (symbol) \
: /* OBSOLETE (SYMBOL_LANGUAGE (symbol) == language_chill */ \
/* OBSOLETE ? SYMBOL_CHILL_DEMANGLED_NAME (symbol) */ \
- NULL))
+ NULL)
/* OBSOLETE #define SYMBOL_CHILL_DEMANGLED_NAME(symbol) */
/* OBSOLETE (symbol)->ginfo.language_specific.chill_specific.demangled_name */
-#define SYMBOL_OBJC_DEMANGLED_NAME(symbol) \
- (symbol)->ginfo.language_specific.objc_specific.demangled_name
-
/* Macro that returns the "natural source name" of a symbol. In C++ this is
the "demangled" form of the name if demangle is on and the "mangled" form
of the name if demangle is off. In other languages this is just the
int immediate_quit;
-/* Nonzero means that encoded C++/ObjC names should be printed out in their
- C++/ObjC form rather than raw. */
+/* Nonzero means that encoded C++ names should be printed out in their
+ C++ form rather than raw. */
int demangle = 1;
-/* Nonzero means that encoded C++/ObjC names should be printed out in their
- C++/ObjC form even in assembler language displays. If this is set, but
+/* Nonzero means that encoded C++ names should be printed out in their
+ C++ form even in assembler language displays. If this is set, but
DEMANGLE is zero, names are printed raw, i.e. DEMANGLE controls. */
int asm_demangle = 0;
void *arg)
{
register struct cleanup *new
- = (struct cleanup *) xmalloc (sizeof (struct cleanup));
+ = (struct cleanup *) xmalloc (sizeof (struct cleanup));
register struct cleanup *old_chain = *pmy_chain;
new->next = *pmy_chain;
}
}
-/* Print input string to gdb_stdout, filtered, with wrap,
- arranging strings in columns of n chars. String can be
- right or left justified in the column. Never prints
- trailing spaces. String should never be longer than
- width. FIXME: this could be useful for the EXAMINE
- command, which currently doesn't tabulate very well. */
-
-void
-puts_filtered_tabular (char *string, int width, int right)
-{
- int spaces = 0;
- int stringlen;
- char *spacebuf;
-
- gdb_assert (chars_per_line > 0);
- if (chars_per_line == UINT_MAX)
- {
- fputs_filtered (string, gdb_stdout);
- fputs_filtered ("\n", gdb_stdout);
- return;
- }
-
- if (((chars_printed - 1) / width + 2) * width >= chars_per_line)
- fputs_filtered ("\n", gdb_stdout);
-
- if (width >= chars_per_line)
- width = chars_per_line - 1;
-
- stringlen = strlen (string);
-
- if (chars_printed > 0)
- spaces = width - (chars_printed - 1) % width - 1;
- if (right)
- spaces += width - stringlen;
-
- spacebuf = alloca (spaces + 1);
- spacebuf[spaces] = '\0';
- while (spaces--)
- spacebuf[spaces] = ' ';
-
- fputs_filtered (spacebuf, gdb_stdout);
- fputs_filtered (string, gdb_stdout);
-}
-
-
/* Ensure that whatever gets printed next, using the filtered output
commands, starts at the beginning of the line. I.E. if there is
any pending output for the current line, flush it and start a new
fputs_filtered (n_spaces (n), stream);
}
\f
-/* C++/ObjC demangler stuff. */
+/* C++ demangler stuff. */
-/* fprintf_symbol_filtered attempts to demangle NAME, a symbol in
- language LANG, using demangling args ARG_MODE, and print it
- filtered to STREAM. If the name is not mangled, or the language
- for the name is unknown, or demangling is off, the name is printed
- in its "raw" form. */
+/* fprintf_symbol_filtered attempts to demangle NAME, a symbol in language
+ LANG, using demangling args ARG_MODE, and print it filtered to STREAM.
+ If the name is not mangled, or the language for the name is unknown, or
+ demangling is off, the name is printed in its "raw" form. */
void
-fprintf_symbol_filtered (struct ui_file *stream,
- char *name,
- enum language lang,
+fprintf_symbol_filtered (struct ui_file *stream, char *name, enum language lang,
int arg_mode)
{
char *demangled;
case language_java:
demangled = cplus_demangle (name, arg_mode | DMGL_JAVA);
break;
-#if 0 /* Enable once objective-c support is turned on. */
- case language_objc:
- demangled = objc_demangle (name);
- break;
-#endif
#if 0
/* OBSOLETE case language_chill: */
/* OBSOLETE demangled = chill_demangle (name); */
add_show_from_set
(add_set_cmd ("demangle", class_support, var_boolean,
(char *) &demangle,
- "Set demangling of encoded C++/ObjC names when displaying symbols.",
+ "Set demangling of encoded C++ names when displaying symbols.",
&setprintlist),
&showprintlist);
add_show_from_set
(add_set_cmd ("asm-demangle", class_support, var_boolean,
(char *) &asm_demangle,
- "Set demangling of C++/ObjC names in disassembly listings.",
+ "Set demangling of C++ names in disassembly listings.",
&setprintlist),
&showprintlist);
}
static int typecmp (int staticp, int varargs, int nargs,
struct field t1[], struct value *t2[]);
+static CORE_ADDR find_function_addr (struct value *, struct type **);
static struct value *value_arg_coerce (struct value *, struct type *, int);
+
static CORE_ADDR value_push (CORE_ADDR, struct value *);
static struct value *search_struct_field (char *, struct value *, int,
int unwind_on_signal_p = 0;
\f
+
/* Find the address of function name NAME in the inferior. */
struct value *
/* Determine a function's address and its return type from its value.
Calls error() if the function is not valid for calling. */
-CORE_ADDR
+static CORE_ADDR
find_function_addr (struct value *function, struct type **retval_type)
{
register struct type *ftype = check_typedef (VALUE_TYPE (function));
error ("Cannot invoke functions on this machine.");
}
}
-
-struct value *
-call_function_by_hand_expecting_type (struct value *function,
- struct type *expect_type,
- int nargs, struct value **args,
- int restore_frame)
-{
- if (CALL_DUMMY_P)
- {
- /* FIXME: Changes to func not implemented yet */
- return hand_function_call (function, nargs, args);
- }
- else
- {
- error ("Cannot invoke functions on this machine.");
- }
-}
\f
return new_val;
}
-/* Return the value of the local variable, if one exists.
+
+
+
+/* C++: return the value of the class instance variable, if one exists.
Flag COMPLAIN signals an error if the request is made in an
inappropriate context. */
struct value *
-value_of_local (const char *name, int complain)
+value_of_this (int complain)
{
struct symbol *func, *sym;
struct block *b;
int i;
- struct value * ret;
+ static const char funny_this[] = "this";
+ struct value *this;
if (selected_frame == 0)
{
if (!func)
{
if (complain)
- error ("no %s in nameless context", name);
+ error ("no `this' in nameless context");
else
return 0;
}
if (i <= 0)
{
if (complain)
- error ("no args, no %s", name);
+ error ("no args, no `this'");
else
return 0;
}
/* Calling lookup_block_symbol is necessary to get the LOC_REGISTER
symbol instead of the LOC_ARG one (if both exist). */
- sym = lookup_block_symbol (b, name, NULL, VAR_NAMESPACE);
+ sym = lookup_block_symbol (b, funny_this, NULL, VAR_NAMESPACE);
if (sym == NULL)
{
if (complain)
- error ("current stack frame does not contain a variable named \"%s\"", name);
+ error ("current stack frame not in method");
else
return NULL;
}
- ret = read_var_value (sym, selected_frame);
- if (ret == 0 && complain)
- error ("%s argument unreadable", name);
- return ret;
-}
-
-/* C++/Objective-C: return the value of the class instance variable,
- if one exists. Flag COMPLAIN signals an error if the request is
- made in an inappropriate context. */
-
-struct value *
-value_of_this (int complain)
-{
- if (current_language->la_language == language_objc)
- return value_of_local ("self", complain);
- else
- return value_of_local ("this", complain);
+ this = read_var_value (sym, selected_frame);
+ if (this == 0 && complain)
+ error ("`this' argument at unknown address");
+ return this;
}
/* Create a slice (sub-string, sub-array) of ARRAY, that is LENGTH elements
extern void clear_internalvars (void);
-/* Objective-C */
-
-extern struct value *value_of_local (const char *name, int complain);
-
-extern struct value *value_nsstring (char *ptr, int len);
-
/* From values.c */
extern struct value *value_copy (struct value *);
extern struct value *call_function_by_hand (struct value *, int,
struct value **);
-extern struct value *call_function_by_hand_expecting_type (struct value *,
- struct type *, int,
- struct value **, int);
-
extern int default_coerce_float_to_double (struct type *, struct type *);
extern int standard_coerce_float_to_double (struct type *, struct type *);
CORE_ADDR sp, int struct_return,
CORE_ADDR struct_addr);
-extern CORE_ADDR find_function_addr (struct value *, struct type **);
-
#endif /* !defined (VALUE_H) */