aboutsummaryrefslogtreecommitdiff
path: root/gdb/eval.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2009-09-29 00:48:32 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2009-09-29 00:48:32 +0000
commit69368a60a4878ec4ef1060732020e9eaf19b32b0 (patch)
treee42355f5c9bd92ed24f12457f1b50f24f1b216f8 /gdb/eval.c
parent67f470de12c95c08410c46543072c22f857a0a3b (diff)
downloadgdb-69368a60a4878ec4ef1060732020e9eaf19b32b0.zip
gdb-69368a60a4878ec4ef1060732020e9eaf19b32b0.tar.gz
gdb-69368a60a4878ec4ef1060732020e9eaf19b32b0.tar.bz2
* eval.c (evaluate_subexp_standard) [OP_OBJC_MSGCALL]: Support
platforms that use function descriptors. Prefer to use function pointer types instead of function types. * linespec.c (decode_objc): Support function descriptors. Fully initialize SAL result. * objc-lang.c (find_methods): Support function descriptors. Do not require function symbol to point to text section. * ppc-sysv-tdep.c (ppc64_sysv_abi_push_dummy_call): When calling via a function pointer, use the descriptor it points to.
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index 2926465..a1d6e12 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1161,8 +1161,13 @@ evaluate_subexp_standard (struct type *expect_type,
if (addr)
{
struct symbol *sym = NULL;
- /* Is it a high_level symbol? */
+ /* The address might point to a function descriptor;
+ resolve it to the actual code address instead. */
+ addr = gdbarch_convert_from_func_ptr_addr (exp->gdbarch, addr,
+ &current_target);
+
+ /* Is it a high_level symbol? */
sym = find_pc_function (addr);
if (sym != NULL)
method = value_of_variable (sym, 0);
@@ -1216,11 +1221,20 @@ evaluate_subexp_standard (struct type *expect_type,
{
if (TYPE_CODE (value_type (method)) != TYPE_CODE_FUNC)
error (_("method address has symbol information with non-function type; skipping"));
+
+ /* Create a function pointer of the appropriate type, and replace
+ its value with the value of msg_send or msg_send_stret. We must
+ use a pointer here, as msg_send and msg_send_stret are of pointer
+ type, and the representation may be different on systems that use
+ function descriptors. */
if (struct_return)
- set_value_address (method, value_as_address (msg_send_stret));
+ called_method
+ = value_from_pointer (lookup_pointer_type (value_type (method)),
+ value_as_address (msg_send_stret));
else
- set_value_address (method, value_as_address (msg_send));
- called_method = method;
+ called_method
+ = value_from_pointer (lookup_pointer_type (value_type (method)),
+ value_as_address (msg_send));
}
else
{
@@ -1275,7 +1289,7 @@ evaluate_subexp_standard (struct type *expect_type,
{
/* Function objc_msg_lookup returns a pointer. */
deprecated_set_value_type (argvec[0],
- lookup_function_type (lookup_pointer_type (value_type (argvec[0]))));
+ lookup_pointer_type (lookup_function_type (value_type (argvec[0]))));
argvec[0] = call_function_by_hand (argvec[0], nargs + 2, argvec + 1);
}