+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.
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;
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;
{
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. */
return TRUE;
-release_raw_armap:
- bfd_release (abfd, raw_armap);
release_symdefs:
bfd_release (abfd, (ardata)->symdefs);
return FALSE;
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:
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
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;
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)
}
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;
- }
}
}
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;
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@
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. */
/* 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;
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;
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)
+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
}
/* 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. */
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;
}
}
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)
#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
{
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)
{
/* 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 },
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 },
{ "ascii", '|' }
};
-struct tui_translate tui_border_kind_translate_hline[] = {
+static struct tui_translate tui_border_kind_translate_hline[] = {
{ "space", ' ' },
{ "ascii", '-' },
{ "acs", -1 },
{ "ascii", '-' }
};
-struct tui_translate tui_border_kind_translate_ulcorner[] = {
+static struct tui_translate tui_border_kind_translate_ulcorner[] = {
{ "space", ' ' },
{ "ascii", '+' },
{ "acs", -1 },
{ "ascii", '+' }
};
-struct tui_translate tui_border_kind_translate_urcorner[] = {
+static struct tui_translate tui_border_kind_translate_urcorner[] = {
{ "space", ' ' },
{ "ascii", '+' },
{ "acs", -1 },
{ "ascii", '+' }
};
-struct tui_translate tui_border_kind_translate_llcorner[] = {
+static struct tui_translate tui_border_kind_translate_llcorner[] = {
{ "space", ' ' },
{ "ascii", '+' },
{ "acs", -1 },
{ "ascii", '+' }
};
-struct tui_translate tui_border_kind_translate_lrcorner[] = {
+static struct tui_translate tui_border_kind_translate_lrcorner[] = {
{ "space", ' ' },
{ "ascii", '+' },
{ "acs", -1 },
/* 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,
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,
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,
/* 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.
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;
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);
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
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. */