From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4469 invoked by alias); 26 Jan 2010 21:04:53 -0000 Received: (qmail 4405 invoked by uid 22791); 26 Jan 2010 21:04:52 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 26 Jan 2010 21:04:48 +0000 Received: from spaceape14.eur.corp.google.com (spaceape14.eur.corp.google.com [172.28.16.148]) by smtp-out.google.com with ESMTP id o0QL4je2009158 for ; Tue, 26 Jan 2010 13:04:46 -0800 Received: from fxm24 (fxm24.prod.google.com [10.184.13.24]) by spaceape14.eur.corp.google.com with ESMTP id o0QL4iMu004208 for ; Tue, 26 Jan 2010 13:04:44 -0800 Received: by fxm24 with SMTP id 24so1015312fxm.15 for ; Tue, 26 Jan 2010 13:04:44 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.186.12 with SMTP id v12mr1249140wem.75.1264539883385; Tue, 26 Jan 2010 13:04:43 -0800 (PST) In-Reply-To: References: <20100114101348.GA24756@host0.dyn.jankratochvil.net> <20100119075642.GA30154@host0.dyn.jankratochvil.net> Date: Tue, 26 Jan 2010 21:04:00 -0000 Message-ID: Subject: Re: [RFA] Show some tips when file cmd get bfd_error_file_ambiguously_recognized From: Doug Evans To: Hui Zhu Cc: Jan Kratochvil , gdb-patches ml , Tristan Gingold , Daniel Jacobowitz Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true 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-01/txt/msg00578.txt.bz2 On Tue, Jan 26, 2010 at 12:01 AM, Hui Zhu wrote: > About this patch. =A0There are a lot of function call "bfd_check_format". > > What about add a wrapper of "bfd_check_format_matches" to gdb. =A0This > wrapper call "bfd_check_format_matches" and if it get > bfd_error_file_ambiguously_recognized, output the format and other > help message before it return. > Change the "bfd_check_format" to the wrapper. > > Then when gdb get bfd_error_file_ambiguously_recognized, putput the > help message directly. > > What do you think about it? AIUC, At first glance I don't like it. "Detect errors at a low level, handle them at a high level." [ref: "The Practice of Programming"] Replacing all calls to bfd_check_format with something that prints anything is the wrong way to go (bfd_check_format, or its wrapper is too low a level). Unless by "output the format and other help message before it return" you mean to just compute the message and leave it to some higher level caller to print it. If that's the case I think I'd just add a new function to compute the error message for the error printer to use.