-2003-03-25 Andrew Cagney <cagney@redhat.com>
+2003-03-25 Adam Fedor <fedor@gnu.org>
+
+ * Makefile.in (infrun.o): Add $(language_h)
+ * infrun.c (handle_inferior_event): Use skip_language_trampoline
+ for language specific trampolines.
+ * language.h (struct language_defn): Add skip_trampoline.
+ (skip_language_trampoline): Declare.
+ * language.c (unk_lang_trampoline, skip_language_trampoline):
+ New functions.
+ (unknown_language_defn, auto_language_defn, local_language_defn):
+ Add ukn_lang_trampoline.
+ * ada-lang.c (ada_language_defn): Add NULL for language
+ specific skip_trampoline.
+ * c-lang.c, f-lang.c, jv-lang.c, m2-lang.c, p-lang.c,
+ scm-lang.c: Likewise.
+ * objc-lang.c (objc_skip_trampoline): New function.
+ (objc_language_defn): Add objc_skip_trampoline.
+
+I2003-03-25 Andrew Cagney <cagney@redhat.com>
* frame.c (get_prev_frame): Delay validating a frame's ID -
non-NULL, didn't go backwards - until an attempt to unwind it to
$(inferior_h) $(breakpoint_h) $(gdb_wait_h) $(gdbcore_h) $(gdbcmd_h) \
$(cli_script_h) $(target_h) $(gdbthread_h) $(annotate_h) \
$(symfile_h) $(top_h) $(inf_loop_h) $(regcache_h) $(value_h) \
- $(observer_h)
+ $(observer_h) $(language_h)
inftarg.o: inftarg.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
$(gdbcore_h) $(command_h) $(gdb_stat_h) $(gdb_wait_h) $(inflow_h)
infttrace.o: infttrace.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
ada_print_type, /* Print a type using appropriate syntax */
ada_val_print, /* Print a value using appropriate syntax */
ada_value_print, /* Print a top-level value */
+ NULL, /* Language specific skip_trampoline */
{"", "", "", ""}, /* Binary format info */
#if 0
{"8#%lo#", "8#", "o", "#"}, /* Octal format info */
c_print_type, /* Print a type using appropriate syntax */
c_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
+ NULL, /* Language specific skip_trampoline */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
c_print_type, /* Print a type using appropriate syntax */
c_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
+ NULL, /* Language specific skip_trampoline */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
c_print_type, /* Print a type using appropriate syntax */
c_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
+ NULL, /* Language specific skip_trampoline */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
f_print_type, /* Print a type using appropriate syntax */
f_val_print, /* Print a value using appropriate syntax */
c_value_print, /* FIXME */
+ NULL, /* Language specific skip_trampoline */
{"", "", "", ""}, /* Binary format info */
{"0%o", "0", "o", ""}, /* Octal format info */
{"%d", "", "d", ""}, /* Decimal format info */
#include "regcache.h"
#include "value.h"
#include "observer.h"
+#include "language.h"
/* Prototypes for local functions */
function. That's what tells us (a) whether we want to step
into it at all, and (b) what prologue we want to run to
the end of, if we do step into it. */
- real_stop_pc = SKIP_TRAMPOLINE_CODE (stop_pc);
+ real_stop_pc = skip_language_trampoline (stop_pc);
+ if (real_stop_pc == 0)
+ real_stop_pc = SKIP_TRAMPOLINE_CODE (stop_pc);
if (real_stop_pc != 0)
ecs->stop_func_start = real_stop_pc;
java_print_type, /* Print a type using appropriate syntax */
java_val_print, /* Print a value using appropriate syntax */
java_value_print, /* Print a top-level value */
+ NULL, /* Language specific skip_trampoline */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
static int unk_lang_value_print (struct value *, struct ui_file *, int, enum val_prettyprint);
+static CORE_ADDR unk_lang_trampoline (CORE_ADDR pc);
+
/* Forward declaration */
extern const struct language_defn unknown_language_defn;
languages[languages_size++] = lang;
}
+/* Iterate through all registered languages looking for and calling
+ any non-NULL struct language_defn.skip_trampoline() functions.
+ Return the result from the first that returns non-zero, or 0 if all
+ `fail'. */
+CORE_ADDR
+skip_language_trampoline (CORE_ADDR pc)
+{
+ int i;
+
+ for (i = 0; i < languages_size; i++)
+ {
+ if (languages[i]->skip_trampoline)
+ {
+ CORE_ADDR real_pc = (languages[i]->skip_trampoline) (pc);
+ if (real_pc)
+ return real_pc;
+ }
+ }
+
+ return 0;
+}
+
+
/* Define the language that is no language. */
static int
error ("internal error - unimplemented function unk_lang_value_print called.");
}
+static CORE_ADDR unk_lang_trampoline (CORE_ADDR pc)
+{
+ return 0;
+}
+
static struct type **const (unknown_builtin_types[]) =
{
0
unk_lang_print_type, /* Print a type using appropriate syntax */
unk_lang_val_print, /* Print a value using appropriate syntax */
unk_lang_value_print, /* Print a top-level value */
+ unk_lang_trampoline, /* Language specific skip_trampoline */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
unk_lang_print_type, /* Print a type using appropriate syntax */
unk_lang_val_print, /* Print a value using appropriate syntax */
unk_lang_value_print, /* Print a top-level value */
+ unk_lang_trampoline, /* Language specific skip_trampoline */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
unk_lang_print_type, /* Print a type using appropriate syntax */
unk_lang_val_print, /* Print a value using appropriate syntax */
unk_lang_value_print, /* Print a top-level value */
+ unk_lang_trampoline, /* Language specific skip_trampoline */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
int (*la_value_print) (struct value *, struct ui_file *,
int, enum val_prettyprint);
+ /* PC is possibly an unknown languages trampoline.
+ If that PC falls in a trampoline belonging to this language,
+ return the address of the first pc in the real function, or 0
+ if it isn't a language tramp for this language. */
+ CORE_ADDR (*skip_trampoline) (CORE_ADDR pc);
+
/* Base 2 (binary) formats. */
struct language_format_info la_binary_format;
extern enum language get_frame_language (void); /* In stack.c */
+/* Check for a language-specific trampoline. */
+
+extern CORE_ADDR skip_language_trampoline (CORE_ADDR pc);
+
#endif /* defined (LANGUAGE_H) */
m2_print_type, /* Print a type using appropriate syntax */
m2_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
+ NULL, /* Language specific skip_trampoline */
{"", "", "", ""}, /* Binary format info */
{"%loB", "", "o", "B"}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
return (type);
}
+/* Determine if we are currently in the Objective-C dispatch function.
+ If so, get the address of the method function that the dispatcher
+ would call and use that as the function to step into instead. Also
+ skip over the trampoline for the function (if any). This is better
+ for the user since they are only interested in stepping into the
+ method function anyway. */
+static CORE_ADDR
+objc_skip_trampoline (CORE_ADDR stop_pc)
+{
+ CORE_ADDR real_stop_pc;
+ CORE_ADDR method_stop_pc;
+
+ real_stop_pc = SKIP_TRAMPOLINE_CODE (stop_pc);
+
+ if (real_stop_pc != 0)
+ find_objc_msgcall (real_stop_pc, &method_stop_pc);
+ else
+ find_objc_msgcall (stop_pc, &method_stop_pc);
+
+ if (method_stop_pc)
+ {
+ real_stop_pc = SKIP_TRAMPOLINE_CODE (method_stop_pc);
+ if (real_stop_pc == 0)
+ real_stop_pc = method_stop_pc;
+ }
+
+ return real_stop_pc;
+}
+
/* Table mapping opcodes into strings for printing operators
and precedences of the operators. */
c_print_type, /* Print a type using appropriate syntax */
c_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
+ objc_skip_trampoline, /* Language specific skip_trampoline */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
pascal_print_type, /* Print a type using appropriate syntax */
pascal_val_print, /* Print a value using appropriate syntax */
pascal_value_print, /* Print a top-level value */
+ NULL, /* Language specific skip_trampoline */
{"", "%", "b", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
c_print_type, /* Print a type using appropriate syntax */
scm_val_print, /* Print a value using appropriate syntax */
scm_value_print, /* Print a top-level value */
+ NULL, /* Language specific skip_trampoline */
{"", "", "", ""}, /* Binary format info */
{"#o%lo", "#o", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */