From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29631 invoked by alias); 13 Jan 2011 07:30:56 -0000 Received: (qmail 29620 invoked by uid 22791); 13 Jan 2011 07:30:55 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mgw-da01.ext.nokia.com (HELO mgw-da01.nokia.com) (147.243.128.24) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 13 Jan 2011 07:30:50 +0000 Received: from gar.localnet (bettdhcp167183.europe.nokia.com [172.25.167.183]) by mgw-da01.nokia.com (Switch-3.4.3/Switch-3.4.3) with ESMTP id p0D7UhDg021371; Thu, 13 Jan 2011 09:30:43 +0200 From: =?iso-8859-1?q?Andr=E9_P=F6nitz?= To: "anton@mips.complang.tuwien.ac.at" Subject: Re: Dealing with version-specific syntax Date: Thu, 13 Jan 2011 07:30:00 -0000 User-Agent: KMail/1.13.2 (Linux/2.6.32-21-generic; KDE/4.4.2; i686; ; ) References: <20110112192750.GA30525@a4.complang.tuwien.ac.at> In-Reply-To: <20110112192750.GA30525@a4.complang.tuwien.ac.at> Cc: gdb@sourceware.org MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201101130833.40498.andre.poenitz@nokia.com> X-Nokia-AV: Clean X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-01/txt/msg00041.txt.bz2 On Wednesday 12 January 2011 20:27:50 ext Anton Ertl wrote: > What I am trying to do: Get the disassembly for a specific address > range. And I try to do it with gdb. The problem here ist that as far > as I can tell, up to gdb-7.0 the way to do this is > > disassemble 0x404E22 0x404E40 > > Starting from gdb-7.1, this syntax is invalid, and instead we have to > use > > disassemble 0x404E22,0x404E40 > > Unfortunately, this syntax does something else in gdb-7.0 and earlier > (it disassembles whole functions). > > Is there a good way inside gdb for deciding which syntax to use? > Ideally, I would test if the space-separated syntax works, and use it > if it does, and otherwise use the comma-syntax. Or I might test for > the gdb version and use the syntax depending on that. That's unfortunately not necessarily a safe approach as gdb version strings can be virtually anything. Some distributors get really creative there ;-} > If there is no easy way, we will probably take the approach of testing > the gdb version outside of gdb. You could decide what syntax to use in the same session before loading a file: disassemble 0 1 will produce either Dump of assembler code from 0x0 to 0x1: 0x00000000: Cannot access memory at address 0x0 or A syntax error in expression, near `1'. Andre'