2007-06-13 Claudio Fontana <claudio.fontana@gmail.com>
[deliverable/binutils-gdb.git] / gdb / objc-lang.c
index 9d52241255742a14cebb2b835ad01a0fe1fe507d..5ab4bb2433e51bcbc0832db8727c67bf31191a8b 100644 (file)
@@ -1,6 +1,6 @@
 /* Objective-C language support routines for GDB, the GNU debugger.
 
-   Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
 
    Contributed by Apple Computer, Inc.
    Written by Michael Snyder.
@@ -19,8 +19,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
 
 #include "defs.h"
 #include "symtab.h"
@@ -335,7 +335,7 @@ objc_printchar (int c, struct ui_file *stream)
    FORCE_ELLIPSES.  */
 
 static void
-objc_printstr (struct ui_file *stream, const bfd_byte *string, 
+objc_printstr (struct ui_file *stream, const gdb_byte *string, 
               unsigned int length, int width, int force_ellipses)
 {
   unsigned int i;
@@ -461,7 +461,7 @@ objc_create_fundamental_type (struct objfile *objfile, int typeid)
           the type reconstruction work, this should probably become
           an error.  */
        type = init_type (TYPE_CODE_INT,
-                         TARGET_INT_BIT / TARGET_CHAR_BIT,
+                         gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
                          0, "<?type?>", objfile);
         warning (_("internal error: no C/C++ fundamental type %d"), typeid);
        break;
@@ -487,77 +487,82 @@ objc_create_fundamental_type (struct objfile *objfile, int typeid)
        break;
       case FT_SHORT:
        type = init_type (TYPE_CODE_INT,
-                         TARGET_SHORT_BIT / TARGET_CHAR_BIT,
+                         gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
                          0, "short", objfile);
        break;
       case FT_SIGNED_SHORT:
        type = init_type (TYPE_CODE_INT,
-                         TARGET_SHORT_BIT / TARGET_CHAR_BIT,
+                         gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
                          0, "short", objfile); /* FIXME-fnf */
        break;
       case FT_UNSIGNED_SHORT:
        type = init_type (TYPE_CODE_INT,
-                         TARGET_SHORT_BIT / TARGET_CHAR_BIT,
+                         gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
                          TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
        break;
       case FT_INTEGER:
        type = init_type (TYPE_CODE_INT,
-                         TARGET_INT_BIT / TARGET_CHAR_BIT,
+                         gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
                          0, "int", objfile);
        break;
       case FT_SIGNED_INTEGER:
        type = init_type (TYPE_CODE_INT,
-                         TARGET_INT_BIT / TARGET_CHAR_BIT,
+                         gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
                          0, "int", objfile); /* FIXME -fnf */
        break;
       case FT_UNSIGNED_INTEGER:
        type = init_type (TYPE_CODE_INT,
-                         TARGET_INT_BIT / TARGET_CHAR_BIT,
+                         gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
                          TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
        break;
       case FT_LONG:
        type = init_type (TYPE_CODE_INT,
-                         TARGET_LONG_BIT / TARGET_CHAR_BIT,
+                         gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
                          0, "long", objfile);
        break;
       case FT_SIGNED_LONG:
        type = init_type (TYPE_CODE_INT,
-                         TARGET_LONG_BIT / TARGET_CHAR_BIT,
+                         gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
                          0, "long", objfile); /* FIXME -fnf */
        break;
       case FT_UNSIGNED_LONG:
        type = init_type (TYPE_CODE_INT,
-                         TARGET_LONG_BIT / TARGET_CHAR_BIT,
+                         gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
                          TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
        break;
       case FT_LONG_LONG:
        type = init_type (TYPE_CODE_INT,
-                         TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
+                         gdbarch_long_long_bit (current_gdbarch)
+                           / TARGET_CHAR_BIT,
                          0, "long long", objfile);
        break;
       case FT_SIGNED_LONG_LONG:
        type = init_type (TYPE_CODE_INT,
-                         TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
+                         gdbarch_long_long_bit (current_gdbarch)
+                           / TARGET_CHAR_BIT,
                          0, "signed long long", objfile);
        break;
       case FT_UNSIGNED_LONG_LONG:
        type = init_type (TYPE_CODE_INT,
-                         TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
+                         gdbarch_long_long_bit (current_gdbarch)
+                           / TARGET_CHAR_BIT,
                          TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
        break;
       case FT_FLOAT:
        type = init_type (TYPE_CODE_FLT,
-                         TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+                         gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
                          0, "float", objfile);
        break;
       case FT_DBL_PREC_FLOAT:
        type = init_type (TYPE_CODE_FLT,
-                         TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+                         gdbarch_double_bit (current_gdbarch)
+                           / TARGET_CHAR_BIT,
                          0, "double", objfile);
        break;
       case FT_EXT_PREC_FLOAT:
        type = init_type (TYPE_CODE_FLT,
-                         TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+                         gdbarch_long_double_bit (current_gdbarch)
+                           / TARGET_CHAR_BIT,
                          0, "long double", objfile);
        break;
       }
@@ -576,7 +581,7 @@ 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);
+  real_stop_pc = gdbarch_skip_trampoline_code (current_gdbarch, stop_pc);
 
   if (real_stop_pc != 0)
     find_objc_msgcall (real_stop_pc, &method_stop_pc);
@@ -585,7 +590,8 @@ objc_skip_trampoline (CORE_ADDR stop_pc)
 
   if (method_stop_pc)
     {
-      real_stop_pc = SKIP_TRAMPOLINE_CODE (method_stop_pc);
+      real_stop_pc = gdbarch_skip_trampoline_code
+                      (current_gdbarch, method_stop_pc);
       if (real_stop_pc == 0)
        real_stop_pc = method_stop_pc;
     }
@@ -684,6 +690,7 @@ const struct language_defn objc_language_defn = {
   &builtin_type_char,          /* Type of string elements */
   default_word_break_characters,
   NULL, /* FIXME: la_language_arch_info.  */
+  default_print_array_index,
   LANG_MAGIC
 };
 
@@ -1528,7 +1535,7 @@ print_object_command (char *args, int from_tty)
   struct value *object, *function, *description;
   CORE_ADDR string_addr, object_addr;
   int i = 0;
-  char c = -1;
+  gdb_byte c = 0;
 
   if (!args || !*args)
     error (
@@ -1560,7 +1567,7 @@ print_object_command (char *args, int from_tty)
     error (_("object returns null description"));
 
   read_memory (string_addr + i++, &c, 1);
-  if (c != '\0')
+  if (c != 0)
     do
       { /* Read and print characters up to EOS.  */
        QUIT;
@@ -1646,7 +1653,7 @@ find_objc_msgsend (void)
  * The old function "pc_off_limits" used to do a lot of other things
  * in addition, such as detecting shared library jump stubs and
  * returning the address of the shlib function that would be called.
- * That functionality has been moved into the SKIP_TRAMPOLINE_CODE and
+ * That functionality has been moved into the gdbarch_skip_trampoline_code and
  * IN_SOLIB_TRAMPOLINE macros, which are resolved in the target-
  * dependent modules.  
  */
@@ -1843,7 +1850,8 @@ find_implementation (CORE_ADDR object, CORE_ADDR sel)
 }
 
 #define OBJC_FETCH_POINTER_ARGUMENT(argi) \
-  FETCH_POINTER_ARGUMENT (get_current_frame (), argi, builtin_type_void_func_ptr)
+  gdbarch_fetch_pointer_argument (current_gdbarch, get_current_frame (), \
+                                 argi, builtin_type_void_func_ptr)
 
 static int
 resolve_msgsend (CORE_ADDR pc, CORE_ADDR *new_pc)
This page took 0.028366 seconds and 4 git commands to generate.