summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlton <carlton@bactrian.org>2003-01-21 01:02:30 +0000
committerDavid Carlton <carlton@bactrian.org>2003-01-21 01:02:30 +0000
commit203b9ff9d579c22e04b41308485c8c4996dd4b79 (patch)
tree740bc9eb99c6ae92ef818e827a68a51520b33f98
parentc2bd69884bd873d5662482ab0b42b70d27b98e08 (diff)
downloadgdb-203b9ff9d579c22e04b41308485c8c4996dd4b79.tar.gz
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.
-rw-r--r--gdb/ChangeLog33
-rw-r--r--gdb/ada-exp.y2
-rw-r--r--gdb/ada-lang.c12
-rw-r--r--gdb/c-exp.y1
-rw-r--r--gdb/dwarf2read.c15
-rw-r--r--gdb/eval.c2
-rw-r--r--gdb/expprint.c4
-rw-r--r--gdb/expression.h14
-rw-r--r--gdb/m2-exp.y1
-rw-r--r--gdb/objc-exp.y1
-rw-r--r--gdb/p-exp.y1
-rw-r--r--gdb/parse.c8
-rw-r--r--gdb/symtab.c40
13 files changed, 109 insertions, 25 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f932e7c90ff..cc4bc224271 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,36 @@
+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.
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index aece48a7316..45d09a99a91 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -233,6 +233,7 @@ simple_exp : simple_exp '(' arglist ')'
{
write_exp_elt_opcode (OP_FUNCALL);
write_exp_elt_longcst ($3);
+ write_exp_elt_block (expression_context_block);
write_exp_elt_opcode (OP_FUNCALL);
}
;
@@ -902,6 +903,7 @@ write_object_renaming (orig_left_context, renaming)
{
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)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 23c88271486..1af40286e02 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -1973,6 +1973,9 @@ ada_resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
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)
@@ -2787,10 +2790,11 @@ replace_operator_with_call (struct expression **expp, int pc, int nargs,
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);
@@ -6992,7 +6996,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *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 */
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index f2094b5ba9b..1faea77e8e6 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -333,6 +333,7 @@ exp : exp '('
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); }
;
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index fd7483a9a4e..1952ad47498 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1625,6 +1625,13 @@ add_partial_structure (struct partial_die_info *struct_pdi, char *info_ptr,
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)
@@ -2811,6 +2818,14 @@ read_structure_scope (struct die_info *die, struct objfile *objfile,
/* 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));
diff --git a/gdb/eval.c b/gdb/eval.c
index 67afcd165fb..d71967143a3 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -664,7 +664,7 @@ evaluate_subexp_standard (struct type *expect_type,
}
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
diff --git a/gdb/expprint.c b/gdb/expprint.c
index 31b82c007fa..63d6d3b35c7 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -144,7 +144,7 @@ print_subexp (register struct expression *exp, register int *pos,
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);
@@ -933,7 +933,7 @@ dump_subexp (struct expression *exp, struct ui_file *stream, int elt)
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);
diff --git a/gdb/expression.h b/gdb/expression.h
index 85329224d3b..f831337f634 100644
--- a/gdb/expression.h
+++ b/gdb/expression.h
@@ -174,11 +174,12 @@ enum exp_opcode
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
@@ -192,6 +193,9 @@ enum exp_opcode
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
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y
index 39fdebae27b..ad406edddf1 100644
--- a/gdb/m2-exp.y
+++ b/gdb/m2-exp.y
@@ -360,6 +360,7 @@ exp : exp '('
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); }
;
diff --git a/gdb/objc-exp.y b/gdb/objc-exp.y
index 42ee124ef2a..d9e75a35cb5 100644
--- a/gdb/objc-exp.y
+++ b/gdb/objc-exp.y
@@ -396,6 +396,7 @@ exp : exp '('
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); }
;
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index c52c0a54438..01877114bd6 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -331,6 +331,7 @@ exp : exp '('
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 (); }
;
diff --git a/gdb/parse.c b/gdb/parse.c
index cb598339799..1b69344121b 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -825,6 +825,10 @@ length_of_subexp (register struct expression *expr, register int endpos)
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);
@@ -970,6 +974,10 @@ prefixify_subexp (register struct expression *inexpr,
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);
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 33baa65b8a3..730e27085d1 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1183,11 +1183,12 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name,
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);
@@ -1196,14 +1197,14 @@ static struct symbol *lookup_symbol_aux_using (const char *name,
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')
{
@@ -1517,6 +1518,10 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name,
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)
{
@@ -1667,6 +1672,11 @@ find_main_psymtab (void)
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)
@@ -2780,6 +2790,10 @@ sort_search_symbols (struct symbol_search *prevtail, int nfound)
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)