aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2010-05-16 01:27:02 +0000
committerMichael Snyder <msnyder@vmware.com>2010-05-16 01:27:02 +0000
commitad3bbd48b65047845b258564db3fd2e64e00c7bc (patch)
tree6fa1e4fcc2207b1528a33e4097c13526e75db941
parent5cc80db34dcbe944fe7b480c9841f309c0cf6e96 (diff)
downloadgdb-ad3bbd48b65047845b258564db3fd2e64e00c7bc.zip
gdb-ad3bbd48b65047845b258564db3fd2e64e00c7bc.tar.gz
gdb-ad3bbd48b65047845b258564db3fd2e64e00c7bc.tar.bz2
2010-05-15 Michael Snyder <msnyder@vmware.com>
* parse.c: White space. * p-lang.c: White space. * posix-hdep.c: White space. * printcmd.c: White space. * progspace.c: White space. * prologue-value.c: White space. * psymtab.c: White space. * p-typeprint.c: White space. * p-valprint.c: White space.
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/p-lang.c5
-rw-r--r--gdb/p-typeprint.c4
-rw-r--r--gdb/p-valprint.c28
-rw-r--r--gdb/parse.c24
-rw-r--r--gdb/posix-hdep.c1
-rw-r--r--gdb/printcmd.c18
-rw-r--r--gdb/progspace.c3
-rw-r--r--gdb/prologue-value.c3
-rw-r--r--gdb/psymtab.c12
10 files changed, 85 insertions, 23 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5ebc37b..d761515 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
2010-05-15 Michael Snyder <msnyder@vmware.com>
+ * parse.c: White space.
+ * p-lang.c: White space.
+ * posix-hdep.c: White space.
+ * printcmd.c: White space.
+ * progspace.c: White space.
+ * prologue-value.c: White space.
+ * psymtab.c: White space.
+ * p-typeprint.c: White space.
+ * p-valprint.c: White space.
+
* objc-lang.c: White space.
* objfiles.c: White space.
* observer.c: White space.
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index 44aefa4..08738ac 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -137,6 +137,7 @@ is_pascal_string_type (struct type *type,int *length_pos,
if (char_type)
{
*char_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 2));
+
if (TYPE_CODE (*char_type) == TYPE_CODE_ARRAY)
*char_type = TYPE_TARGET_TYPE (*char_type);
}
@@ -157,7 +158,6 @@ static void pascal_one_char (int, struct ui_file *, int *);
static void
pascal_one_char (int c, struct ui_file *stream, int *in_quotes)
{
-
if (c == '\'' || ((unsigned int) c <= 0xff && (PRINT_LITERAL_FORM (c))))
{
if (!(*in_quotes))
@@ -190,6 +190,7 @@ static void
pascal_emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
{
int in_quotes = 0;
+
pascal_one_char (c, stream, &in_quotes);
if (in_quotes)
fputs_filtered ("'", stream);
@@ -199,6 +200,7 @@ void
pascal_printchar (int c, struct type *type, struct ui_file *stream)
{
int in_quotes = 0;
+
pascal_one_char (c, stream, &in_quotes);
if (in_quotes)
fputs_filtered ("'", stream);
@@ -370,6 +372,7 @@ pascal_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_pascal_primitive_types + 1,
diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c
index 8924a28..fc54e01 100644
--- a/gdb/p-typeprint.c
+++ b/gdb/p-typeprint.c
@@ -301,6 +301,7 @@ static void
pascal_print_func_args (struct type *type, struct ui_file *stream)
{
int i, len = TYPE_NFIELDS (type);
+
if (len)
{
fprintf_filtered (stream, "(");
@@ -439,8 +440,8 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
s_none, s_public, s_private, s_protected
}
section_type;
- QUIT;
+ QUIT;
wrap_here (" ");
if (type == NULL)
{
@@ -764,6 +765,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
case TYPE_CODE_RANGE:
{
struct type *target = TYPE_TARGET_TYPE (type);
+
print_type_scalar (target, TYPE_LOW_BOUND (type), stream);
fputs_filtered ("..", stream);
print_type_scalar (target, TYPE_HIGH_BOUND (type), stream);
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 98908af..78cba98 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -194,6 +194,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
{
ULONGEST string_length;
void *buffer;
+
buffer = xmalloc (length_size);
read_memory (addr + length_pos, buffer, length_size);
string_length = extract_unsigned_integer (buffer, length_size,
@@ -205,9 +206,9 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
{
/* print vtbl's nicely */
CORE_ADDR vt_address = unpack_pointer (type, valaddr + embedded_offset);
-
struct minimal_symbol *msymbol =
- lookup_minimal_symbol_by_pc (vt_address);
+ lookup_minimal_symbol_by_pc (vt_address);
+
if ((msymbol != NULL)
&& (vt_address == SYMBOL_VALUE_ADDRESS (msymbol)))
{
@@ -259,6 +260,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
{
CORE_ADDR addr
= extract_typed_address (valaddr + embedded_offset, type);
+
fprintf_filtered (stream, "@");
fputs_filtered (paddress (gdbarch, addr), stream);
if (options->deref_ref)
@@ -270,9 +272,10 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
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 + 1, options,
current_language);
}
@@ -372,6 +375,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
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,
@@ -406,6 +410,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
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,
@@ -421,6 +426,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
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,
@@ -484,6 +490,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
for (i = low_bound; i <= high_bound; i++)
{
int element = value_bit_index (type, valaddr + embedded_offset, i);
+
if (element < 0)
{
i = element;
@@ -501,6 +508,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
if (i + 1 <= high_bound && value_bit_index (type, valaddr + embedded_offset, ++i))
{
int j = i;
+
fputs_filtered ("..", stream);
while (i + 1 <= high_bound
&& value_bit_index (type, valaddr + embedded_offset, ++i))
@@ -760,6 +768,7 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
else
{
struct value_print_options opts = *options;
+
v = value_from_longest (TYPE_FIELD_TYPE (type, i),
unpack_field_as_long (type, valaddr, i));
@@ -778,6 +787,7 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
{
/* struct value *v = value_static_field (type, i); v4.17 specific */
struct value *v;
+
v = value_from_longest (TYPE_FIELD_TYPE (type, i),
unpack_field_as_long (type, valaddr, i));
@@ -790,6 +800,7 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
else
{
struct value_print_options opts = *options;
+
opts.deref_ref = 0;
/* val_print (TYPE_FIELD_TYPE (type, i),
valaddr + TYPE_FIELD_BITPOS (type, i) / 8,
@@ -833,7 +844,7 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
struct type **dont_print_vb)
{
struct type **last_dont_print
- = (struct type **) obstack_next_free (&dont_print_vb_obstack);
+ = (struct type **) obstack_next_free (&dont_print_vb_obstack);
struct obstack tmp_obstack = dont_print_vb_obstack;
int i, n_baseclasses = TYPE_N_BASECLASSES (type);
@@ -856,10 +867,10 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
if (BASETYPE_VIA_VIRTUAL (type, i))
{
struct type **first_dont_print
- = (struct type **) obstack_base (&dont_print_vb_obstack);
+ = (struct type **) obstack_base (&dont_print_vb_obstack);
int j = (struct type **) obstack_next_free (&dont_print_vb_obstack)
- - first_dont_print;
+ - first_dont_print;
while (--j >= 0)
if (baseclass == first_dont_print[j])
@@ -890,6 +901,7 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
{
/* FIXME (alloc): not safe is baseclass is really really big. */
gdb_byte *buf = alloca (TYPE_LENGTH (baseclass));
+
base_valaddr = buf;
if (target_read_memory (address + boffset, buf,
TYPE_LENGTH (baseclass)) != 0)
diff --git a/gdb/parse.c b/gdb/parse.c
index 7db6e92..1f2f6a7 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -168,6 +168,7 @@ end_arglist (void)
{
int val = arglist_len;
struct funcall *call = funcall_chain;
+
funcall_chain = call->next;
arglist_len = call->arglist_len;
xfree (call);
@@ -214,10 +215,9 @@ void
write_exp_elt_opcode (enum exp_opcode expelt)
{
union exp_element tmp;
- memset (&tmp, 0, sizeof (union exp_element));
+ memset (&tmp, 0, sizeof (union exp_element));
tmp.opcode = expelt;
-
write_exp_elt (tmp);
}
@@ -225,10 +225,9 @@ void
write_exp_elt_sym (struct symbol *expelt)
{
union exp_element tmp;
- memset (&tmp, 0, sizeof (union exp_element));
+ memset (&tmp, 0, sizeof (union exp_element));
tmp.symbol = expelt;
-
write_exp_elt (tmp);
}
@@ -236,6 +235,7 @@ void
write_exp_elt_block (struct block *b)
{
union exp_element tmp;
+
memset (&tmp, 0, sizeof (union exp_element));
tmp.block = b;
write_exp_elt (tmp);
@@ -245,6 +245,7 @@ void
write_exp_elt_objfile (struct objfile *objfile)
{
union exp_element tmp;
+
memset (&tmp, 0, sizeof (union exp_element));
tmp.objfile = objfile;
write_exp_elt (tmp);
@@ -254,10 +255,9 @@ void
write_exp_elt_longcst (LONGEST expelt)
{
union exp_element tmp;
- memset (&tmp, 0, sizeof (union exp_element));
+ memset (&tmp, 0, sizeof (union exp_element));
tmp.longconst = expelt;
-
write_exp_elt (tmp);
}
@@ -265,10 +265,9 @@ void
write_exp_elt_dblcst (DOUBLEST expelt)
{
union exp_element tmp;
- memset (&tmp, 0, sizeof (union exp_element));
+ memset (&tmp, 0, sizeof (union exp_element));
tmp.doubleconst = expelt;
-
write_exp_elt (tmp);
}
@@ -288,10 +287,9 @@ void
write_exp_elt_type (struct type *expelt)
{
union exp_element tmp;
- memset (&tmp, 0, sizeof (union exp_element));
+ memset (&tmp, 0, sizeof (union exp_element));
tmp.type = expelt;
-
write_exp_elt (tmp);
}
@@ -299,10 +297,9 @@ void
write_exp_elt_intern (struct internalvar *expelt)
{
union exp_element tmp;
- memset (&tmp, 0, sizeof (union exp_element));
+ memset (&tmp, 0, sizeof (union exp_element));
tmp.internalvar = expelt;
-
write_exp_elt (tmp);
}
@@ -1023,6 +1020,7 @@ prefixify_subexp (struct expression *inexpr,
for (i = 0; i < args; i++)
{
int r;
+
oplen = arglens[i];
inend += oplen;
r = prefixify_subexp (inexpr, outexpr, inend, outbeg);
@@ -1166,6 +1164,7 @@ struct expression *
parse_expression (char *string)
{
struct expression *exp;
+
exp = parse_exp_1 (&string, 0, 0);
if (*string)
error (_("Junk after end of expression."));
@@ -1369,6 +1368,7 @@ void
parser_fprintf (FILE *x, const char *y, ...)
{
va_list args;
+
va_start (args, y);
if (x == stderr)
vfprintf_unfiltered (gdb_stderr, y, args);
diff --git a/gdb/posix-hdep.c b/gdb/posix-hdep.c
index ac6c7b2..bcc1dee 100644
--- a/gdb/posix-hdep.c
+++ b/gdb/posix-hdep.c
@@ -37,6 +37,7 @@ safe_strerror (int errnum)
if (msg == NULL)
{
static char buf[32];
+
xsnprintf (buf, sizeof buf, "(undocumented errno %d)", errnum);
msg = buf;
}
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index d202330..58cb1f6 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -296,6 +296,7 @@ print_formatted (struct value *val, int size,
case 's':
{
struct type *elttype = value_type (val);
+
next_address = (value_address (val)
+ val_print_string (elttype,
value_address (val), -1,
@@ -463,6 +464,7 @@ print_scalar_formatted (const void *valaddr, struct type *type,
case 'a':
{
CORE_ADDR addr = unpack_pointer (type, valaddr);
+
print_address (gdbarch, addr, stream);
}
break;
@@ -470,8 +472,8 @@ print_scalar_formatted (const void *valaddr, struct type *type,
case 'c':
{
struct value_print_options opts = *options;
- opts.format = 0;
+ opts.format = 0;
if (TYPE_UNSIGNED (type))
type = builtin_type (gdbarch)->builtin_true_unsigned_char;
else
@@ -769,6 +771,7 @@ print_address_demangle (struct gdbarch *gdbarch, CORE_ADDR addr,
struct ui_file *stream, int do_demangle)
{
struct value_print_options opts;
+
get_user_print_options (&opts);
if (addr == 0)
{
@@ -840,6 +843,7 @@ do_examine (struct format_data fmt, struct gdbarch *gdbarch, CORE_ADDR addr)
if (format == 's')
{
struct type *char_type = NULL;
+
/* Search for "char16_t" or "char32_t" types or fall back to 8-bit char
if type is not found. */
if (size == 'h')
@@ -1075,6 +1079,7 @@ set_command (char *exp, int from_tty)
struct expression *expr = parse_expression (exp);
struct cleanup *old_chain =
make_cleanup (free_current_contents, &expr);
+
evaluate_expression (expr);
do_cleanups (old_chain);
}
@@ -1653,6 +1658,7 @@ do_one_display (struct display *d)
if (d->exp == NULL)
{
volatile struct gdb_exception ex;
+
TRY_CATCH (ex, RETURN_MASK_ALL)
{
innermost_block = NULL;
@@ -2253,6 +2259,7 @@ printf_command (char *arg, int from_tty)
/* Windows' printf does support long long, but not the usual way.
Convert %lld to %I64d. */
int length_before_ll = f - last_arg - 1 - lcount;
+
strncpy (current_substring, last_arg, length_before_ll);
strcpy (current_substring + length_before_ll, "I64");
current_substring[length_before_ll + 3] =
@@ -2264,6 +2271,7 @@ printf_command (char *arg, int from_tty)
{
/* Convert %ls or %lc to %s. */
int length_before_ls = f - last_arg - 2;
+
strncpy (current_substring, last_arg, length_before_ls);
strcpy (current_substring + length_before_ls, "s");
current_substring += length_before_ls + 2;
@@ -2284,6 +2292,7 @@ printf_command (char *arg, int from_tty)
while (*s != '\0')
{
char *s1;
+
if (nargs == allocated_args)
val_args = (struct value **) xrealloc ((char *) val_args,
(allocated_args *= 2)
@@ -2311,12 +2320,14 @@ printf_command (char *arg, int from_tty)
gdb_byte *str;
CORE_ADDR tem;
int j;
+
tem = value_as_address (val_args[i]);
/* This is a %s argument. Find the length of the string. */
for (j = 0;; j++)
{
gdb_byte c;
+
QUIT;
read_memory (tem + j, &c, 1);
if (c == 0)
@@ -2449,6 +2460,7 @@ printf_command (char *arg, int from_tty)
#if defined (CC_HAS_LONG_LONG) && defined (PRINTF_HAS_LONG_LONG)
{
long long val = value_as_long (val_args[i]);
+
printf_filtered (current_substring, val);
break;
}
@@ -2458,12 +2470,14 @@ printf_command (char *arg, int from_tty)
case int_arg:
{
int val = value_as_long (val_args[i]);
+
printf_filtered (current_substring, val);
break;
}
case long_arg:
{
long val = value_as_long (val_args[i]);
+
printf_filtered (current_substring, val);
break;
}
@@ -2472,6 +2486,7 @@ printf_command (char *arg, int from_tty)
case decfloat_arg:
{
const gdb_byte *param_ptr = value_contents (val_args[i]);
+
#if defined (PRINTF_HAS_DECFLOAT)
/* If we have native support for Decimal floating
printing, handle it here. */
@@ -2592,6 +2607,7 @@ printf_command (char *arg, int from_tty)
while (*p)
{
int is_percent = (*p == '%');
+
*fmt_p++ = *p++;
if (is_percent)
{
diff --git a/gdb/progspace.c b/gdb/progspace.c
index 5a2acfd..b1abcf9 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -227,6 +227,7 @@ static void
restore_program_space (void *arg)
{
struct program_space *saved_pspace = arg;
+
set_current_program_space (saved_pspace);
}
@@ -239,6 +240,7 @@ save_current_program_space (void)
{
struct cleanup *old_chain = make_cleanup (restore_program_space,
current_program_space);
+
return old_chain;
}
@@ -435,6 +437,7 @@ update_address_spaces (void)
if (shared_aspace)
{
struct address_space *aspace = new_address_space ();
+
free_address_space (current_program_space->aspace);
ALL_PSPACES (pspace)
pspace->aspace = aspace;
diff --git a/gdb/prologue-value.c b/gdb/prologue-value.c
index b52c867..4ff5a0c 100644
--- a/gdb/prologue-value.c
+++ b/gdb/prologue-value.c
@@ -346,6 +346,7 @@ clear_entries (struct pv_area *area)
do
{
struct area_entry *next = e->next;
+
xfree (e);
e = next;
}
@@ -468,6 +469,7 @@ pv_area_store (struct pv_area *area,
while (e && overlaps (area, e, offset, size))
{
struct area_entry *next = (e->next == e) ? 0 : e->next;
+
e->prev->next = e->next;
e->next->prev = e->prev;
@@ -492,6 +494,7 @@ pv_area_store (struct pv_area *area,
{
CORE_ADDR offset = addr.k;
struct area_entry *e = (struct area_entry *) xmalloc (sizeof (*e));
+
e->offset = offset;
e->size = size;
e->value = value;
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 0645dd6..dc63040 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -236,6 +236,7 @@ find_pc_sect_psymtab (struct objfile *objfile, CORE_ADDR pc,
if (overlay_debugging && msymbol && section)
{
struct partial_symbol *p;
+
/* NOTE: This assumes that every psymbol has a
corresponding msymbol, which is not necessarily
true; the debug info might be much richer than the
@@ -518,6 +519,7 @@ psymtab_to_symtab (struct partial_symtab *pst)
if (!pst->readin)
{
struct cleanup *back_to = increment_reading_symtab ();
+
(*pst->read_symtab) (pst);
do_cleanups (back_to);
}
@@ -569,6 +571,7 @@ find_last_source_symtab_from_partial (struct objfile *ofp)
{
const char *name = ps->filename;
int len = strlen (name);
+
if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0
|| strcmp (name, "<<C++-namespaces>>") == 0)))
cs_pst = ps;
@@ -768,6 +771,7 @@ print_psymtab_stats_for_objfile (struct objfile *objfile)
{
int i;
struct partial_symtab *ps;
+
i = 0;
ALL_OBJFILE_PSYMTABS (objfile, ps)
{
@@ -854,6 +858,7 @@ map_symbol_names_psymtab (struct objfile *objfile,
void (*fun) (const char *, void *), void *data)
{
struct partial_symtab *ps;
+
ALL_OBJFILE_PSYMTABS (objfile, ps)
{
struct partial_symbol **psym;
@@ -991,12 +996,14 @@ ada_lookup_partial_symbol (struct partial_symtab *pst, const char *name,
if (global)
{
int U;
+
i = 0;
U = length - 1;
while (U - i > 4)
{
int M = (U + i) >> 1;
struct partial_symbol *psym = start[M];
+
if (SYMBOL_LINKAGE_NAME (psym)[0] < name[0])
i = M + 1;
else if (SYMBOL_LINKAGE_NAME (psym)[0] > name[0])
@@ -1035,12 +1042,14 @@ ada_lookup_partial_symbol (struct partial_symtab *pst, const char *name,
if (global)
{
int U;
+
i = 0;
U = length - 1;
while (U - i > 4)
{
int M = (U + i) >> 1;
struct partial_symbol *psym = start[M];
+
if (SYMBOL_LINKAGE_NAME (psym)[0] < '_')
i = M + 1;
else if (SYMBOL_LINKAGE_NAME (psym)[0] > '_')
@@ -1106,6 +1115,7 @@ map_ada_symtabs (struct objfile *objfile,
wild_match, is_name_suffix))
{
struct symtab *s = PSYMTAB_TO_SYMTAB (ps);
+
if (s == NULL || !s->primary)
continue;
(*callback) (objfile, s, data);
@@ -1456,6 +1466,7 @@ extend_psymbol_list (struct psymbol_allocation_list *listp,
struct objfile *objfile)
{
int new_size;
+
if (listp->size == 0)
{
new_size = 255;
@@ -1641,6 +1652,7 @@ maintenance_check_symtabs (char *ignore, int from_tty)
ALL_PSYMTABS (objfile, ps)
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
+
s = PSYMTAB_TO_SYMTAB (ps);
if (s == NULL)
continue;