From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24139 invoked by alias); 18 Oct 2007 19:38:51 -0000 Received: (qmail 24130 invoked by uid 22791); 18 Oct 2007 19:38:51 -0000 X-Spam-Check-By: sourceware.org Received: from ik-out-1112.google.com (HELO ik-out-1112.google.com) (66.249.90.178) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 18 Oct 2007 19:38:47 +0000 Received: by ik-out-1112.google.com with SMTP id b32so139052ika for ; Thu, 18 Oct 2007 12:38:44 -0700 (PDT) Received: by 10.78.200.3 with SMTP id x3mr766988huf.1192736324347; Thu, 18 Oct 2007 12:38:44 -0700 (PDT) Received: by 10.78.154.10 with HTTP; Thu, 18 Oct 2007 12:38:44 -0700 (PDT) Message-ID: <7aa837f80710181238o4aa3e19djffe5324df65e5928@mail.gmail.com> Date: Thu, 18 Oct 2007 19:38:00 -0000 From: "Grzegorz Cieslewski" To: gdb@sourceware.org Subject: Re: Setting a floating point register to raw hex value In-Reply-To: <7aa837f80710120829y33db4c3cya21f6ead14ca56f3@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <7aa837f80710120829y33db4c3cya21f6ead14ca56f3@mail.gmail.com> X-Google-Sender-Auth: 4cd8d8fdaf12c3a1 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: 2007-10/txt/msg00155.txt.bz2 I have figured out a workaround but it is really ugly. Step 1: Create shared object containing a union as follows union longlong2double { long long int hexNum; double floatNum; } temp; Step 2: Force load the library at runtime into your program using LD_PRELOAD environmental variable Step 3: When debugging the program store 0x1 into temp.hexNum; (one would think that I could use the following now 'set $f0 = temp.floatNum; but that yields incorrect result) Step4: Overwrite the current instruction with 'load float' Step5: Using stepping command 'stepi 1' to write the value to the $f0 Step6: Undo all the changes required by steps 4 and 5 Does any one know of a simpler way because this workaround is crazy? Greg Cieslewski On 10/12/07, Grzegorz Cieslewski wrote: > Does any one know of a way to set a floating point register ($f0) to a > arbitrary raw hex value (for example 1) > > I tried the following. > > (gdb) set $f0 = 5.0000000000000000e-324 > (gdb) p $f0 > $1 = -1.5966722476277758e+293 > (gdb) set $f0 = 5.0000000000000000e-324 > > The value of 5.0000000000000000e-324 should correspond to > 0x0000000000000001 in raw hex > > Any ideas? > > I am using ppc7450 (G4) if that helps. >