* p-exp.y: Add block to OP_FUNCALL.
* objc-exp.y: Add block to OP_FUNCALL.
* m2-exp.y: Add block to OP_FUNCALL.
* c-exp.y: Add block to OP_FUNCALL.
* ada-exp.y: Add block to OP_FUNCALL.
(write_object_renaming): Ditto.
* parse.c (length_of_subexp): Split off OP_FUNCALL.
(prefixify_subexp): Ditto.
* expprint.c (print_subexp): Change offset for OP_FUNCALL.
(dump_subexp): Ditto.
* eval.c (evaluate_subexp_standard): Change offset for
OP_FUNCALL.
* ada-lang.c (ada_resolve_subexp): Add comment on OP_FUNCALL.
(replace_operator_with_call): Add block to OP_FUNCALL.
(ada_evaluate_subexp): Change offset for OP_FUNCALL.
* expression.h (exp_opcode): Change comments before OP_FUNCALL and
OP_F77_UNDETERMINED_ARGLIST.
2003-01-14 David Carlton <carlton@math.stanford.edu>
* symtab.c (search_symbols): Add comment.
(lookup_symbol_aux_using): Function name should start line.
(lookup_symbol_aux_using_loop): Ditto.
(lookup_block_symbol): Add comment.
2003-01-13 David Carlton <carlton@math.stanford.edu>
* dwarf2read.c (read_structure_scope): Add comment.
(add_partial_structure): Ditto.
* symtab.c (lookup_transparent_type): Add comment.
+2003-01-20 David Carlton <carlton@math.stanford.edu>
+
+ * p-exp.y: Add block to OP_FUNCALL.
+ * objc-exp.y: Add block to OP_FUNCALL.
+ * m2-exp.y: Add block to OP_FUNCALL.
+ * c-exp.y: Add block to OP_FUNCALL.
+ * ada-exp.y: Add block to OP_FUNCALL.
+ (write_object_renaming): Ditto.
+ * parse.c (length_of_subexp): Split off OP_FUNCALL.
+ (prefixify_subexp): Ditto.
+ * expprint.c (print_subexp): Change offset for OP_FUNCALL.
+ (dump_subexp): Ditto.
+ * eval.c (evaluate_subexp_standard): Change offset for
+ OP_FUNCALL.
+ * ada-lang.c (ada_resolve_subexp): Add comment on OP_FUNCALL.
+ (replace_operator_with_call): Add block to OP_FUNCALL.
+ (ada_evaluate_subexp): Change offset for OP_FUNCALL.
+ * expression.h (exp_opcode): Change comments before OP_FUNCALL and
+ OP_F77_UNDETERMINED_ARGLIST.
+
+2003-01-14 David Carlton <carlton@math.stanford.edu>
+
+ * symtab.c (search_symbols): Add comment.
+ (lookup_symbol_aux_using): Function name should start line.
+ (lookup_symbol_aux_using_loop): Ditto.
+ (lookup_block_symbol): Add comment.
+
+2003-01-13 David Carlton <carlton@math.stanford.edu>
+
+ * dwarf2read.c (read_structure_scope): Add comment.
+ (add_partial_structure): Ditto.
+ * symtab.c (lookup_transparent_type): Add comment.
+
2003-01-10 David Carlton <carlton@math.stanford.edu>
* objfiles.c (allocate_objfile): Always set name.
{
write_exp_elt_opcode (OP_FUNCALL);
write_exp_elt_longcst ($3);
+ write_exp_elt_block (expression_context_block);
write_exp_elt_opcode (OP_FUNCALL);
}
;
{
write_exp_elt_opcode (OP_FUNCALL);
write_exp_elt_longcst ((LONGEST) 1);
+ write_exp_elt_block (expression_context_block);
write_exp_elt_opcode (OP_FUNCALL);
}
else if (slice_state == LOWER_BOUND)
break;
case OP_FUNCALL:
+ /* FIXME: carlton/2002-01-20: I don't understand this well
+ enough to know if it should be changed after I added the
+ current block to an OP_FUNCALL. */
nargs = longest_to_int (exp->elts[pc + 1].longconst) + 1;
/* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */
/* if (exp->elts[pc+3].opcode == OP_UNRESOLVED_VALUE)
newexp->elts[pc].opcode = newexp->elts[pc + 2].opcode = OP_FUNCALL;
newexp->elts[pc + 1].longconst = (LONGEST) nargs;
+ newexp->elts[pc + 2].block = block;
- newexp->elts[pc + 3].opcode = newexp->elts[pc + 6].opcode = OP_VAR_VALUE;
- newexp->elts[pc + 4].block = block;
- newexp->elts[pc + 5].symbol = sym;
+ newexp->elts[pc + 4].opcode = newexp->elts[pc + 6].opcode = OP_VAR_VALUE;
+ newexp->elts[pc + 5].block = block;
+ newexp->elts[pc + 6].symbol = sym;
*expp = newexp;
xfree (exp);
return value_array (tem2, tem3, argvec);
case OP_FUNCALL:
- (*pos) += 2;
+ (*pos) += 3;
/* Allocate arg vector, including space for the function to be
called in argvec[0] and a terminating NULL */
arglist ')' %prec ARROW
{ write_exp_elt_opcode (OP_FUNCALL);
write_exp_elt_longcst ((LONGEST) end_arglist ());
+ write_exp_elt_block (expression_context_block);
write_exp_elt_opcode (OP_FUNCALL); }
;
can figure out if this structure lives in a namespace. Look
for a member function; its demangled name will contain
namespace info, if there is any. */
+
+ /* NOTE: carlton/2003-01-13: Getting the info this way changes
+ what template types look like, because the demangler
+ frequently doesn't give the same name as the debug info. We
+ could fix this by only using the demangled name to get the
+ prefix (but see comment in read_structure_scope). */
+
char *next_child = info_ptr;
while (1)
/* FIXME: carlton/2003-01-10: The excessive
demangling here is a bit wasteful, as is the
memory usage for names. */
+
+ /* NOTE: carlton/2003-01-13: As commented in
+ add_partial_structure, the demangler sometimes
+ prints the type info in a different form from the
+ debug info. We could solve this by using the
+ demangled name to get the prefix; if doing so,
+ however, we'd need to be careful when reading a
+ class that's nested inside a template class. */
char *actual_class_name
= class_name_from_physname (dwarf2_linkage_name
(child_die));
}
case OP_FUNCALL:
- (*pos) += 2;
+ (*pos) += 3;
op = exp->elts[*pos].opcode;
nargs = longest_to_int (exp->elts[pc + 1].longconst);
/* Allocate arg vector, including space for the function to be
return;
case OP_FUNCALL:
- (*pos) += 2;
+ (*pos) += 3;
nargs = longest_to_int (exp->elts[pc + 1].longconst);
print_subexp (exp, pos, stream, PREC_SUFFIX);
fputs_filtered (" (", stream);
nargs = longest_to_int (exp->elts[elt].longconst);
fprintf_filtered (stream, "Number of args: %d", nargs);
- elt += 2;
+ elt += 3;
for (i = 1; i <= nargs + 1; i++)
elt = dump_subexp (exp, stream, elt);
OP_INTERNALVAR,
/* OP_FUNCALL is followed by an integer in the next exp_element.
- The integer is the number of args to the function call.
- That many plus one values from following subexpressions
- are used, the first one being the function.
- The integer is followed by a repeat of OP_FUNCALL,
- making three exp_elements. */
+ The integer is the number of args to the function call. That
+ many plus one values from following subexpressions are used,
+ the first one being the function. Next comes the current
+ block: this is used when doing operator overloading in C++.
+ Finally, there is a repeat of OP_FUNCALL, making four
+ exp_elements. */
OP_FUNCALL,
/* OP_OBJC_MSGCALL is followed by a string in the next exp_element and then an
and function calls are all exactly the same syntactically. They may
only be dismabiguated at runtime. Thus this operator, which
indicates that we have found something of the form <name> ( <stuff> ) */
+
+ /* NOTE: carlton/2003-01-20: Now that I've added a block to
+ OP_FUNCALL, it's no longer exactly like OP_FUNCALL. */
OP_F77_UNDETERMINED_ARGLIST,
/* The following OP is a special one, it introduces a F77 complex
arglist ')' %prec DOT
{ write_exp_elt_opcode (OP_FUNCALL);
write_exp_elt_longcst ((LONGEST) end_arglist ());
+ write_exp_elt_block (expression_context_block);
write_exp_elt_opcode (OP_FUNCALL); }
;
arglist ')' %prec ARROW
{ write_exp_elt_opcode (OP_FUNCALL);
write_exp_elt_longcst ((LONGEST) end_arglist ());
+ write_exp_elt_block (expression_context_block);
write_exp_elt_opcode (OP_FUNCALL); }
;
arglist ')' %prec ARROW
{ write_exp_elt_opcode (OP_FUNCALL);
write_exp_elt_longcst ((LONGEST) end_arglist ());
+ write_exp_elt_block (expression_context_block);
write_exp_elt_opcode (OP_FUNCALL);
pop_current_type (); }
;
break;
case OP_FUNCALL:
+ oplen = 4;
+ args = 1 + longest_to_int (expr->elts[endpos - 3].longconst);
+ break;
+
case OP_F77_UNDETERMINED_ARGLIST:
oplen = 3;
args = 1 + longest_to_int (expr->elts[endpos - 2].longconst);
break;
case OP_FUNCALL:
+ oplen = 4;
+ args = 1 + longest_to_int (inexpr->elts[inend - 3].longconst);
+ break;
+
case OP_F77_UNDETERMINED_ARGLIST:
oplen = 3;
args = 1 + longest_to_int (inexpr->elts[inend - 2].longconst);
appropriate namespaces scope for BLOCK, and searches for NAME in
each of the namespaces that are in scope. */
-static struct symbol *lookup_symbol_aux_using (const char *name,
- const char *linkage_name,
- const struct block *block,
- const namespace_enum namespace,
- struct symtab **symtab)
+static struct symbol *
+lookup_symbol_aux_using (const char *name,
+ const char *linkage_name,
+ const struct block *block,
+ const namespace_enum namespace,
+ struct symtab **symtab)
{
const char *scope = block_scope (block);
scope, 0);
}
-static struct
-symbol *lookup_symbol_aux_using_loop (const char *name,
- const char *linkage_name,
- const struct block *block,
- namespace_enum namespace,
- struct symtab **symtab,
- const char *scope,
- int scope_len)
+static struct symbol *
+lookup_symbol_aux_using_loop (const char *name,
+ const char *linkage_name,
+ const struct block *block,
+ namespace_enum namespace,
+ struct symtab **symtab,
+ const char *scope,
+ int scope_len)
{
if (scope[scope_len] != '\0')
{
wrong one. Something to keep in mind when we have iterators,
though. */
+/* NOTE: carlton/2003-01-13: Callers for this should have the full
+ name of the type in question, so this doesn't have to get any
+ smarter about namespace stuff. */
+
struct type *
lookup_transparent_type (const char *name)
{
that strcmp and strcmp_iw don't match on it (which seems unlikely
to me). */
+/* NOTE: carlton/2003-01-14: No, there are situations where this is
+ more generous: it ignores whitespace on demangled names, too. This
+ is good: e.g. it makes recognizing templated types more generous.
+ See PR gdb/33. */
+
struct symbol *
lookup_block_symbol (register const struct block *block, const char *name,
const char *linkage_name, const namespace_enum namespace)
The results are sorted locally; each symtab's global and static blocks are
separately alphabetized.
*/
+
+/* NOTE: carlton/2003-01-14: I don't think this needs any namespace
+ tweaking. */
+
void
search_symbols (char *regexp, namespace_enum kind, int nfiles, char *files[],
struct symbol_search **matches)