From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31182 invoked by alias); 19 Nov 2010 16:13:40 -0000 Received: (qmail 31165 invoked by uid 22791); 19 Nov 2010 16:13:38 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_BJ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 19 Nov 2010 16:13:33 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAJGDVBE022830 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 19 Nov 2010 11:13:31 -0500 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oAJGDUdK022036 for ; Fri, 19 Nov 2010 11:13:30 -0500 From: Phil Muldoon To: gdb-patches@sourceware.org Subject: (reposted) Fix -fprofile-use warnings/errors. In-Reply-To: (Phil Muldoon's message of "Fri, 19 Nov 2010 15:20:11 +0000") References: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Reply-to: pmuldoon@redhat.com X-URL: http://www.redhat.com Date: Fri, 19 Nov 2010 16:13:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-11/txt/msg00257.txt.bz2 Phil Muldoon writes: > Phil Muldoon writes: > >> This patch corrects (and in some cases, appeases) compiler warnings >> generated through the use of -fprofile-use. We've had a variant patch >> for sometime in the Fedora GDB. This updates HEAD. > > And just as soon as I post the patch I realize some of the profile data > was stale. Sorry for the noise, but I will post another (larger) patch > very shortly. Here is an updated patch 2010-11-19 Phil Muldoon * cris-tdep.c (cris_software_single_step): Initialize variables to appease fprofile-use warnings. * macroexp.c (expand): Ditto. * remote-m32r-sdi.c: Ditto. * xcoffread.c (read_xcoff_symtab): Ditto. * gcore.c (objfile_find_memory_regions): Ditto. * infcall.c (find_function_addr): Ditto. * printcmd.c (sym_info): Ditto. * symfile.c (overlay_invalidate_all, find_pc_overlay, find_pc_mapped_section, list_overlays_command, map_overlay_command, unmap_overlay_command): Ditto. * xcoffread.c (read_xcoff_symtab): Ditto. gdbserver: 2010-11-19 Phil Muldoon * linux-x86-low.c (ATTR_NOINLINE_NOCLONE): Define. (add_insns): Use ATTR_NOLINE_NOCLONE. -- diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 52a89de..7045cb9 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -2134,10 +2134,15 @@ cris_software_single_step (struct frame_info *frame) struct gdbarch *gdbarch = get_frame_arch (frame); struct address_space *aspace = get_frame_address_space (frame); inst_env_type inst_env; + int status; + + /* GCC -fprofile-use warning. */ + memset (&inst_env, 0, sizeof (inst_env)); /* Analyse the present instruction environment and insert breakpoints. */ - int status = find_step_target (frame, &inst_env); + status = find_step_target (frame, &inst_env); + if (status == -1) { /* Could not find a target. Things are likely to go downhill diff --git a/gdb/gcore.c b/gdb/gcore.c index 9fc0a7f..e45a8df 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -465,7 +465,7 @@ objfile_find_memory_regions (find_memory_region_ftype func, void *obfd) { /* Use objfile data to create memory sections. */ struct objfile *objfile; - struct obj_section *objsec; + struct obj_section *objsec = NULL; /* GCC -fprofile-use warning. */ bfd_vma temp_bottom, temp_top; /* Call callback function for each objfile section. */ diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c index 49e9e55..bfd4698 100644 --- a/gdb/gdbserver/linux-x86-low.c +++ b/gdb/gdbserver/linux-x86-low.c @@ -89,6 +89,12 @@ static const char *xmltarget_amd64_linux_no_xml = "@\ #define ARCH_GET_GS 0x1004 #endif +#if defined(__GNUC__) +# define ATTR_NOINLINE_NOCLONE __attribute__((noinline, noclone)) +#else +# define ATTR_NOINLINE_NOCLONE +#endif + /* Per-process arch-specific data we want to keep. */ struct arch_process_info @@ -1520,7 +1526,7 @@ x86_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr, adjusted_insn_addr_end); } -static void +static void ATTR_NOINLINE_NOCLONE add_insns (unsigned char *start, int len) { CORE_ADDR buildaddr = current_insn_ptr; diff --git a/gdb/infcall.c b/gdb/infcall.c index 7f60e56..0f63baf 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -235,7 +235,7 @@ find_function_addr (struct value *function, struct type **retval_type) struct gdbarch *gdbarch = get_type_arch (ftype); enum type_code code = TYPE_CODE (ftype); struct type *value_type = NULL; - CORE_ADDR funaddr; + CORE_ADDR funaddr = 0; /* GCC -fprofile-use warning. */ /* If it's a member function, just look at the function part of it. */ diff --git a/gdb/macroexp.c b/gdb/macroexp.c index 86689c3..972e953 100644 --- a/gdb/macroexp.c +++ b/gdb/macroexp.c @@ -1184,6 +1184,9 @@ expand (const char *id, struct macro_buffer va_arg_name; int is_varargs = 0; + /* GCC false -fprofile-use warning. */ + memset (&va_arg_name, 0, sizeof (va_arg_name)); + if (def->argc >= 1) { if (strcmp (def->argv[def->argc - 1], "...") == 0) diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 5586767..a518958 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1089,7 +1089,7 @@ sym_info (char *arg, int from_tty) { struct minimal_symbol *msymbol; struct objfile *objfile; - struct obj_section *osect; + struct obj_section *osect = NULL; /* GCC -fprofile-use warning. */ CORE_ADDR addr, sect_addr; int matches = 0; unsigned int offset; diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index 2b67927..bd06950 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -273,7 +273,7 @@ send_three_arg_cmd (unsigned char cmd, unsigned long arg1, unsigned long arg2, static unsigned char recv_char_data (void) { - unsigned char val; + unsigned char val = 0; /* GCC -fprofile-use warning. */ recv_data (&val, 1); return val; diff --git a/gdb/symfile.c b/gdb/symfile.c index f1c2941..098962b 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2872,7 +2872,7 @@ static void overlay_invalidate_all (void) { struct objfile *objfile; - struct obj_section *sect; + struct obj_section *sect = NULL; /* GCC -fprofile-use warning. */ ALL_OBJSECTIONS (objfile, sect) if (section_is_overlay (sect)) @@ -3050,7 +3050,8 @@ struct obj_section * find_pc_overlay (CORE_ADDR pc) { struct objfile *objfile; - struct obj_section *osect, *best_match = NULL; + /* GCC -fprofile-use warning. Set to NULL*/ + struct obj_section *osect = NULL, *best_match = NULL; if (overlay_debugging) ALL_OBJSECTIONS (objfile, osect) @@ -3077,7 +3078,7 @@ struct obj_section * find_pc_mapped_section (CORE_ADDR pc) { struct objfile *objfile; - struct obj_section *osect; + struct obj_section *osect = NULL; /* GCC -fprofile-use warning. */ if (overlay_debugging) ALL_OBJSECTIONS (objfile, osect) @@ -3095,7 +3096,7 @@ list_overlays_command (char *args, int from_tty) { int nmapped = 0; struct objfile *objfile; - struct obj_section *osect; + struct obj_section *osect = NULL; /* GCC -fprofile-use warning. */ if (overlay_debugging) ALL_OBJSECTIONS (objfile, osect) @@ -3134,7 +3135,9 @@ void map_overlay_command (char *args, int from_tty) { struct objfile *objfile, *objfile2; - struct obj_section *sec, *sec2; + /* GCC -fprofile-use warning. Set to NULL*/ + struct obj_section *sec = NULL, *sec2 = NULL; + if (!overlay_debugging) error (_("\ @@ -3179,7 +3182,7 @@ void unmap_overlay_command (char *args, int from_tty) { struct objfile *objfile; - struct obj_section *sec; + struct obj_section *sec = NULL; /* GCC-fprofile-use warning. */ if (!overlay_debugging) error (_("\ diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 902d48f..196fec1 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -961,6 +961,9 @@ read_xcoff_symtab (struct partial_symtab *pst) CORE_ADDR last_csect_val; int last_csect_sec; + /* GCC -fprofile-use warning. */ + memset (&fcn_aux_saved, 0, sizeof (fcn_aux_saved)); + this_symtab_psymtab = pst; /* Get the appropriate COFF "constants" related to the file we're