Merge branch 'master' into merge-job
authorJenkins as Icarus Sparry <icarus.sparry@amd.com>
Tue, 31 Dec 2019 02:58:15 +0000 (02:58 +0000)
committerJenkins as Icarus Sparry <icarus.sparry@amd.com>
Tue, 31 Dec 2019 02:58:15 +0000 (02:58 +0000)
12 files changed:
bfd/ChangeLog
bfd/archive.c
bfd/coffgen.c
bfd/version.h
bfd/vms-alpha.c
gdb/ChangeLog
gdb/tui/tui-hooks.c
gdb/tui/tui-interp.c
gdb/tui/tui-win.c
gdb/tui/tui-win.h
gdb/tui/tui.c
gdb/tui/tui.h

index a1e5273674e65bd931f03579053941a2822ca98b..02e3caba59cb56e52f1112d4310d815d9844f4f6 100644 (file)
@@ -1,3 +1,24 @@
+2019-12-30  Alan Modra  <amodra@gmail.com>
+
+       * vms-alpha.c (alpha_vms_free_private): New function, extracted..
+       (vms_close_and_cleanup): ..from here.
+       (alpha_vms_object_p): Call alpha_vms_free_private on failure.
+
+2019-12-30  Alan Modra  <amodra@gmail.com>
+
+       * coffgen.c (coff_real_object_p): Free malloc'd memory on failure.
+
+2019-12-30  Alan Modra  <amodra@gmail.com>
+
+       * archive.c (do_slurp_bsd_armap): Use bfd_alloc rather than
+       bfd_zalloc when memory is all written after the call.
+       (do_slurp_coff_armap): Likewise.  Set bfd_error on ridiculously
+       large allocations that overflow bfd_size_type.  Use just one
+       bfd_release on error exit.
+       (_bfd_slurp_extended_name_table): Use bfd_alloc for extended_names,
+       clear last byte rather than the entire array.  Use bfd_alloc for
+       string table.  Rearrange and simplify code copying file names.
+
 2019-12-29  Alan Modra  <amodra@gmail.com>
 
        * vms-alpha.c (_bfd_vms_slurp_egsd): Make base_addr a bfd_vma.
index 6b7a78ccd97de9a89f29a37f279fcd8f868e0c5c..578df092d4fb976bb609d0a783bf2f76df768664 100644 (file)
@@ -968,7 +968,7 @@ do_slurp_bsd_armap (bfd *abfd)
   if (parsed_size < 4)
     return FALSE;
 
-  raw_armap = (bfd_byte *) bfd_zalloc (abfd, parsed_size);
+  raw_armap = (bfd_byte *) bfd_alloc (abfd, parsed_size);
   if (raw_armap == NULL)
     return FALSE;
 
@@ -1059,16 +1059,22 @@ do_slurp_coff_armap (bfd *abfd)
      bsd-style one in core all at once, for simplicity.  */
 
   if (nsymz > ~ (bfd_size_type) 0 / sizeof (carsym))
-    return FALSE;
+    {
+      bfd_set_error (bfd_error_no_memory);
+      return FALSE;
+    }
 
   carsym_size = (nsymz * sizeof (carsym));
   ptrsize = (4 * nsymz);
 
   if (carsym_size + stringsize + 1 <= carsym_size)
-    return FALSE;
+    {
+      bfd_set_error (bfd_error_no_memory);
+      return FALSE;
+    }
 
-  ardata->symdefs = (struct carsym *) bfd_zalloc (abfd,
-                                                 carsym_size + stringsize + 1);
+  ardata->symdefs = (struct carsym *) bfd_alloc (abfd,
+                                                carsym_size + stringsize + 1);
   if (ardata->symdefs == NULL)
     return FALSE;
   carsyms = ardata->symdefs;
@@ -1083,7 +1089,7 @@ do_slurp_coff_armap (bfd *abfd)
     {
       if (bfd_get_error () != bfd_error_system_call)
        bfd_set_error (bfd_error_malformed_archive);
-      goto release_raw_armap;
+      goto release_symdefs;
     }
 
   /* OK, build the carsyms.  */
@@ -1128,8 +1134,6 @@ do_slurp_coff_armap (bfd *abfd)
 
   return TRUE;
 
