aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog20
-rw-r--r--gdb/Makefile.in2
-rw-r--r--gdb/ada-lang.c1
-rw-r--r--gdb/c-lang.c3
-rw-r--r--gdb/f-lang.c1
-rw-r--r--gdb/infrun.c5
-rw-r--r--gdb/jv-lang.c1
-rw-r--r--gdb/language.c33
-rw-r--r--gdb/language.h10
-rw-r--r--gdb/m2-lang.c1
-rw-r--r--gdb/objc-lang.c30
-rw-r--r--gdb/p-lang.c1
-rw-r--r--gdb/scm-lang.c1
13 files changed, 106 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8bd3359..4589ece 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,4 +1,22 @@
-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
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index b194833..d7666e4 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1831,7 +1831,7 @@ infrun.o: infrun.c $(defs_h) $(gdb_string_h) $(symtab_h) $(frame_h) \
$(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) \
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index bf0e6df..bcb2805 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -8080,6 +8080,7 @@ const struct language_defn ada_language_defn = {
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 */
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 4b4af16..4890a2b 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -552,6 +552,7 @@ const struct language_defn c_language_defn =
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 */
@@ -604,6 +605,7 @@ const struct language_defn cplus_language_defn =
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 */
@@ -633,6 +635,7 @@ const struct language_defn asm_language_defn =
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 */
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 84e3d81..6d4e7f9 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -472,6 +472,7 @@ const struct language_defn f_language_defn =
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 */
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 03a8e57..6da3394 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -43,6 +43,7 @@
#include "regcache.h"
#include "value.h"
#include "observer.h"
+#include "language.h"
/* Prototypes for local functions */
@@ -2386,7 +2387,9 @@ process_event_stop_test:
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;
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index 903404d..f6bc2de 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -1054,6 +1054,7 @@ const struct language_defn java_language_defn =
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 */
diff --git a/gdb/language.c b/gdb/language.c
index 258152c..2b71d1f 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -100,6 +100,8 @@ static int unk_lang_val_print (struct type *, char *, int, CORE_ADDR,
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;
@@ -1337,6 +1339,29 @@ add_language (const struct language_defn *lang)
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
@@ -1398,6 +1423,11 @@ unk_lang_value_print (struct value *val, struct ui_file *stream, int format,
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
@@ -1425,6 +1455,7 @@ const struct language_defn unknown_language_defn =
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 */
@@ -1455,6 +1486,7 @@ const struct language_defn auto_language_defn =
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 */
@@ -1484,6 +1516,7 @@ const struct language_defn local_language_defn =
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 */
diff --git a/gdb/language.h b/gdb/language.h
index b786959..4b9f8ce 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -203,6 +203,12 @@ struct language_defn
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;
@@ -465,4 +471,8 @@ extern void add_language (const struct language_defn *);
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) */
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index 116d850..48c6931 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -426,6 +426,7 @@ const struct language_defn m2_language_defn =
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 */
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 255781e..911831e 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -593,6 +593,35 @@ objc_create_fundamental_type (struct objfile *objfile, int typeid)
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. */
@@ -670,6 +699,7 @@ const struct language_defn objc_language_defn = {
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 */
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index 88c8cc0..40019a4 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -461,6 +461,7 @@ const struct language_defn pascal_language_defn =
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 */
diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c
index 4bbcd8e..746e599 100644
--- a/gdb/scm-lang.c
+++ b/gdb/scm-lang.c
@@ -250,6 +250,7 @@ const struct language_defn scm_language_defn =
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 */