aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2014-05-19 10:51:08 -0700
committerDoug Evans <dje@google.com>2014-05-19 10:51:08 -0700
commitcd8ae15e25c46d8a96ff8b0f6878db0429f460b5 (patch)
tree142900330d2d6fa5b0ee62bb3bd63926f5295827 /gdb
parentf1f4348a6e51955887653eb0c115a7b98b43cb82 (diff)
downloadgdb-cd8ae15e25c46d8a96ff8b0f6878db0429f460b5.zip
gdb-cd8ae15e25c46d8a96ff8b0f6878db0429f460b5.tar.gz
gdb-cd8ae15e25c46d8a96ff8b0f6878db0429f460b5.tar.bz2
* eval.c (evaluate_subexp_standard): Add some comments.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/eval.c13
2 files changed, 14 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2311d77..4997751 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2014-05-19 Doug Evans <dje@google.com>
+
+ * eval.c (evaluate_subexp_standard): Add some comments.
+
2014-05-17 Doug Evans <xdje42@gmail.com>
* progspace.c (remove_program_space): Delete, unused.
diff --git a/gdb/eval.c b/gdb/eval.c
index 3e62ead..14bf6f7 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1363,7 +1363,7 @@ evaluate_subexp_standard (struct type *expect_type,
op = exp->elts[*pos].opcode;
nargs = longest_to_int (exp->elts[pc + 1].longconst);
/* Allocate arg vector, including space for the function to be
- called in argvec[0] and a terminating NULL. */
+ called in argvec[0], a potential `this', and a terminating NULL. */
argvec = (struct value **)
alloca (sizeof (struct value *) * (nargs + 3));
if (op == STRUCTOP_MEMBER || op == STRUCTOP_MPTR)
@@ -1514,6 +1514,7 @@ evaluate_subexp_standard (struct type *expect_type,
name, TYPE_TAG_NAME (type));
tem = 1;
+ /* arg2 is left as NULL on purpose. */
}
else
{
@@ -1521,6 +1522,8 @@ evaluate_subexp_standard (struct type *expect_type,
|| TYPE_CODE (type) == TYPE_CODE_UNION);
function_name = name;
+ /* We need a properly typed value for method lookup. For
+ static methods arg2 is otherwise unused. */
arg2 = value_zero (type, lval_memory);
++nargs;
tem = 2;
@@ -1570,7 +1573,8 @@ evaluate_subexp_standard (struct type *expect_type,
}
}
- /* Evaluate arguments. */
+ /* Evaluate arguments (if not already done, e.g., namespace::func()
+ and overload-resolution is off). */
for (; tem <= nargs; tem++)
{
/* Ensure that array expressions are coerced into pointer
@@ -1580,6 +1584,7 @@ evaluate_subexp_standard (struct type *expect_type,
/* Signal end of arglist. */
argvec[tem] = 0;
+
if (op == OP_ADL_FUNC)
{
struct symbol *symp;
@@ -1609,7 +1614,8 @@ evaluate_subexp_standard (struct type *expect_type,
int static_memfuncp;
char *tstr;
- /* Method invocation : stuff "this" as first parameter. */
+ /* Method invocation: stuff "this" as first parameter.
+ If the method turns out to be static we undo this below. */
argvec[1] = arg2;
if (op != OP_SCOPE)
@@ -1663,6 +1669,7 @@ evaluate_subexp_standard (struct type *expect_type,
argvec[1] = arg2; /* the ``this'' pointer */
}
+ /* Take out `this' if needed. */
if (static_memfuncp)
{
argvec[1] = argvec[0];