diff options
author | Tom de Vries <tdevries@suse.de> | 2024-07-24 16:32:35 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2024-07-24 16:32:35 +0200 |
commit | de272a5e905afb20ec0a2c192538acf9c9103974 (patch) | |
tree | c52a40f5e254ab44b13e08bf49809a35b556aa30 /gdb/eval.c | |
parent | 88141209e25ce19473ec07d7aac09cc68f06a630 (diff) | |
download | binutils-de272a5e905afb20ec0a2c192538acf9c9103974.zip binutils-de272a5e905afb20ec0a2c192538acf9c9103974.tar.gz binutils-de272a5e905afb20ec0a2c192538acf9c9103974.tar.bz2 |
[gdb/exp] Allow internal function to indicate return type
Currently an internal function handler has this prototype:
...
struct value *handler (struct gdbarch *gdbarch,
const struct language_defn *language,
void *cookie, int argc, struct value **argv);
...
Also allow an internal function with a handler with an additional
"enum noside noside" parameter:
...
struct value *handler (struct gdbarch *gdbarch,
const struct language_defn *language, void *cookie,
int argc, struct value **argv, enum noside noside);
...
In case such a handler is called with noside == EVAL_AVOID_SIDE_EFFECTS, it's
expected to return some value with the correct return type.
At least, provided it can do so without side effects, otherwise it should
throw an error.
No functional changes.
Tested on x86_64-linux and aarch64-linux.
Reviewed-By: Keith Seitz <keiths@redhat.com>
Diffstat (limited to 'gdb/eval.c')
-rw-r--r-- | gdb/eval.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -622,11 +622,7 @@ evaluate_subexp_do_call (expression *exp, enum noside noside, if (ftype->code () == TYPE_CODE_INTERNAL_FUNCTION) { - /* 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); + /* The call to call_internal_function below handles noside. */ } else if (ftype->code () == TYPE_CODE_XMETHOD) { @@ -666,7 +662,8 @@ evaluate_subexp_do_call (expression *exp, enum noside noside, { case TYPE_CODE_INTERNAL_FUNCTION: return call_internal_function (exp->gdbarch, exp->language_defn, - callee, argvec.size (), argvec.data ()); + callee, argvec.size (), argvec.data (), + noside); case TYPE_CODE_XMETHOD: return callee->call_xmethod (argvec); default: |