]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* Makefile.in (infrun.o): Add $(language_h)
authorAdam Fedor <fedor@gnu.org>
Wed, 26 Mar 2003 03:39:44 +0000 (03:39 +0000)
committerAdam Fedor <fedor@gnu.org>
Wed, 26 Mar 2003 03:39:44 +0000 (03:39 +0000)
* 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.

13 files changed:
gdb/ChangeLog
gdb/Makefile.in
gdb/ada-lang.c
gdb/c-lang.c
gdb/f-lang.c
gdb/infrun.c
gdb/jv-lang.c
gdb/language.c
gdb/language.h
gdb/m2-lang.c
gdb/objc-lang.c
gdb/p-lang.c
gdb/scm-lang.c

index 8bd33598e6562c7016b2a3677b9617e1b3ab4af9..4589ece8b3737a2912bb07647ece508b0b64139f 100644 (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
index b19483344664c31ef93d0c1c2752dff534ccbaa8..d7666e4821609130f9e2369c80c8dbb18f58ac74 100644 (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) \
index bf0e6dfb941650eb9404133f3423538e899e8c03..bcb280582dee2f4135474dc67a4f28cc788f8d60 100644 (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 */
index 4b4af164ec5968d54bac6ef8ef957e83fcac80c4..4890a2b933e68fa353f7f507f7f2379a865b67a6 100644 (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 */
index 84e3d817ea08435cd91cfad9d9bf7d2554624a7e..6d4e7f96233efae79ff90d3dc38aa2562aa2f847 100644 (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 */
index 03a8e5781ad5eff75f6fa126fc093f7f589b264e..6da33946ec150e11bf6e81a26878f6568db5e621 100644 (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;
 
index 903404d723b1e1f423b49d3c4d527bf699b26665..f6bc2deb9d863bfe613bcd4246b913e6a03602bf 100644 (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 */
index 258152cce130bc9acb708594d4c1cc97b35ba1f2..2b71d1f754e326735fa70a2ed200c3d8ae2813bf 100644 (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 */
index b786959cdce662a63e71d7f4f2ea7ecc2ed6279f..4b9f8cee46db820a163c55526ccedfea44e50d40 100644 (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) */
index 116d85009fd0abfea4a8f884799d981a4d903140..48c6931e29bcc3ee89b65a7685de9d3d9ba136e0 100644 (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 */
index 255781e783da73acd58cc80664dc7e9af8d848ff..911831e4ba84bee83b9686eb53058453143541b2 100644 (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 */
index 88c8cc09a907207c1de3a251f09d46892d552338..40019a47db9e5336d39057e1246c9734d2b5fe2d 100644 (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 */
index 4bbcd8e597043d710ada80aa741957c247857643..746e59970cbae0e211966df87cb1184fcbc778a0 100644 (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 */