From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29000 invoked by alias); 19 Jan 2010 07:01:47 -0000 Received: (qmail 28766 invoked by uid 22791); 19 Jan 2010 07:01:45 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-px0-f175.google.com (HELO mail-px0-f175.google.com) (209.85.216.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 19 Jan 2010 07:01:39 +0000 Received: by pxi5 with SMTP id 5so2825206pxi.12 for ; Mon, 18 Jan 2010 23:01:38 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.5.26 with SMTP id 26mr2917203wfe.210.1263884498117; Mon, 18 Jan 2010 23:01:38 -0800 (PST) In-Reply-To: <20100114101348.GA24756@host0.dyn.jankratochvil.net> References: <20100114101348.GA24756@host0.dyn.jankratochvil.net> From: Hui Zhu Date: Tue, 19 Jan 2010 07:01:00 -0000 Message-ID: Subject: Re: [RFA] Show some tips when file cmd get bfd_error_file_ambiguously_recognized To: Jan Kratochvil Cc: gdb-patches ml , Tristan Gingold , Daniel Jacobowitz Content-Type: multipart/mixed; boundary=00504502b0a18c46e7047d7f0a68 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/msg00464.txt.bz2 --00504502b0a18c46e7047d7f0a68 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-length: 2645 Thanks Jan. I make a new patch according to your mail. And keep the "formats". Because in before, we use "not in executable format". And in other program like nm.c size.c, they all use "format". So I think format is better. Hui 2010-01-19 Hui Zhu * exec.c (exec_file_attach): Output some tips when bfd_get_error is bfd_error_file_ambiguously_recognized. On Thu, Jan 14, 2010 at 18:13, Jan Kratochvil w= rote: > On Thu, 14 Jan 2010 03:43:58 +0100, Hui Zhu wrote: >> =A0exec_file_attach (char *filename, int from_tty) >> =A0{ >> + =A0char **matching; > > This new variable could be moved to one more inner block. > >> + =A0 =A0 =A0 =A0 =A0if (bfd_get_error () =3D=3D bfd_error_file_ambiguou= sly_recognized) >> + =A0 =A0 =A0 =A0 =A0 =A0{ >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0char **p =3D matching; > > There is commonly an empty line between declarations and first code line. > >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0fprintf_filtered (gdb_stderr, _("\"%s\":Mat= ching formats:"), >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0scratch= _pathname); > > Missing space before "Matching formats". > > Isn't it "Matching targets" instead? > > Anyway I would still prefer to print even bfd_errmsg() for it as it is no= w IMO > unclear why "Matching formats" has been printed and that any error occure= d: > >> "/ls":Matching formats: elf32-nbigmips elf32-ntradbigmips >> Use command "set gnutarget" handle it. > > >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0while (*p) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0fprintf_filtered (gdb_stderr, " %s", *p= ++); > > (Only a personal preference: for (p =3D matching; *p !=3D NULL; p++) > =A0as this is the most common iterating loop, nothing special to use `whi= le'.) > >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0fprintf_filtered (gdb_stderr, "\n"); > > (There exists also fputc_filtered.) > >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0free (matching); > > Use xfree (see gdbint); despite the memory does not come from xmalloc. > >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0error (_("Use command \"set gnutarget\" han= dle it.")); > > Missing "to" - "to handle it"; or just use _("Use command \"...\"."). > >> + =A0 =A0 =A0 =A0 =A0 =A0} >> + =A0 =A0 =A0 =A0 =A0else >> + =A0 =A0 =A0 =A0 error (_("\"%s\": not in executable format: %s"), >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0scratch_pathname, bfd_errmsg (bfd_get_e= rror ())); >> =A0 =A0 =A0 } >> >> =A0 =A0 =A0 =A0/* FIXME - This should only be run for RS6000, but the if= def is a poor > > Your patch has been sent with spaces (' ') instead of tabs ('\t') to foll= ow > the GNU coding style (not using `indent -nut'). > > > Regards, > Jan > --00504502b0a18c46e7047d7f0a68 Content-Type: text/plain; charset=US-ASCII; name="tips.txt" Content-Disposition: attachment; filename="tips.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_g4mcjcx90 Content-length: 2355 LS0tCiBleGVjLmMgfCAgIDIyICsrKysrKysrKysrKysrKysrKystLS0KIDEg ZmlsZSBjaGFuZ2VkLCAxOSBpbnNlcnRpb25zKCspLCAzIGRlbGV0aW9ucygt KQoKLS0tIGEvZXhlYy5jCisrKyBiL2V4ZWMuYwpAQCAtMjI1LDYgKzIyNSw3 IEBAIGV4ZWNfZmlsZV9hdHRhY2ggKGNoYXIgKmZpbGVuYW1lLCBpbnQgZnIK ICAgICAgIGNoYXIgKnNjcmF0Y2hfcGF0aG5hbWU7CiAgICAgICBpbnQgc2Ny YXRjaF9jaGFuOwogICAgICAgc3RydWN0IHRhcmdldF9zZWN0aW9uICpzZWN0 aW9ucyA9IE5VTEwsICpzZWN0aW9uc19lbmQgPSBOVUxMOworICAgICAgY2hh ciAqKm1hdGNoaW5nOwogCiAgICAgICBzY3JhdGNoX2NoYW4gPSBvcGVucCAo Z2V0ZW52ICgiUEFUSCIpLCBPUEZfVFJZX0NXRF9GSVJTVCwgZmlsZW5hbWUs CiAJCSAgIHdyaXRlX2ZpbGVzID8gT19SRFdSIHwgT19CSU5BUlkgOiBPX1JE T05MWSB8IE9fQklOQVJZLApAQCAtMjU5LDEzICsyNjAsMjggQEAgZXhlY19m aWxlX2F0dGFjaCAoY2hhciAqZmlsZW5hbWUsIGludCBmcgogICAgICAgc2Ny YXRjaF9wYXRobmFtZSA9IHhzdHJkdXAgKHNjcmF0Y2hfcGF0aG5hbWUpOwog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nXG4nLCBnZGJfc3RkZXJyKTsKKwkgICAgICB4ZnJlZSAobWF0Y2hp bmcpOworCSAgICAgIGVycm9yIChfKCJVc2UgY29tbWFuZCBcInNldCBnbnV0 YXJnZXQgZm9ybWF0X25hbWVcIiB0byBoYW5kbGUgaXQuIikpOworCSAgICB9 CisJICBlbHNlCisJICAgIGVycm9yIChfKCJcIiVzXCI6IG5vdCBpbiBleGVj dXRhYmxlIGZvcm1hdDogJXMiKSwKKwkJICAgc2NyYXRjaF9wYXRobmFtZSwg YmZkX2Vycm1zZyAoYmZkX2dldF9lcnJvciAoKSkpOwogCX0KIAogICAgICAg LyogRklYTUUgLSBUaGlzIHNob3VsZCBvbmx5IGJlIHJ1biBmb3IgUlM2MDAw LCBidXQgdGhlIGlmZGVmIGlzIGEgcG9vcgo= --00504502b0a18c46e7047d7f0a68--