-release_raw_armap:
-  bfd_release (abfd, raw_armap);
 release_symdefs:
   bfd_release (abfd, (ardata)->symdefs);
   return FALSE;
@@ -1238,7 +1242,7 @@ _bfd_slurp_extended_name_table (bfd *abfd)
        goto byebye;
 
       bfd_ardata (abfd)->extended_names_size = amt;
-      bfd_ardata (abfd)->extended_names = (char *) bfd_zalloc (abfd, amt + 1);
+      bfd_ardata (abfd)->extended_names = (char *) bfd_alloc (abfd, amt + 1);
       if (bfd_ardata (abfd)->extended_names == NULL)
        {
        byebye:
@@ -1256,6 +1260,7 @@ _bfd_slurp_extended_name_table (bfd *abfd)
          bfd_ardata (abfd)->extended_names = NULL;
          goto byebye;
        }
+      bfd_ardata (abfd)->extended_names[amt] = 0;
 
       /* Since the archive is supposed to be printable if it contains
         text, the entries in the list are newline-padded, not null
@@ -1607,7 +1612,7 @@ _bfd_construct_extended_name_table (bfd *abfd,
   if (total_namelen == 0)
     return TRUE;
 
-  *tabloc = (char *) bfd_zalloc (abfd, total_namelen);
+  *tabloc = (char *) bfd_alloc (abfd, total_namelen);
   if (*tabloc == NULL)
     return FALSE;
 
@@ -1664,16 +1669,14 @@ _bfd_construct_extended_name_table (bfd *abfd,
            stroff = last_stroff;
          else
            {
-             strcpy (strptr, normal);
-             if (! trailing_slash)
-               strptr[thislen] = ARFMAG[1];
-             else
-               {
-                 strptr[thislen] = '/';
-                 strptr[thislen + 1] = ARFMAG[1];
-               }
+             last_filename = filename;
              stroff = strptr - *tabloc;
              last_stroff = stroff;
+             memcpy (strptr, normal, thislen);
+             strptr += thislen;
+             if (trailing_slash)
+               *strptr++ = '/';
+             *strptr++ = ARFMAG[1];
            }
          hdr->ar_name[0] = ar_padchar (current);
          if (bfd_is_thin_archive (abfd) && current->origin > 0)
@@ -1686,13 +1689,6 @@ _bfd_construct_extended_name_table (bfd *abfd,
            }
          else
            _bfd_ar_spacepad (hdr->ar_name + 1, maxname - 1, "%-ld", stroff);
-         if (normal != last_filename)
-           {
-             strptr += thislen + 1;
-             if (trailing_slash)
-               ++strptr;
-             last_filename = filename;
-           }
        }
     }
 
index 57a18b02dc1dd10910a6a36db1d4a8ee63af0f8a..34d8d50506a51a7b6bd66b78ccc9bf144ecb9bfb 100644 (file)
@@ -305,6 +305,9 @@ coff_real_object_p (bfd *abfd,
   return abfd->xvec;
 
  fail:
+  obj_coff_keep_syms (abfd) = FALSE;
+  obj_coff_keep_strings (abfd) = FALSE;
+  _bfd_coff_free_symbols (abfd);
   bfd_release (abfd, tdata);
  fail2:
   abfd->tdata.any = tdata_save;
index 220be5bb9ff955b1890015491f0283fedfb38daa..3674fb5fe13af66aeff8f76f4afa96933ff1e204 100644 (file)
@@ -16,7 +16,7 @@
 
    In releases, the date is not included in either version strings or
    sonames.  */
-#define BFD_VERSION_DATE 20191230
+#define BFD_VERSION_DATE 20191231
 #define BFD_VERSION @bfd_version@
 #define BFD_VERSION_STRING  @bfd_version_package@ @bfd_version_string@
 #define REPORT_BUGS_TO @report_bugs_to@
index 6a087611b4be190ccc3ebb91eb0a0d8d07698011..e4928d7c974b8e16cf553160514f8ad097646375 100644 (file)
@@ -2634,6 +2634,22 @@ vms_initialize (bfd * abfd)
   return FALSE;
 }
 
+/* Free malloc'd memory.  */
+
+static void
+alpha_vms_free_private (bfd *abfd)
+{
+  struct module *module;
+
+  free (PRIV (recrd.buf));
+  free (PRIV (sections));
+  free (PRIV (syms));
+  free (PRIV (dst_ptr_offsets));
+
+  for (module = PRIV (modules); module; module = module->next)
+    free (module->file_table);
+}
+
 /* Check the format for a file being read.
    Return a (bfd_target *) if it's an object file or zero if not.  */
 
