This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch] Initialize random variables
- To: GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- Subject: [patch] Initialize random variables
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Mon, 27 Nov 2000 13:07:25 +1100
FYI,
I've checked in the attatched. They fix a number of simple
--enable-gdb-warnings=-Werror,-Wuninitialized build problems. I don't
think these will worry anyone.
I'll follow up with some extra fixes that do need some review.
Andrew
Mon Nov 27 11:45:52 2000 Andrew Cagney <cagney@b1.cygnus.com>
* remote.c (remote_write_bytes): Add default case to switch
initializing ``todo''. Ditto for ``nr_bytes''.
* top.c (catch_errors): Always initialize ``val''.
* solib.c (info_sharedlibrary_command): Handle bfd_get_arch_size
returning an unknown size.
* gdbtypes.c (count_virtual_fns): Always initialize ``vfuncs''.
* breakpoint.c (break_at_finish_at_depth_command_1): Initialise
extra_args to NULL.
(break_at_finish_command_1): Ditto.
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.19
diff -p -r1.19 breakpoint.c
*** breakpoint.c 2000/10/30 15:32:51 1.19
--- breakpoint.c 2000/11/27 02:09:11
*************** break_at_finish_at_depth_command_1 (char
*** 4905,4911 ****
{
struct frame_info *frame;
CORE_ADDR low, high, selected_pc = 0;
! char *extra_args, *level_arg, *addr_string;
int extra_args_len = 0, if_arg = 0;
if (!arg ||
--- 4905,4913 ----
{
struct frame_info *frame;
CORE_ADDR low, high, selected_pc = 0;
! char *extra_args = NULL;
! char *level_arg;
! char *addr_string;
int extra_args_len = 0, if_arg = 0;
if (!arg ||
*************** break_at_finish_command_1 (char *arg, in
*** 4983,4989 ****
struct symtabs_and_lines sals;
struct symtab_and_line sal;
struct cleanup *old_chain;
! char *extra_args;
int extra_args_len = 0;
int i, if_arg = 0;
--- 4985,4991 ----
struct symtabs_and_lines sals;
struct symtab_and_line sal;
struct cleanup *old_chain;
! char *extra_args = NULL;
int extra_args_len = 0;
int i, if_arg = 0;
Index: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.14
diff -p -r1.14 gdbtypes.c
*** gdbtypes.c 2000/09/02 00:05:02 1.14
--- gdbtypes.c 2000/11/27 02:09:17
*************** count_virtual_fns (struct type *dclass)
*** 1986,1991 ****
--- 1986,1993 ----
struct type *pbc = primary_base_class (dclass);
if (pbc)
vfuncs = count_virtual_fns (pbc);
+ else
+ vfuncs = 0;
for (fn = 0; fn < TYPE_NFN_FIELDS (dclass); fn++)
for (oi = 0; oi < TYPE_FN_FIELDLIST_LENGTH (dclass, fn); oi++)
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.29
diff -p -r1.29 remote.c
*** remote.c 2000/11/20 02:06:18 1.29
--- remote.c 2000/11/27 02:09:38
*************** remote_write_bytes (CORE_ADDR memaddr, c
*** 3363,3369 ****
todo = min (len, max_buf_size / 2);
break;
case PACKET_SUPPORT_UNKNOWN:
! internal_error ("remote_write_bytes: bad switch");
}
/* Append <memaddr> */
--- 3363,3372 ----
todo = min (len, max_buf_size / 2);
break;
case PACKET_SUPPORT_UNKNOWN:
! internal_error ("%s:%d: remote_write_bytes: bad internal state",
! __FILE__, __LINE__);
! default:
! internal_error ("%s:%d: bad switch", __FILE__, __LINE__);
}
/* Append <memaddr> */
*************** remote_write_bytes (CORE_ADDR memaddr, c
*** 3427,3433 ****
*p = '\0';
break;
case PACKET_SUPPORT_UNKNOWN:
! internal_error ("remote_write_bytes: bad switch");
}
putpkt_binary (buf, (int) (p - buf));
--- 3430,3439 ----
*p = '\0';
break;
case PACKET_SUPPORT_UNKNOWN:
! internal_error ("%s:%d: remote_write_bytes: bad internal state",
! __FILE__, __LINE__);
! default:
! internal_error ("%s:%d: bad switch", __FILE__, __LINE__);
}
putpkt_binary (buf, (int) (p - buf));
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.28
diff -p -r1.28 solib.c
*** solib.c 2000/11/21 09:23:32 1.28
--- solib.c 2000/11/27 02:09:41
*************** info_sharedlibrary_command (char *ignore
*** 613,618 ****
--- 613,623 ----
addr_width = 16 + 4;
addr_fmt = "016l";
}
+ else
+ {
+ internal_error ("%s:%d: bfd_get_arch_size() returned unknown size %d",
+ __FILE__, __LINE__, arch_size);
+ }
update_solib_list (from_tty, 0);
Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.21
diff -p -r1.21 top.c
*** top.c 2000/11/16 14:51:50 1.21
--- top.c 2000/11/27 02:09:51
*************** catch_errors (catch_errors_ftype *func,
*** 605,610 ****
--- 605,612 ----
caught = SIGSETJMP (catch);
if (!caught)
val = (*func) (args);
+ else
+ val = 0;
catch_return = saved_catch;
/* FIXME: cagney/1999-11-05: A correct FUNC implementation will