From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22414 invoked by alias); 27 Aug 2007 16:16:26 -0000 Received: (qmail 22368 invoked by uid 22791); 27 Aug 2007 16:16:25 -0000 X-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DK_POLICY_SIGNSOME,SPF_HELO_PASS,SPF_PASS,TW_FH X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 27 Aug 2007 16:16:20 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.1/8.13.1) with ESMTP id l7RGGJxd028199 for ; Mon, 27 Aug 2007 12:16:19 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l7RGGIev010461 for ; Mon, 27 Aug 2007 12:16:18 -0400 Received: from [127.0.0.1] (sebastian-int.corp.redhat.com [172.16.52.221]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l7RGGHB2030185; Mon, 27 Aug 2007 12:16:17 -0400 Message-ID: <46D2F8EA.4090700@redhat.com> Date: Mon, 27 Aug 2007 16:16:00 -0000 From: Andrew Cagney User-Agent: Thunderbird 1.5.0.12 (X11/20070530) MIME-Version: 1.0 To: Chris Moller CC: frysk@sourceware.org Subject: Re: -format options References: <46D2F057.7050901@redhat.com> <46D2F498.9000407@redhat.com> In-Reply-To: <46D2F498.9000407@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact frysk-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-owner@sourceware.org X-SW-Source: 2007-q3/txt/msg00352.txt.bz2 Chris Moller wrote: > Any reason you couldn't just pass a kind of printf format string to > -format. E.g., > > print 1.0 "%g 0x%08x" > > would print the value first as a double--1.0--and then again in hex. > (Unlike printf, each % substitution would refer to the same value.) > interesting idea; I'm not sure how well it will interact with more complex values for instance: (fhpd) print a_struct { i = 1, f = 1.0 } and: (fhpd) print a_struct -format rx { i - 0x1, f = 0x3f800000 } however a separate << printf option list >> command might make for an interesting extension; for instance: (fhpd) printf "%x\n", a_struct 0x1, 0x3f800000 i.e., apply a printf format to all elements of the value. Andrew PS: The fhpd outlines the command << print -format >> > cm > > > Andrew Cagney wrote: > >> Hi, >> >> some questions, and ideas. >> >> What should the -format qualifier do when applied to floating point? >> For instance: >> (fhpd) print 1.0 -format x >> 0x1 >> i.e., convert the cooked value to decimal and then print in hex; or: >> (fhpd) print 1.0 -format x >> 0x3ff0000000000000 >> i.e., print the raw value in hex. I think the answer depends on the >> next question. >> >> What possible format options are there and how should they interact? >> Here's a possible list: >> bi[t]s, [o]ctal, [d]ecimal, he[x]adecimal, [f]loat, [v]alue (i.e., >> default) >> [r]aw, [c]ooked >> [b]ig-endian, [l]ittle-endian, [n]ative (for default) >> [s]igned, [u]nsigned, [i]nteger (for default???) >> reset: - >> are there others? I've tried to make each set largely orthogonal; >> does this work? Would other combinations be better? For >> signed/unsigned is there a better "default" to integer. Should >> [o][x][t] just imply unsigned? >> >> How should these options be specified; Either: >> -format rx >> or >> -format x -data r -order b >> for dumping each field in big-endian raw hex. I prefer the more terse >> former. >> >> > >