@@ -2648,7 +2664,10 @@ alpha_vms_object_p (bfd *abfd)
 
   /* Allocate alpha-vms specific data.  */
   if (!vms_initialize (abfd))
-    goto error_ret;
+    {
+      abfd->tdata.any = tdata_save;
+      return NULL;
+    }
 
   if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET))
     goto err_wrong_format;
@@ -2788,8 +2807,7 @@ alpha_vms_object_p (bfd *abfd)
   bfd_set_error (bfd_error_wrong_format);
 
  error_ret:
-  if (PRIV (recrd.buf))
-    free (PRIV (recrd.buf));
+  alpha_vms_free_private (abfd);
   if (abfd->tdata.any != tdata_save && abfd->tdata.any != NULL)
     bfd_release (abfd, abfd->tdata.any);
   abfd->tdata.any = tdata_save;
@@ -9339,15 +9357,7 @@ vms_close_and_cleanup (bfd * abfd)
 
   if (abfd->format == bfd_object)
     {
-      struct module *module;
-
-      free (PRIV (recrd.buf));
-      free (PRIV (sections));
-      free (PRIV (syms));
-      free (PRIV (dst_ptr_offsets));
-
-      for (module = PRIV (modules); module; module = module->next)
-       free (module->file_table);
+      alpha_vms_free_private (abfd);
 
 #ifdef VMS
       if (abfd->direction == write_direction)
index 54565efd0a582d56828367dfd15bd97e73a35db0..3a67dd0f7de66ca3009aa3667c24152d62982c3a 100644 (file)
@@ -1,3 +1,25 @@
+2019-12-30  Tom Tromey  <tom@tromey.com>
+
+       * tui/tui-win.c (tui_border_mode_translate)
+       (tui_border_kind_translate_vline, tui_border_kind_translate_hline)
+       (tui_border_kind_translate_ulcorner)
+       (tui_border_kind_translate_urcorner)
+       (tui_border_kind_translate_llcorner)
+       (tui_border_kind_translate_lrcorner, tui_active_border_mode)
+       (tui_border_mode, tui_border_kind): Now static.
+
+2019-12-30  Tom Tromey  <tom@tromey.com>
+
+       * tui/tui-interp.c (tui_start_enabled): Now bool.
+       (_initialize_tui_interp): Update.
+       * tui/tui-hooks.c (tui_refreshing_registers): Now bool.
+       (tui_register_changed)
+       (tui_refresh_frame_and_register_information): Update.
+       * tui/tui-win.c (tui_update_variables): Return bool.
+       * tui/tui-win.h (tui_update_variables): Return bool.
+       * tui/tui.c (tui_get_command_dimension): Return bool.
+       * tui/tui.h (tui_get_command_dimension): Return bool.
+
 2019-12-29  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        * buildsym.c (buildsym_compunit::record_line): Do no longer ignore
index 8576bb8fccde5f309588ce24d6e5df16f9c02587..b92abb9e031cba99643e971c072ceb5184b6665a 100644 (file)
@@ -57,7 +57,7 @@ tui_new_objfile_hook (struct objfile* objfile)
 }
 
 /* Prevent recursion of deprecated_register_changed_hook().  */
-static int tui_refreshing_registers = 0;
+static bool tui_refreshing_registers = false;
 
 /* Observer for the register_changed notification.  */
 
@@ -75,11 +75,11 @@ tui_register_changed (struct frame_info *frame, int regno)
      up in the other.  So we always use the selected frame here, and ignore
      FRAME.  */
   fi = get_selected_frame (NULL);
-  if (tui_refreshing_registers == 0)
+  if (!tui_refreshing_registers)
     {
-      tui_refreshing_registers = 1;
+      tui_refreshing_registers = true;
       TUI_DATA_WIN->check_register_values (fi);
-      tui_refreshing_registers = 0;
+      tui_refreshing_registers = false;
     }
 }
 
