* 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.
This commit is contained in:
Adam Fedor 2003-03-26 03:39:44 +00:00
parent 05e6bb2fc9
commit f636b87d5a
13 changed files with 106 additions and 3 deletions

View File

@ -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

View File

@ -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) \

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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;

View File

@ -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 */

View File

@ -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 */

View File

@ -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) */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */