[ARC] Fix typo in extension instruction name.
[deliverable/binutils-gdb.git] / gdb / solib-dsbt.c
index 3585251e02622c54d6aa822d3d37756ade90918b..b11eae7669a216bc8d522ec84fb073fec7878e0a 100644 (file)
@@ -1,5 +1,5 @@
 /* Handle TIC6X (DSBT) shared libraries for GDB, the GNU Debugger.
-   Copyright (C) 2010-2013 Free Software Foundation, Inc.
+   Copyright (C) 2010-2016 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -18,7 +18,6 @@
 
 
 #include "defs.h"
-#include "gdb_string.h"
 #include "inferior.h"
 #include "gdbcore.h"
 #include "solib.h"
@@ -29,7 +28,6 @@
 #include "command.h"
 #include "gdbcmd.h"
 #include "elf-bfd.h"
-#include "exceptions.h"
 #include "gdb_bfd.h"
 
 #define GOT_MODULE_OFFSET 4
@@ -154,8 +152,6 @@ struct dsbt_info
   /* Link map address for main module.  */
   CORE_ADDR main_lm_addr;
 
-  int enable_break2_done;
-
   CORE_ADDR interp_text_sect_low;
   CORE_ADDR interp_text_sect_high;
   CORE_ADDR interp_plt_sect_low;
@@ -168,10 +164,7 @@ static const struct program_space_data *solib_dsbt_pspace_data;
 static void
 dsbt_pspace_data_cleanup (struct program_space *pspace, void *arg)
 {
-  struct dsbt_info *info;
-
-  info = program_space_data (pspace, solib_dsbt_pspace_data);
-  xfree (info);
+  xfree (arg);
 }
 
 /* Get the current dsbt data.  If none is found yet, add it now.  This
@@ -182,14 +175,14 @@ get_dsbt_info (void)
 {
   struct dsbt_info *info;
 
-  info = program_space_data (current_program_space, solib_dsbt_pspace_data);
+  info = (struct dsbt_info *) program_space_data (current_program_space,
+                                                 solib_dsbt_pspace_data);
   if (info != NULL)
     return info;
 
-  info = XZALLOC (struct dsbt_info);
+  info = XCNEW (struct dsbt_info);
   set_program_space_data (current_program_space, solib_dsbt_pspace_data, info);
 
-  info->enable_break2_done = 0;
   info->lm_base_cache = 0;
   info->main_lm_addr = 0;
 
@@ -259,7 +252,7 @@ decode_loadmap (gdb_byte *buf)
      external loadsegs.  I.e, allocate the internal loadsegs.  */
   int_ldmbuf_size = (sizeof (struct int_elf32_dsbt_loadmap)
                     + (nsegs - 1) * sizeof (struct int_elf32_dsbt_loadseg));
-  int_ldmbuf = xmalloc (int_ldmbuf_size);
+  int_ldmbuf = (struct int_elf32_dsbt_loadmap *) xmalloc (int_ldmbuf_size);
 
   /* Place extracted information in internal structs.  */
   int_ldmbuf->version = version;
@@ -363,7 +356,7 @@ fetch_loadmap (CORE_ADDR ldmaddr)
   /* Allocate space for the complete (external) loadmap.  */
   ext_ldmbuf_size = sizeof (struct ext_elf32_dsbt_loadmap)
     + (nsegs - 1) * sizeof (struct ext_elf32_dsbt_loadseg);
-  ext_ldmbuf = xmalloc (ext_ldmbuf_size);
+  ext_ldmbuf = (struct ext_elf32_dsbt_loadmap *) xmalloc (ext_ldmbuf_size);
 
   /* Copy over the portion of the loadmap that's already been read.  */
   memcpy (ext_ldmbuf, &ext_ldmbuf_partial, sizeof ext_ldmbuf_partial);
@@ -382,7 +375,7 @@ fetch_loadmap (CORE_ADDR ldmaddr)
      external loadsegs.  I.e, allocate the internal loadsegs.  */
   int_ldmbuf_size = sizeof (struct int_elf32_dsbt_loadmap)
     + (nsegs - 1) * sizeof (struct int_elf32_dsbt_loadseg);
-  int_ldmbuf = xmalloc (int_ldmbuf_size);
+  int_ldmbuf = (struct int_elf32_dsbt_loadmap *) xmalloc (int_ldmbuf_size);
 
   /* Place extracted information in internal structs.  */
   int_ldmbuf->version = version;
@@ -460,7 +453,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
   /* Read in .dynamic from the BFD.  We will get the actual value
      from memory later.  */
   sect_size = bfd_section_size (abfd, sect);
-  buf = bufstart = alloca (sect_size);
+  buf = bufstart = (gdb_byte *) alloca (sect_size);
   if (!bfd_get_section_contents (abfd, sect,
                                 buf, 0, sect_size))
     return 0;
@@ -556,7 +549,7 @@ static CORE_ADDR
 lm_base (void)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
-  struct minimal_symbol *got_sym;
+  struct bound_minimal_symbol got_sym;
   CORE_ADDR addr;
   gdb_byte buf[TIC6X_PTR_SIZE];
   struct dsbt_info *info = get_dsbt_info ();
@@ -576,9 +569,9 @@ lm_base (void)
   got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL,
                                   symfile_objfile);
 
-  if (got_sym != 0)
+  if (got_sym.minsym != 0)
     {
-      addr = SYMBOL_VALUE_ADDRESS (got_sym);
+      addr = BMSYMBOL_VALUE_ADDRESS (got_sym);
       if (solib_dsbt_debug)
        fprintf_unfiltered (gdb_stdlog,
                            "lm_base: get addr %x by _GLOBAL_OFFSET_TABLE_.\n",
@@ -717,8 +710,8 @@ dsbt_current_sos (void)
              break;
            }
 
-         sop = xcalloc (1, sizeof (struct so_list));
-         sop->lm_info = xcalloc (1, sizeof (struct lm_info));
+         sop = XCNEW (struct so_list);
+         sop->lm_info = XCNEW (struct lm_info);
          sop->lm_info->map = loadmap;
          /* Fetch the name.  */
          addr = extract_unsigned_integer (lm_buf.l_name,
@@ -767,7 +760,7 @@ dsbt_in_dynsym_resolve_code (CORE_ADDR pc)
 
   return ((pc >= info->interp_text_sect_low && pc < info->interp_text_sect_high)
          || (pc >= info->interp_plt_sect_low && pc < info->interp_plt_sect_high)
-         || in_plt_section (pc, NULL));
+         || in_plt_section (pc));
 }
 
 /* Print a warning about being unable to set the dynamic linker
@@ -784,7 +777,7 @@ enable_break_failure_warning (void)
 /* Helper function for gdb_bfd_lookup_symbol.  */
 
 static int
-cmp_name (asymbol *sym, void *data)
+cmp_name (const asymbol *sym, const void *data)
 {
   return (strcmp (sym->name, (const char *) data) == 0);
 }
@@ -812,9 +805,6 @@ enable_break (void)
 
   info = get_dsbt_info ();
 
-  if (info->enable_break2_done)
-    return 1;
-
   info->interp_text_sect_low = 0;
   info->interp_text_sect_high = 0;
   info->interp_plt_sect_low = 0;
@@ -831,13 +821,12 @@ enable_break (void)
       CORE_ADDR addr;
       gdb_byte addr_buf[TIC6X_PTR_SIZE];
       struct int_elf32_dsbt_loadmap *ldm;
-      volatile struct gdb_exception ex;
       int ret;
 
       /* Read the contents of the .interp section into a local buffer;
         the contents specify the dynamic linker this program uses.  */
       interp_sect_size = bfd_section_size (exec_bfd, interp_sect);
-      buf = alloca (interp_sect_size);
+      buf = (char *) alloca (interp_sect_size);
       bfd_get_section_contents (exec_bfd, interp_sect,
                                buf, 0, interp_sect_size);
 
@@ -845,10 +834,15 @@ enable_break (void)
         loaded so that we can load its symbols and place a breakpoint
         in the dynamic linker itself.  */
 
-      TRY_CATCH (ex, RETURN_MASK_ALL)
+      TRY
        {
          tmp_bfd = solib_bfd_open (buf);
        }
+      CATCH (ex, RETURN_MASK_ALL)
+       {
+       }
+      END_CATCH
+
       if (tmp_bfd == NULL)
        {
          enable_break_failure_warning ();
@@ -899,7 +893,6 @@ enable_break (void)
          /* Now (finally!) create the solib breakpoint.  */
          create_solib_event_breakpoint (target_gdbarch (), addr);
 
-         info->enable_break2_done = 1;
          ret = 1;
        }
       else
@@ -949,11 +942,11 @@ dsbt_relocate_main_executable (void)
   ldm = info->exec_loadmap;
 
   xfree (info->main_executable_lm_info);
-  info->main_executable_lm_info = xcalloc (1, sizeof (struct lm_info));
+  info->main_executable_lm_info = XCNEW (struct lm_info);
   info->main_executable_lm_info->map = ldm;
 
-  new_offsets = xcalloc (symfile_objfile->num_sections,
-                        sizeof (struct section_offsets));
+  new_offsets = XCNEWVEC (struct section_offsets,
+                         symfile_objfile->num_sections);
   old_chain = make_cleanup (xfree, new_offsets);
   changed = 0;
 
@@ -1023,7 +1016,6 @@ dsbt_clear_solib (void)
   struct dsbt_info *info = get_dsbt_info ();
 
   info->lm_base_cache = 0;
-  info->enable_break2_done = 0;
   info->main_lm_addr = 0;
   if (info->main_executable_lm_info != 0)
     {
This page took 0.027068 seconds and 4 git commands to generate.