@@ -139,9 +139,9 @@ tui_refresh_frame_and_register_information ()
       if (tui_is_window_visible (DATA_WIN)
          && (frame_info_changed_p || from_stack))
        {
-         tui_refreshing_registers = 1;
+         tui_refreshing_registers = true;
          TUI_DATA_WIN->check_register_values (fi);
-         tui_refreshing_registers = 0;
+         tui_refreshing_registers = false;
        }
     }
   else if (!from_stack)
index bc8fde363bf80144ed21604179455b4d6262c9e8..01edbd0e48aeb3e7c30eb6a56925bf204a7d2c59 100644 (file)
@@ -35,9 +35,9 @@
 #include "inferior.h"
 #include "main.h"
 
-/* Set to 1 when the TUI mode must be activated when we first start
+/* Set to true when the TUI mode must be activated when we first start
    gdb.  */
-static int tui_start_enabled = 0;
+static bool tui_start_enabled = false;
 
 class tui_interp final : public cli_interp_base
 {
@@ -312,7 +312,7 @@ _initialize_tui_interp (void)
   interp_factory_register (INTERP_TUI, tui_interp_factory);
 
   if (interpreter_p && strcmp (interpreter_p, INTERP_TUI) == 0)
-    tui_start_enabled = 1;
+    tui_start_enabled = true;
 
   if (interpreter_p && strcmp (interpreter_p, INTERP_CONSOLE) == 0)
     {
index ac3690a7f456e90e15f5ca32872e0ad07a34e086..48df5354bf988865d21a227f97893ac851f08639 100644 (file)
@@ -119,7 +119,7 @@ struct tui_translate
 /* Translation table for border-mode variables.
    The list of values must be terminated by a NULL.
    After the NULL value, an entry defines the default.  */
-struct tui_translate tui_border_mode_translate[] = {
+static struct tui_translate tui_border_mode_translate[] = {
   { "normal",          A_NORMAL },
   { "standout",                A_STANDOUT },
   { "reverse",         A_REVERSE },
@@ -135,7 +135,7 @@ struct tui_translate tui_border_mode_translate[] = {
    character (see wborder, border curses operations).
    -1 is used to indicate the ACS because ACS characters
    are determined at run time by curses (depends on terminal).  */
-struct tui_translate tui_border_kind_translate_vline[] = {
+static struct tui_translate tui_border_kind_translate_vline[] = {
   { "space",    ' ' },
   { "ascii",    '|' },
   { "acs",      -1 },
@@ -143,7 +143,7 @@ struct tui_translate tui_border_kind_translate_vline[] = {
   { "ascii",    '|' }
 };
 
-struct tui_translate tui_border_kind_translate_hline[] = {
+static struct tui_translate tui_border_kind_translate_hline[] = {
   { "space",    ' ' },
   { "ascii",    '-' },
   { "acs",      -1 },
@@ -151,7 +151,7 @@ struct tui_translate tui_border_kind_translate_hline[] = {
   { "ascii",    '-' }
 };
 
-struct tui_translate tui_border_kind_translate_ulcorner[] = {
+static struct tui_translate tui_border_kind_translate_ulcorner[] = {
   { "space",    ' ' },
   { "ascii",    '+' },
   { "acs",      -1 },
@@ -159,7 +159,7 @@ struct tui_translate tui_border_kind_translate_ulcorner[] = {
   { "ascii",    '+' }
 };
 
-struct tui_translate tui_border_kind_translate_urcorner[] = {
+static struct tui_translate tui_border_kind_translate_urcorner[] = {
   { "space",    ' ' },
   { "ascii",    '+' },
   { "acs",      -1 },
@@ -167,7 +167,7 @@ struct tui_translate tui_border_kind_translate_urcorner[] = {
   { "ascii",    '+' }
 };
 
-struct tui_translate tui_border_kind_translate_llcorner[] = {
+static struct tui_translate tui_border_kind_translate_llcorner[] = {
   { "space",    ' ' },
   { "ascii",    '+' },
   { "acs",      -1 },
@@ -175,7 +175,7 @@ struct tui_translate tui_border_kind_translate_llcorner[] = {
   { "ascii",    '+' }
 };
 
-struct tui_translate tui_border_kind_translate_lrcorner[] = {
+static struct tui_translate tui_border_kind_translate_lrcorner[] = {
   { "space",    ' ' },
   { "ascii",    '+' },
   { "acs",      -1 },
@@ -185,7 +185,7 @@ struct tui_translate tui_border_kind_translate_lrcorner[] = {
 
 
 /* Tui configuration variables controlled with set/show command.  */
-const char *tui_active_border_mode = "bold-standout";
+static const char *tui_active_border_mode = "bold-standout";
 static void
 show_tui_active_border_mode (struct ui_file *file,
                             int from_tty,
@@ -197,7 +197,7 @@ The attribute mode to use for the active TUI window border is \"%s\".\n"),
                    value);
 }
 
-const char *tui_border_mode = "normal";
+static const char *tui_border_mode = "normal";
 static void
 show_tui_border_mode (struct ui_file *file, 
                      int from_tty,
@@ -209,7 +209,7 @@ The attribute mode to use for the TUI window borders is \"%s\".\n"),
                    value);
 }
 
-const char *tui_border_kind = "acs";
+static const char *tui_border_kind = "acs";
 static void
 show_tui_border_kind (struct ui_file *file, 
                      int from_tty,
@@ -254,23 +254,23 @@ translate (const char *name, struct tui_translate *table)
 /* Update the tui internal configuration according to gdb settings.
    Returns 1 if the configuration has changed and the screen should
    be redrawn.  */
-int
-tui_update_variables (void)
+bool
+tui_update_variables ()
 {
-  int need_redraw = 0;
+  bool need_redraw = false;
   struct tui_translate *entry;
 
   entry = translate (tui_border_mode, tui_border_mode_translate);
   if (tui_border_attrs != entry->value)
     {
       tui_border_attrs = entry->value;
-      need_redraw = 1;
+      need_redraw = true;
     }
   entry = translate (tui_active_border_mode, tui_border_mode_translate);
   if (tui_active_border_attrs != entry->value)
     {
       tui_active_border_attrs = entry->value;
-      need_redraw = 1;
+      need_redraw = true;
     }
 
   /* If one corner changes, all characters are changed.
@@ -280,7 +280,7 @@ tui_update_variables (void)
   if (tui_border_lrcorner != (chtype) entry->value)
     {
       tui_border_lrcorner = (entry->value < 0) ? ACS_LRCORNER : entry->value;
-      need_redraw = 1;
+      need_redraw = true;
     }
   entry = translate (tui_border_kind, tui_border_kind_translate_llcorner);
   tui_border_llcorner = (entry->value < 0) ? ACS_LLCORNER : entry->value;
index 1ffe683107a47f58fba45a670469f8503c7b2074..789a3e8324074bc6397fb3aec3c70b0a4882abb7 100644 (file)
@@ -44,7 +44,7 @@ extern chtype tui_border_hline;
 extern int tui_border_attrs;
 extern int tui_active_border_attrs;
 
-extern int tui_update_variables (void);
+extern bool tui_update_variables ();
 
 extern void tui_initialize_win (void);
 
index 6fdfa4579f1fe4706468ed9b7b5b6a9fbfde6613..f73ef7d58bf7c6356953abb8505612bc71ebd3ee 100644 (file)
@@ -591,18 +591,16 @@ tui_is_window_visible (enum tui_win_type type)
   return tui_win_list[type]->is_visible ();
 }
 
-int
+bool
 tui_get_command_dimension (unsigned int *width, 
                           unsigned int *height)
 {
   if (!tui_active || (TUI_CMD_WIN == NULL))
-    {
-      return 0;
-    }
+    return false;
   
   *width = TUI_CMD_WIN->width;
   *height = TUI_CMD_WIN->height;
-  return 1;
+  return true;
 }
 
 void
index 14f2939fd24657f22a67853ee3f3967024b53286..75574e527c9b60fe271569b6a4daf0896ac32a9c 100644 (file)
@@ -49,8 +49,8 @@ extern CORE_ADDR tui_get_low_disassembly_address (struct gdbarch *,
                                                  CORE_ADDR, CORE_ADDR);
 extern void tui_show_assembly (struct gdbarch *gdbarch, CORE_ADDR addr);
 extern bool tui_is_window_visible (enum tui_win_type type);
-extern int tui_get_command_dimension (unsigned int *width,
-                                     unsigned int *height);
+extern bool tui_get_command_dimension (unsigned int *width,
+                                      unsigned int *height);
 
 /* Initialize readline and configure the keymap for the switching
    key shortcut.  */
This page took 0.046334 seconds and 4 git commands to generate.