aboutsummaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 6a6cd34..269ec4b 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -708,8 +708,10 @@ x_command (exp, from_tty)
*exp = 0;
old_chain = make_cleanup (free_current_contents, &expr);
val = evaluate_expression (expr);
- if (last_format == 'i'
- && TYPE_CODE (VALUE_TYPE (val)) != TYPE_CODE_PTR
+ /* In rvalue contexts, such as this, functions are coerced into
+ pointers to functions. This makes "x/i main" work. */
+ if (/* last_format == 'i'
+ && */ TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_FUNC
&& VALUE_LVAL (val) == lval_memory)
next_address = VALUE_ADDRESS (val);
else