From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13853 invoked by alias); 11 Dec 2012 14:35:14 -0000 Received: (qmail 12860 invoked by uid 22791); 11 Dec 2012 14:35:10 -0000 X-SWARE-Spam-Status: No, hits=-4.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-bk0-f41.google.com (HELO mail-bk0-f41.google.com) (209.85.214.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 11 Dec 2012 14:35:04 +0000 Received: by mail-bk0-f41.google.com with SMTP id jg9so1826137bkc.0 for ; Tue, 11 Dec 2012 06:35:02 -0800 (PST) Received: by 10.204.12.220 with SMTP id y28mr6629365bky.112.1355236502722; Tue, 11 Dec 2012 06:35:02 -0800 (PST) MIME-Version: 1.0 Received: by 10.204.226.140 with HTTP; Tue, 11 Dec 2012 06:34:21 -0800 (PST) In-Reply-To: <50C70C60.6080707@redhat.com> References: <87txryx36w.fsf@fleche.redhat.com> <50C1BD45.9080709@redhat.com> <87zk1lel8o.fsf@fleche.redhat.com> <50C70C60.6080707@redhat.com> From: Hui Zhu Date: Tue, 11 Dec 2012 14:35:00 -0000 Message-ID: Subject: Re: [PATCH] Add fseek to ui-file To: Pedro Alves Cc: Tom Tromey , gdb-patches ml , Hui Zhu Content-Type: text/plain; charset=ISO-8859-1 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: 2012-12/txt/msg00328.txt.bz2 On Tue, Dec 11, 2012 at 6:35 PM, Pedro Alves wrote: > On 12/10/2012 07:54 PM, Tom Tromey wrote: >>>>>>> "Hui" == Hui Zhu writes: >> >> Pedro> I think that if we want to support error handling, then this should >> Pedro> return the fseek result to the caller instead of throwing an exception. >> Pedro> See e.g., the comment in stdio_file_write. >> >> I wonder whether that comment is correct. > > http://sourceware.org/ml/gdb-patches/2008-12/msg00260.html > > And if that didn't crash that way, I think we'd end up with > infinite recursion: > > error > -> ui-file (output exception text) > -> that fails > -> error > -> ui-file (output exception text) > -> that fails > ... > > -- > Pedro Alves > What about add a flag to struct stdio_file to record the error in this fd. When stdio_file_xxx get error, set it and throw error. Each stdio_file_xxx function check this flag before do syscall. If this fd get error, just return. Then stdio_file_xxx can throw error. Thanks, Hui