gdb
PR python/10680: * eval.c (evaluate_subexp_standard) <do_call_it>: Handle internal functions in EVAL_AVOID_SIDE_EFFECTS case. gdb/testsuite * gdb.python/py-function.exp: Add regression tests.
This commit is contained in:
parent
074d710de7
commit
329719ec1d
|
@ -1,3 +1,9 @@
|
||||||
|
2009-09-22 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
PR python/10680:
|
||||||
|
* eval.c (evaluate_subexp_standard) <do_call_it>: Handle internal
|
||||||
|
functions in EVAL_AVOID_SIDE_EFFECTS case.
|
||||||
|
|
||||||
2009-09-22 Jie Zhang <jie.zhang@analog.com>
|
2009-09-22 Jie Zhang <jie.zhang@analog.com>
|
||||||
|
|
||||||
* MAINTAINERS: Add myself under Write After Approval.
|
* MAINTAINERS: Add myself under Write After Approval.
|
||||||
|
|
15
gdb/eval.c
15
gdb/eval.c
|
@ -1513,11 +1513,18 @@ evaluate_subexp_standard (struct type *expect_type,
|
||||||
gdb isn't asked for it's opinion (ie. through "whatis"),
|
gdb isn't asked for it's opinion (ie. through "whatis"),
|
||||||
it won't offer it. */
|
it won't offer it. */
|
||||||
|
|
||||||
struct type *ftype =
|
struct type *ftype = value_type (argvec[0]);
|
||||||
TYPE_TARGET_TYPE (value_type (argvec[0]));
|
|
||||||
|
|
||||||
if (ftype)
|
if (TYPE_CODE (ftype) == TYPE_CODE_INTERNAL_FUNCTION)
|
||||||
return allocate_value (TYPE_TARGET_TYPE (value_type (argvec[0])));
|
{
|
||||||
|
/* We don't know anything about what the internal
|
||||||
|
function might return, but we have to return
|
||||||
|
something. */
|
||||||
|
return value_zero (builtin_type (exp->gdbarch)->builtin_int,
|
||||||
|
not_lval);
|
||||||
|
}
|
||||||
|
else if (TYPE_TARGET_TYPE (ftype))
|
||||||
|
return allocate_value (TYPE_TARGET_TYPE (ftype));
|
||||||
else
|
else
|
||||||
error (_("Expression of type other than \"Function returning ...\" used as function"));
|
error (_("Expression of type other than \"Function returning ...\" used as function"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2009-09-22 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* gdb.python/py-function.exp: Add regression tests.
|
||||||
|
|
||||||
2009-09-21 Keith Seitz <keiths@redhat.com>
|
2009-09-21 Keith Seitz <keiths@redhat.com>
|
||||||
|
|
||||||
* gdb.cp/cplusfuncs.exp (do_tests): Add check for proper error message
|
* gdb.cp/cplusfuncs.exp (do_tests): Add check for proper error message
|
||||||
|
|
|
@ -77,3 +77,16 @@ gdb_py_test_multiple "input value-returning convenience function" \
|
||||||
"end" ""
|
"end" ""
|
||||||
|
|
||||||
gdb_test "print \$double (1)" "= 2" "call value-returning function"
|
gdb_test "print \$double (1)" "= 2" "call value-returning function"
|
||||||
|
|
||||||
|
gdb_py_test_multiple "input int-returning function" \
|
||||||
|
"python" "" \
|
||||||
|
"class Yes(gdb.Function):" "" \
|
||||||
|
" def __init__(self):" "" \
|
||||||
|
" gdb.Function.__init__(self, 'yes')" "" \
|
||||||
|
" def invoke(self):" "" \
|
||||||
|
" return 1" "" \
|
||||||
|
"Yes ()" "" \
|
||||||
|
"end" ""
|
||||||
|
|
||||||
|
gdb_test "print \$yes() && \$yes()" " = 1" "call yes with &&"
|
||||||
|
gdb_test "print \$yes() || \$yes()" " = 1" "call yes with ||"
|
||||||
|
|
Loading…
Reference in New Issue