From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14422 invoked by alias); 14 Dec 2008 18:26:35 -0000 Received: (qmail 14408 invoked by uid 22791); 14 Dec 2008 18:26:34 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 14 Dec 2008 18:25:57 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id mBEIPtUo004931 for ; Sun, 14 Dec 2008 13:25:55 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id mBEIPtEm027211 for ; Sun, 14 Dec 2008 13:25:55 -0500 Received: from host0.dyn.jankratochvil.net (sebastian-int.corp.redhat.com [172.16.52.221]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id mBEIPr9e009214 for ; Sun, 14 Dec 2008 13:25:54 -0500 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id mBEIPpuv028295; Sun, 14 Dec 2008 19:25:52 +0100 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.2/Submit) id mBEIPpXh028292; Sun, 14 Dec 2008 19:25:51 +0100 Date: Sun, 14 Dec 2008 18:26:00 -0000 From: Jan Kratochvil To: Jim Blandy Cc: gdb-patches@sources.redhat.com Subject: Re: RFA: Building GDB under GLIBC 2.8 [resend w/the patch] Message-ID: <20081214182551.GA28287@host0.dyn.jankratochvil.net> References: <8f2776cb0812121804n1008f921h3898bb7bda1581c9@mail.gmail.com> <20081214182514.GA28215@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="M9NhX3UHpAaciwkO" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20081214182514.GA28215@host0.dyn.jankratochvil.net> User-Agent: Mutt/1.5.18 (2008-05-17) 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: 2008-12/txt/msg00260.txt.bz2 --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-length: 3851 Hi Jim, [ attaching this time ] FYI that part for "ui-file.c" crashes GDB on the testsuite as when the GDB is existing it has already closed its output. Testsuite results are not changed (as GDB output is already ignored that time) but many core files start to be generated. Attaching a possible replacement for that ui-file.c part: When GDB cannot write to its output IMO some message about it is no longer of much use. Regards, Jan Program terminated with signal 11, Segmentation fault. [New process 9576] #0 0x00000000006024ff in exceptions_state_mc (action=CATCH_THROWING) at exceptions.c:125 125 switch (current_catcher->state) (gdb) p current_catcher $1 = (struct catcher *) 0x0 (gdb) bt #0 0x00000000006024ff in exceptions_state_mc (action=CATCH_THROWING) at exceptions.c:125 #1 0x0000000000602808 in throw_exception (exception= {reason = RETURN_ERROR, error = GENERIC_ERROR, message = 0x3776910 "stdio_file_fputs: Input/output error"}) at exceptions.c:235 #2 0x0000000000602c29 in throw_it (reason=RETURN_ERROR, error=GENERIC_ERROR, fmt=0xc8224b "stdio_file_fputs: %s", ap=0x7fff750c9f80) at exceptions.c:396 #3 0x0000000000602c51 in throw_verror (error=GENERIC_ERROR, fmt=0xc8224b "stdio_file_fputs: %s", ap=0x7fff750c9f80) at exceptions.c:402 #4 0x000000000047a466 in error (string=0xc8224b "stdio_file_fputs: %s") at utils.c:796 #5 0x000000000047f7a7 in stdio_file_fputs (linebuffer=0x376e900 '\225' , "�\225\225�", file=0x2f31e20) at ui-file.c:496 #6 0x000000000047efbd in fputs_unfiltered (buf=0x376e900 '\225' , "�\225\225�", file=0x2f31e20) at ui-file.c:211 #7 0x000000000047c36c in fputs_maybe_filtered (linebuffer=0x376e900 '\225' , "�\225\225�", stream=0x2f31e20, filter=1) at utils.c:2028 #8 0x000000000047c5be in fputs_filtered (linebuffer=0x376e900 '\225' , "�\225\225�", stream=0x2f31e20) at utils.c:2119 #9 0x0000000000602960 in print_exception (file=0x2f31e20, e= {reason = RETURN_ERROR, error = GENERIC_ERROR, message = 0x376e900 '\225' , "�\225\225�"}) at exceptions.c:306 #10 0x0000000000602bc5 in print_any_exception (file=0x2f31e20, prefix=0xc7df05 "", e= {reason = RETURN_ERROR, error = GENERIC_ERROR, message = 0x376e900 '\225' , "�\225\225�"}) at exceptions.c:373 #11 0x0000000000602fbd in catch_errors (func=0x46fc27 , func_args=0x7fff750ca200, errstring=0xc7df05 "", mask=6) at exceptions.c:518 #12 0x0000000000470cdd in gdb_main (args=0x7fff750ca200) at .././gdb/main.c:840 #13 0x000000000046fbe0 in main (argc=3, argv=0x7fff750ca2f8) at gdb.c:33 On Sat, 13 Dec 2008 03:04:47 +0100, Jim Blandy wrote: > From: Jim Blandy ... > * ui-file.c (stdio_file_write): Check return value from fwrite. > (stdio_file_fputs): Check return value from fputs. ... > diff --git a/gdb/ui-file.c b/gdb/ui-file.c > index 9a1d892..2ed304f 100644 > --- a/gdb/ui-file.c > +++ b/gdb/ui-file.c > @@ -481,7 +481,8 @@ stdio_file_write (struct ui_file *file, const char *buf, long length_buf) > if (stdio->magic != &stdio_file_magic) > internal_error (__FILE__, __LINE__, > _("stdio_file_write: bad magic number")); > - fwrite (buf, length_buf, 1, stdio->file); > + if (fwrite (buf, length_buf, 1, stdio->file) != 1) > + error ("stdio_file_write: %s", safe_strerror (errno)); > } > > static void > @@ -491,7 +492,8 @@ stdio_file_fputs (const char *linebuffer, struct ui_file *file) > if (stdio->magic != &stdio_file_magic) > internal_error (__FILE__, __LINE__, > _("stdio_file_fputs: bad magic number")); > - fputs (linebuffer, stdio->file); > + if (fputs (linebuffer, stdio->file) == EOF) > + error ("stdio_file_fputs: %s", safe_strerror (errno)); > } > > static int --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename=2j Content-length: 861 --- gdb/ui-file.c 1 Jan 2008 22:53:13 -0000 1.15 +++ gdb/ui-file.c 14 Dec 2008 18:16:56 -0000 @@ -481,7 +481,9 @@ stdio_file_write (struct ui_file *file, if (stdio->magic != &stdio_file_magic) internal_error (__FILE__, __LINE__, _("stdio_file_write: bad magic number")); - fwrite (buf, length_buf, 1, stdio->file); + /* Calling error crashes when we are called from the exception framework. */ + if (fwrite (buf, length_buf, 1, stdio->file)) + ; } static void @@ -491,7 +493,9 @@ stdio_file_fputs (const char *linebuffer if (stdio->magic != &stdio_file_magic) internal_error (__FILE__, __LINE__, _("stdio_file_fputs: bad magic number")); - fputs (linebuffer, stdio->file); + /* Calling error crashes when we are called from the exception framework. */ + if (fputs (linebuffer, stdio->file)) + ; } static int --M9NhX3UHpAaciwkO--