From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20459 invoked by alias); 29 Oct 2013 17:02:24 -0000 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 Received: (qmail 20445 invoked by uid 89); 29 Oct 2013 17:02:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: multi.imgtec.com Received: from multi.imgtec.com (HELO multi.imgtec.com) (194.200.65.239) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 29 Oct 2013 17:02:21 +0000 Message-ID: <1383066110.2558.177.camel@ubuntu-sellcey> Subject: Re: [PATCH] Avoid producing broken non-native core files From: Steve Ellcey To: "Maciej W. Rozycki" CC: Pedro Alves , Date: Tue, 29 Oct 2013 17:02:00 -0000 In-Reply-To: References: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-SEF-Processed: 7_3_0_01192__2013_10_29_17_02_18 X-SW-Source: 2013-10/txt/msg00902.txt.bz2 On Wed, 2013-10-23 at 23:03 +0100, Maciej W. Rozycki wrote: > Index: gdb-fsf-trunk-quilt/gdb/linux-tdep.c > =================================================================== > --- gdb-fsf-trunk-quilt.orig/gdb/linux-tdep.c 2013-10-21 12:15:29.727655132 +0100 > +++ gdb-fsf-trunk-quilt/gdb/linux-tdep.c 2013-10-21 12:15:53.727656870 +0100 > @@ -1209,14 +1209,15 @@ linux_corefile_thread_callback (struct t > args->note_data, args->note_size, > args->stop_signal); > > - if (siginfo_data != NULL) > - { > + /* Don't return anything if we got no register information above, > + such a core file is useless. */ > + if (args->note_data != NULL) > + if (siginfo_data != NULL) > args->note_data = elfcore_write_note (args->obfd, > args->note_data, > args->note_size, > "CORE", NT_SIGINFO, > siginfo_data, siginfo_size); > - } > > do_cleanups (old_chain); > } Maciej, I believe this change is the cause of a build failure for me when using an old GCC (4.1.2) to build gdb. I get: cc1: warnings being treated as errors /scratch/gcc/nightly/src/binutils-gdb/gdb/linux-tdep.c: In function 'linux_corefile_thread_callback': /scratch/gcc/nightly/src/binutils-gdb/gdb/linux-tdep.c:1196: warning: 'siginfo_size' may be used uninitialized in this function I do not get this error when using a newer GCC (like 4.4.3 or above). I can work around it by setting siginfo_size to 0 when it is declared. I don't know if there is a minimum GCC version required for building gdb but my build with GCC 4.1.2 used to work. Do you think initializing siginfo_size is reasonable to allow us to use older GCC's to build gdb? Steve Ellcey sellcey@mips.com