From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16038 invoked by alias); 14 Jan 2009 04:47:02 -0000 Received: (qmail 16026 invoked by uid 22791); 14 Jan 2009 04:47:01 -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; Wed, 14 Jan 2009 04:46:25 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 7C3992A96A1 for ; Tue, 13 Jan 2009 23:46:23 -0500 (EST) 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 z6XvGOVJz7Wp for ; Tue, 13 Jan 2009 23:46:23 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 9592A2A968F for ; Tue, 13 Jan 2009 23:46:22 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 88474E7ACD; Wed, 14 Jan 2009 08:46:15 +0400 (RET) Date: Wed, 14 Jan 2009 04:47:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: Re: [RFA/windows] cast of address to DWORD warning (handle_unload_dll) Message-ID: <20090114044615.GA24105@adacore.com> References: <20090114034202.GF31296@adacore.com> <20090114042345.GA4556@ednor.casa.cgf.cx> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="V4b9U9vrdWczvw78" Content-Disposition: inline In-Reply-To: <20090114042345.GA4556@ednor.casa.cgf.cx> User-Agent: Mutt/1.4.2.2i 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-01/txt/msg00302.txt.bz2 --V4b9U9vrdWczvw78 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1650 > >2009-11-14 Joel Brobecker > > > > * windows-nat.c (handle_unload_dll): Use host_address to string > > in order to print the base address of the DLL that was unloaded. > > > >This one is hard to test, because it's supposed to never happen. > >So I tested it by, ahem, visual inspection (I learnt that expression > >at my first job, where we were producing safety critical software). > > I guess this is ok. I just changed other similar occurrences to %p. > Maybe all of those should also be changed for hobgoblinish consistency > or this one should be %p too. I don't mind changing the patch to using %p at all. The reason I avoided %p is because I was still in this frame of mind that %p depends on the implementation - to have consistent output, we have to be careful to not use %p in the core code. However, I just realized that it's not necessarily a problem to do so in nat files. I did double-check what %p does on Windows, though, and apparently it does not output the leading 0x (but that's only a detail), but also it prints the hexa digits in capital letters. This may be from not being used to seeing addresses printed with capital letters, but I find it harder to read. On the other hand, I have seen this style being used in stack dumps printed by Windows, so this may be the usual style on this OS. For now, I think it's important to be consistent, so here is a new patch that uses %p (no leading 0x). 2009-01-14 Joel Brobecker * windows-nat.c (handle_unload_dll): Use %p to print the DLL base address instead of casting it to DWORD. -- Joel --V4b9U9vrdWczvw78 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="handle_unload.diff" Content-length: 367 diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 724c18f..7e43f87 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -761,7 +761,7 @@ handle_unload_dll (void *dummy) return 1; } - error (_("Error: dll starting at 0x%lx not found."), (DWORD) lpBaseOfDll); + error (_("Error: dll starting at %p not found."), lpBaseOfDll); return 0; } --V4b9U9vrdWczvw78--