From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22031 invoked by alias); 16 Apr 2009 23:57:48 -0000 Received: (qmail 22022 invoked by uid 22791); 16 Apr 2009 23:57:47 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Apr 2009 23:57:41 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id C1BDD2BAC23; Thu, 16 Apr 2009 19:57:39 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Q-Yvp4lnGY7T; Thu, 16 Apr 2009 19:57:39 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 8B3C82BABDA; Thu, 16 Apr 2009 19:57:39 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 2AECAF58C1; Thu, 16 Apr 2009 16:57:35 -0700 (PDT) Date: Thu, 16 Apr 2009 23:57:00 -0000 From: Joel Brobecker To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: [RFA] print error message if (auto) disassembly failed Message-ID: <20090416235735.GO7585@adacore.com> References: <20090416173918.GP7557@adacore.com> <834owolc51.fsf@gnu.org> <20090416180146.GH7585@adacore.com> <831vrslb0f.fsf@gnu.org> <20090416190654.GJ7585@adacore.com> <83vdp4jn6j.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ZPt4rx8FFjLCG7dd" Content-Disposition: inline In-Reply-To: <83vdp4jn6j.fsf@gnu.org> User-Agent: Mutt/1.5.18 (2008-05-17) 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: 2009-04/txt/msg00404.txt.bz2 --ZPt4rx8FFjLCG7dd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 826 > OK, but your suggested message text is too long, I think. Something > shorter, like "(address unreadable)" is better, IMO. Frankly, I think this is overkill - even with the 64bit addresses the line was still less than 70 characters long. But I'm not going to argue. Here you go: (gdb) core core warning: core file may not match specified executable file. Core was generated by `./crash'. Program terminated with signal 6, Aborted. #0 0x00007fe6fe543307 in ?? () 0x00007fe6fe543307: (cannot read memory) 2009-04-17 Joel Brobecker * stack.c (do_gdb_disassembly): Print an error message if an error was thrown while trying to perform the disassembly. I'm currently testing this patch on x86_64-linux, but I don't really expect any problem. -- Joel --ZPt4rx8FFjLCG7dd Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="stack.diff" Content-length: 1128 commit de33df66fc64edf55aa81a7d08adccf911aa4fdf Author: Joel Brobecker Date: Tue Apr 14 15:23:25 2009 -0700 * stack.c (do_gdb_disassembly): Print an error message if an error was thrown while trying to perform the disassembly. diff --git a/gdb/stack.c b/gdb/stack.c index dfe3900..bbeff2c 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -507,6 +507,21 @@ do_gdb_disassembly (int how_many, CORE_ADDR low, CORE_ADDR high) { gdb_disassembly_stub (&args); } + /* If an exception was thrown while doing the disassembly, print + the error message, to give the user a clue of what happened. */ + if (exception.reason == RETURN_ERROR) + { + if (exception.error == MEMORY_ERROR) + { + /* For memory errors, prefer a short error message over + the error message provided in the exception. */ + gdb_flush (gdb_stdout); + gdb_flush (gdb_stderr); + fprintf_filtered (gdb_stderr, _("(cannot read memory)\n")); + } + else + exception_print (gdb_stderr, exception); + } } /* Print information about frame FRAME. The output is format according --ZPt4rx8FFjLCG7dd--