aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog14
-rw-r--r--gdb/c-lang.c10
-rw-r--r--gdb/c-typeprint.c11
-rw-r--r--gdb/c-valprint.c10
-rw-r--r--gdb/charset.c4
-rw-r--r--gdb/cli-out.c24
-rw-r--r--gdb/coffread.c13
-rw-r--r--gdb/complaints.c2
-rw-r--r--gdb/completer.c5
-rw-r--r--gdb/corefile.c17
-rw-r--r--gdb/corelow.c5
-rw-r--r--gdb/cp-abi.c3
-rw-r--r--gdb/cp-namespace.c4
-rw-r--r--gdb/cp-support.c6
-rw-r--r--gdb/cp-valprint.c9
15 files changed, 115 insertions, 22 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a41fe59..b76b8d6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,19 @@
2010-05-13 Michael Snyder <msnyder@vmware.com>
+ * charset.c: White space.
+ * c-lang.c: White space.
+ * cli-out.c: White space.
+ * coffread.c: White space.
+ * complaints.c: White space.
+ * completer.c: White space.
+ * corefile.c: White space.
+ * corelow.c: White space.
+ * cp-abi.c: White space.
+ * cp-namespace.c: White space.
+ * cp-support.c: White space.
+ * cp-valprint.c: White space.
+ * c-typeprint.c: White space.
+ * c-valprint.c: White space.
* blockframe.c: White space.
* breakpoint.c: White space.
* buildsym.c: White space.
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 305c549..63be331 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -179,6 +179,7 @@ print_wchar (gdb_wint_t w, const gdb_byte *orig, int orig_len,
int quoter, int *need_escapep)
{
int need_escape = *need_escapep;
+
*need_escapep = 0;
if (gdb_iswprint (w) && (!need_escape || (!gdb_iswdigit (w)
&& w != LCST ('8')
@@ -223,6 +224,7 @@ print_wchar (gdb_wint_t w, const gdb_byte *orig, int orig_len,
{
char octal[30];
ULONGEST value;
+
value = extract_unsigned_integer (&orig[i], width, byte_order);
/* If the value fits in 3 octal digits, print it that
way. Otherwise, print it as a hex escape. */
@@ -236,6 +238,7 @@ print_wchar (gdb_wint_t w, const gdb_byte *orig, int orig_len,
while (i < orig_len)
{
char octal[5];
+
sprintf (octal, "\\%.3o", orig[i] & 0xff);
append_string_as_wide (octal, output);
++i;
@@ -424,6 +427,7 @@ c_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string,
if (length == -1)
{
unsigned long current_char = 1;
+
for (i = 0; current_char; ++i)
{
QUIT;
@@ -504,6 +508,7 @@ c_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string,
/* Painful gyrations. */
int j;
char *s = xstrprintf (_(" <repeats %u times>"), reps);
+
for (j = 0; s[j]; ++j)
{
gdb_wchar_t w = gdb_btowc (s[j]);
@@ -881,6 +886,7 @@ convert_escape (struct type *type, const char *dest_charset,
case 'U':
{
int length = *p == 'u' ? 4 : 8;
+
ADVANCE;
if (!isxdigit (*p))
error (_("\\u used with no following hex digits"));
@@ -908,6 +914,7 @@ parse_one_string (struct obstack *output, char *data, int len,
while (data < limit)
{
char *p = data;
+
/* Look for next escape, or the end of the input. */
while (p < limit && *p != '\\')
++p;
@@ -1021,6 +1028,7 @@ evaluate_subexp_c (struct type *expect_type, struct expression *exp,
else
{
int i;
+
/* Write the terminating character. */
for (i = 0; i < TYPE_LENGTH (type); ++i)
obstack_1grow (&output, 0);
@@ -1107,6 +1115,7 @@ c_language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai)
{
const struct builtin_type *builtin = builtin_type (gdbarch);
+
lai->string_char_type = builtin->builtin_char;
lai->primitive_type_vector
= GDBARCH_OBSTACK_CALLOC (gdbarch, nr_c_primitive_types + 1,
@@ -1213,6 +1222,7 @@ cplus_language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai)
{
const struct builtin_type *builtin = builtin_type (gdbarch);
+
lai->string_char_type = builtin->builtin_char;
lai->primitive_type_vector
= GDBARCH_OBSTACK_CALLOC (gdbarch, nr_cplus_primitive_types + 1,
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index 68bcbd7..2697c3a 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -233,6 +233,7 @@ c_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
int show, int passed_a_ptr, int need_post_space)
{
char *name;
+
if (type == 0)
return;
@@ -919,6 +920,7 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show,
struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
int len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
int j;
+
for (j = 0; j < len2; j++)
if (!TYPE_FN_FIELD_ARTIFICIAL (f, j))
real_len++;
@@ -934,13 +936,14 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show,
char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
char *name = type_name_no_tag (type);
int is_constructor = name && strcmp (method_name, name) == 0;
+
for (j = 0; j < len2; j++)
{
char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
int is_full_physname_constructor =
- is_constructor_name (physname)
- || is_destructor_name (physname)
- || method_name[0] == '~';
+ is_constructor_name (physname)
+ || is_destructor_name (physname)
+ || method_name[0] == '~';
/* Do not print out artificial methods. */
if (TYPE_FN_FIELD_ARTIFICIAL (f, j))
@@ -1013,6 +1016,7 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show,
{
int staticp = TYPE_FN_FIELD_STATIC_P (f, j);
struct type *mtype = TYPE_FN_FIELD_TYPE (f, j);
+
cp_type_print_method_args (mtype,
"",
method_name,
@@ -1034,6 +1038,7 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show,
if (p != NULL)
{
int length = p - demangled_no_class;
+
demangled_no_static = (char *) xmalloc (length + 1);
strncpy (demangled_no_static, demangled_no_class, length);
*(demangled_no_static + length) = '\0';
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 31ae4e7..9d2da35 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -254,6 +254,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
-fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */
CORE_ADDR addr
= extract_typed_address (valaddr + embedded_offset, type);
+
print_function_pointer_address (gdbarch, addr, stream,
options->addressprint);
break;
@@ -343,6 +344,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
{
CORE_ADDR addr
= extract_typed_address (valaddr + embedded_offset, type);
+
fprintf_filtered (stream, "@");
fputs_filtered (paddress (gdbarch, addr), stream);
if (options->deref_ref)
@@ -354,9 +356,10 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
{
struct value *deref_val =
- value_at
- (TYPE_TARGET_TYPE (type),
- unpack_pointer (type, valaddr + embedded_offset));
+ value_at
+ (TYPE_TARGET_TYPE (type),
+ unpack_pointer (type, valaddr + embedded_offset));
+
common_val_print (deref_val, stream, recurse, options,
current_language);
}
@@ -481,6 +484,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
if (options->format || options->output_format)
{
struct value_print_options opts = *options;
+
opts.format = (options->format ? options->format
: options->output_format);
print_scalar_formatted (valaddr + embedded_offset, type,
diff --git a/gdb/charset.c b/gdb/charset.c
index fadd232..8a9b5ad 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -167,6 +167,7 @@ iconv (iconv_t utf_flag, const char **inbuf, size_t *inbytesleft,
/* In all other cases we simply copy input bytes to the
output. */
size_t amt = *inbytesleft;
+
if (amt > *outbytesleft)
amt = *outbytesleft;
memcpy (*outbuf, *inbuf, amt);
@@ -312,6 +313,7 @@ validate (struct gdbarch *gdbarch)
const char *host_cset = host_charset ();
const char *target_cset = target_charset (gdbarch);
const char *target_wide_cset = target_wide_charset_name;
+
if (!strcmp (target_wide_cset, "auto"))
target_wide_cset = gdbarch_auto_wide_charset (gdbarch);
@@ -634,10 +636,10 @@ wchar_iterate (struct wchar_iterator *iter,
size_t orig_in = iter->bytes;
size_t out_avail = out_request * sizeof (gdb_wchar_t);
size_t num;
-
size_t r = iconv (iter->desc,
(ICONV_CONST char **) &iter->input, &iter->bytes,
&outptr, &out_avail);
+
if (r == (size_t) -1)
{
switch (errno)
diff --git a/gdb/cli-out.c b/gdb/cli-out.c
index b284a4b..de0559f 100644
--- a/gdb/cli-out.c
+++ b/gdb/cli-out.c
@@ -50,6 +50,7 @@ cli_table_begin (struct ui_out *uiout, int nbrofcols,
const char *tblid)
{
cli_out_data *data = ui_out_data (uiout);
+
if (nr_rows == 0)
data->suppress_output = 1;
else
@@ -64,6 +65,7 @@ static void
cli_table_body (struct ui_out *uiout)
{
cli_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
/* first, close the table header line */
@@ -76,6 +78,7 @@ static void
cli_table_end (struct ui_out *uiout)
{
cli_out_data *data = ui_out_data (uiout);
+
data->suppress_output = 0;
}
@@ -87,6 +90,7 @@ cli_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
const char *colhdr)
{
cli_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
@@ -104,6 +108,7 @@ cli_begin (struct ui_out *uiout,
const char *id)
{
cli_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
}
@@ -116,6 +121,7 @@ cli_end (struct ui_out *uiout,
int level)
{
cli_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
}
@@ -127,9 +133,9 @@ cli_field_int (struct ui_out *uiout, int fldno, int width,
enum ui_align alignment,
const char *fldname, int value)
{
- char buffer[20]; /* FIXME: how many chars long a %d can become? */
-
+ char buffer[20]; /* FIXME: how many chars long a %d can become? */
cli_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
sprintf (buffer, "%d", value);
@@ -147,6 +153,7 @@ cli_field_skip (struct ui_out *uiout, int fldno, int width,
const char *fldname)
{
cli_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
@@ -168,8 +175,8 @@ cli_field_string (struct ui_out *uiout,
{
int before = 0;
int after = 0;
-
cli_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
@@ -217,6 +224,7 @@ cli_field_fmt (struct ui_out *uiout, int fldno,
va_list args)
{
cli_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
@@ -230,6 +238,7 @@ static void
cli_spaces (struct ui_out *uiout, int numspaces)
{
cli_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
print_spaces_filtered (numspaces, data->stream);
@@ -239,6 +248,7 @@ static void
cli_text (struct ui_out *uiout, const char *string)
{
cli_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
fputs_filtered (string, data->stream);
@@ -249,6 +259,7 @@ cli_message (struct ui_out *uiout, int verbosity,
const char *format, va_list args)
{
cli_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
if (ui_out_get_verblvl (uiout) >= verbosity)
@@ -259,6 +270,7 @@ static void
cli_wrap_hint (struct ui_out *uiout, char *identstring)
{
cli_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
wrap_here (identstring);
@@ -268,6 +280,7 @@ static void
cli_flush (struct ui_out *uiout)
{
cli_out_data *data = ui_out_data (uiout);
+
gdb_flush (data->stream);
}
@@ -275,6 +288,7 @@ static int
cli_redirect (struct ui_out *uiout, struct ui_file *outstream)
{
cli_out_data *data = ui_out_data (uiout);
+
if (outstream != NULL)
{
data->original_stream = data->stream;
@@ -315,6 +329,7 @@ static void
field_separator (void)
{
cli_out_data *data = ui_out_data (uiout);
+
fputc_filtered (' ', data->stream);
}
@@ -360,8 +375,8 @@ struct ui_out *
cli_out_new (struct ui_file *stream)
{
int flags = ui_source_list;
-
cli_out_data *data = XMALLOC (cli_out_data);
+
cli_out_data_ctor (data, stream);
return ui_out_new (&cli_ui_out_impl, data, flags);
}
@@ -371,6 +386,7 @@ cli_out_set_stream (struct ui_out *uiout, struct ui_file *stream)
{
cli_out_data *data = ui_out_data (uiout);
struct ui_file *old = data->stream;
+
data->stream = stream;
return old;
}
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 90d1cc2..52417b2 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -260,6 +260,7 @@ static void
find_targ_sec (bfd *abfd, asection *sect, void *obj)
{
struct find_targ_sec_arg *args = (struct find_targ_sec_arg *) obj;
+
if (sect->target_index == args->targ_index)
*args->resultp = sect;
}
@@ -282,6 +283,7 @@ static int
cs_to_section (struct coff_symbol *cs, struct objfile *objfile)
{
asection *sect = cs_to_bfd_section (cs, objfile);
+
if (sect == NULL)
return SECT_OFF_TEXT (objfile);
return sect->index;
@@ -414,6 +416,7 @@ record_minimal_symbol (struct coff_symbol *cs, CORE_ADDR address,
struct objfile *objfile)
{
struct bfd_section *bfd_section;
+
/* We don't want TDESC entry points in the minimal symbol table */
if (cs->c_name[0] == '@')
return NULL;
@@ -644,6 +647,7 @@ coff_symfile_read (struct objfile *objfile, int symfile_flags)
if (debugfile)
{
bfd *abfd = symfile_bfd_open (debugfile);
+
symbol_file_add_separate (abfd, symfile_flags, objfile);
xfree (debugfile);
}
@@ -779,6 +783,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
{
/* Record all functions -- external and static -- in minsyms. */
int section = cs_to_section (cs, objfile);
+
tmpaddr = cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
record_minimal_symbol (cs, tmpaddr, mst_text, section, objfile);
@@ -884,6 +889,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
/* This is a common symbol. See if the target
environment knows where it has been relocated to. */
CORE_ADDR reladdr;
+
if (target_lookup_symbol (cs->c_name, &reladdr))
{
/* Error in lookup; ignore symbol. */
@@ -908,6 +914,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
else
{
asection *bfd_section = cs_to_bfd_section (cs, objfile);
+
sec = cs_to_section (cs, objfile);
tmpaddr = cs->c_value;
/* Statics in a PE file also get relocated */
@@ -949,6 +956,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
if (SDB_TYPE (cs->c_type))
{
struct symbol *sym;
+
sym = process_coff_symbol
(cs, &main_aux, objfile);
SYMBOL_VALUE (sym) = tmpaddr;
@@ -1497,8 +1505,8 @@ process_coff_symbol (struct coff_symbol *cs,
struct objfile *objfile)
{
struct symbol *sym
- = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
- sizeof (struct symbol));
+ = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
+ sizeof (struct symbol));
char *name;
memset (sym, 0, sizeof (struct symbol));
@@ -2098,6 +2106,7 @@ coff_read_enum_type (int index, int length, int lastsym,
for (; j < syms->nsyms; j++, n++)
{
struct symbol *xsym = syms->symbol[j];
+
SYMBOL_TYPE (xsym) = type;
TYPE_FIELD_NAME (type, n) = SYMBOL_LINKAGE_NAME (xsym);
SET_FIELD_BITPOS (TYPE_FIELD (type, n), SYMBOL_VALUE (xsym));
diff --git a/gdb/complaints.c b/gdb/complaints.c
index fa63418..476f3f4 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -171,6 +171,7 @@ vcomplaint (struct complaints **c, const char *file, int line, const char *fmt,
struct complaints *complaints = get_complaints (c);
struct complain *complaint = find_complaint (complaints, file, line, fmt);
enum complaint_series series;
+
gdb_assert (complaints != NULL);
complaint->counter++;
@@ -243,6 +244,7 @@ void
complaint (struct complaints **complaints, const char *fmt, ...)
{
va_list args;
+
va_start (args, fmt);
vcomplaint (complaints, NULL/*file*/, 0/*line*/, fmt, args);
va_end (args);
diff --git a/gdb/completer.c b/gdb/completer.c
index a095be0..3ba481e 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -126,6 +126,7 @@ filename_completer (struct cmd_list_element *ignore, char *text, char *word)
while (1)
{
char *p, *q;
+
p = rl_filename_completion_function (text, subsequent_name);
if (return_val_used >= return_val_alloced)
{
@@ -389,6 +390,7 @@ add_struct_fields (struct type *type, int *nextp, char **output,
for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; --i)
{
char *name = TYPE_FN_FIELDLIST_NAME (type, i);
+
if (name && ! strncmp (name, fieldname, namelen))
{
if (!computed_type_name)
@@ -783,7 +785,8 @@ command_completer (struct cmd_list_element *ignore, char *text, char *word)
char *
gdb_completion_word_break_characters (void)
{
- char ** list;
+ char **list;
+
list = complete_line_internal (rl_line_buffer, rl_line_buffer, rl_point,
handle_brkchars);
gdb_assert (list == NULL);
diff --git a/gdb/corefile.c b/gdb/corefile.c
index 9c722f4..7c1db86 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -232,6 +232,7 @@ void
read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
{
int status;
+
status = target_read_memory (memaddr, myaddr, len);
if (status != 0)
memory_error (status, memaddr);
@@ -243,6 +244,7 @@ void
read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
{
int status;
+
status = target_read_stack (memaddr, myaddr, len);
if (status != 0)
memory_error (status, memaddr);
@@ -286,11 +288,13 @@ do_captured_read_memory_integer (void *data)
if successful. */
int
-safe_read_memory_integer (CORE_ADDR memaddr, int len, enum bfd_endian byte_order,
+safe_read_memory_integer (CORE_ADDR memaddr, int len,
+ enum bfd_endian byte_order,
LONGEST *return_value)
{
int status;
struct captured_read_memory_integer_arguments args;
+
args.memaddr = memaddr;
args.len = len;
args.byte_order = byte_order;
@@ -352,6 +356,7 @@ CORE_ADDR
read_memory_typed_address (CORE_ADDR addr, struct type *type)
{
gdb_byte *buf = alloca (TYPE_LENGTH (type));
+
read_memory (addr, buf, TYPE_LENGTH (type));
return extract_typed_address (buf, type);
}
@@ -361,6 +366,7 @@ void
write_memory (CORE_ADDR memaddr, const bfd_byte *myaddr, int len)
{
int status;
+
status = target_write_memory (memaddr, myaddr, len);
if (status != 0)
memory_error (status, memaddr);
@@ -368,20 +374,24 @@ write_memory (CORE_ADDR memaddr, const bfd_byte *myaddr, int len)
/* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */
void
-write_memory_unsigned_integer (CORE_ADDR addr, int len, enum bfd_endian byte_order,
+write_memory_unsigned_integer (CORE_ADDR addr, int len,
+ enum bfd_endian byte_order,
ULONGEST value)
{
gdb_byte *buf = alloca (len);
+
store_unsigned_integer (buf, len, byte_order, value);
write_memory (addr, buf, len);
}
/* Store VALUE at ADDR in the inferior as a LEN-byte signed integer. */
void
-write_memory_signed_integer (CORE_ADDR addr, int len, enum bfd_endian byte_order,
+write_memory_signed_integer (CORE_ADDR addr, int len,
+ enum bfd_endian byte_order,
LONGEST value)
{
gdb_byte *buf = alloca (len);
+
store_signed_integer (buf, len, byte_order, value);
write_memory (addr, buf, len);
}
@@ -424,6 +434,7 @@ void
_initialize_core (void)
{
struct cmd_list_element *c;
+
c = add_cmd ("core-file", class_files, core_file_command, _("\
Use FILE as core dump for examining memory and registers.\n\
No arg means have no core file. This command has been superseded by the\n\
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 0bbe481..9523f32 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -418,6 +418,7 @@ core_open (char *filename, int from_tty)
usually happen, but we're dealing with input here, which can
always be broken in different ways. */
struct thread_info *thread = first_thread_of_process (-1);
+
if (thread == NULL)
{
inferior_appeared (current_inferior (), CORELOW_PID);
@@ -764,8 +765,8 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
struct bfd_section *section;
bfd_size_type size;
-
char sectionstr[100];
+
xsnprintf (sectionstr, sizeof sectionstr, "SPU/%s", annex);
section = bfd_get_section_by_name (core_bfd, sectionstr);
@@ -792,6 +793,7 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
{
/* NULL annex requests list of all present spuids. */
struct spuid_list list;
+
list.buf = readbuf;
list.offset = offset;
list.len = len;
@@ -856,6 +858,7 @@ core_pid_to_str (struct target_ops *ops, ptid_t ptid)
&& gdbarch_core_pid_to_str_p (core_gdbarch))
{
char *ret = gdbarch_core_pid_to_str (core_gdbarch, ptid);
+
if (ret != NULL)
return ret;
}
diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c
index aee13f2..14552d1 100644
--- a/gdb/cp-abi.c
+++ b/gdb/cp-abi.c
@@ -92,6 +92,7 @@ value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
{
struct type *ret = NULL;
struct gdb_exception e;
+
if ((current_cp_abi.rtti_type) == NULL)
return NULL;
TRY_CATCH (e, RETURN_MASK_ERROR)
@@ -238,8 +239,8 @@ list_cp_abis (int from_tty)
{
struct cleanup *cleanup_chain;
int i;
- ui_out_text (uiout, "The available C++ ABIs are:\n");
+ ui_out_text (uiout, "The available C++ ABIs are:\n");
cleanup_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "cp-abi-list");
for (i = 0; i < num_cp_abis; i++)
{
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 4811188..0daf732 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -264,6 +264,7 @@ cp_lookup_symbol_in_namespace (const char *namespace,
{
char *concatenated_name = alloca (strlen (namespace) + 2 +
strlen (name) + 1);
+
strcpy (concatenated_name, namespace);
strcat (concatenated_name, "::");
strcat (concatenated_name, name);
@@ -577,6 +578,7 @@ cp_lookup_nested_type (struct type *parent_type,
nested_name,
block,
VAR_DOMAIN);
+
if (sym == NULL || SYMBOL_CLASS (sym) != LOC_TYPEDEF)
return NULL;
else
@@ -644,6 +646,7 @@ cp_lookup_transparent_type_loop (const char *name, const char *scope,
{
struct type *retval
= cp_lookup_transparent_type_loop (name, scope, scope_length + 2);
+
if (retval != NULL)
return retval;
}
@@ -876,6 +879,7 @@ static void
maintenance_cplus_namespace (char *args, int from_tty)
{
struct objfile *objfile;
+
printf_unfiltered (_("Possible namespaces:\n"));
ALL_OBJFILES (objfile)
{
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 8f447ca..e4b5d4d 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -715,13 +715,13 @@ static void
make_symbol_overload_list_namespace (const char *func_name,
const char *namespace)
{
-
if (namespace[0] == '\0')
make_symbol_overload_list_qualified (func_name);
else
{
char *concatenated_name
= alloca (strlen (namespace) + 2 + strlen (func_name) + 1);
+
strcpy (concatenated_name, namespace);
strcat (concatenated_name, "::");
strcat (concatenated_name, func_name);
@@ -996,18 +996,20 @@ cp_validate_operator (const char *input)
if (strncmp (p, "operator", 8) == 0)
{
int valid = 0;
- p += 8;
+ p += 8;
SKIP_SPACE (p);
for (i = 0; i < sizeof (operator_tokens) / sizeof (operator_tokens[0]);
++i)
{
int length = strlen (operator_tokens[i]);
+
/* By using strncmp here, we MUST have operator_tokens ordered!
See additional notes where operator_tokens is defined above. */
if (strncmp (p, operator_tokens[i], length) == 0)
{
const char *op = p;
+
valid = 1;
p += length;
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 64aa3e0..3fbb1f1 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -198,6 +198,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
{
stat_array_obstack_initial_size =
obstack_object_size (&dont_print_stat_array_obstack);
+
last_set_recurse = recurse;
}
}
@@ -280,6 +281,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
else
{
struct value_print_options opts = *options;
+
opts.deref_ref = 0;
v = value_from_longest
(TYPE_FIELD_TYPE (type, i),
@@ -298,6 +300,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
else if (field_is_static (&TYPE_FIELD (type, i)))
{
struct value *v = value_static_field (type, i);
+
if (v == NULL)
fputs_filtered ("<optimized out>", stream);
else
@@ -307,6 +310,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
else
{
struct value_print_options opts = *options;
+
opts.deref_ref = 0;
val_print (TYPE_FIELD_TYPE (type, i),
valaddr, offset + TYPE_FIELD_BITPOS (type, i) / 8,
@@ -374,7 +378,8 @@ cp_print_value_fields_rtti (struct type *type,
CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value_print_options *options,
- struct type **dont_print_vb, int dont_print_statmem)
+ struct type **dont_print_vb,
+ int dont_print_statmem)
{
struct value *value;
int full, top, using_enc;
@@ -462,6 +467,7 @@ cp_print_value (struct type *type, struct type *real_type,
{
/* FIXME (alloca): unsafe if baseclass is really really large. */
gdb_byte *buf = alloca (TYPE_LENGTH (baseclass));
+
base_valaddr = buf;
if (target_read_memory (address + boffset, buf,
TYPE_LENGTH (baseclass)) != 0)
@@ -697,6 +703,7 @@ cp_print_class_member (const gdb_byte *valaddr, struct type *type,
if (domain != NULL)
{
char *name;
+
fputs_filtered (prefix, stream);
name = type_name_no_tag (domain);
if (name)