From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19925 invoked by alias); 13 May 2011 11:07:20 -0000 Received: (qmail 19917 invoked by uid 22791); 13 May 2011 11:07:19 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,TW_CP,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 13 May 2011 11:07:05 +0000 Received: (qmail 672 invoked from network); 13 May 2011 11:07:04 -0000 Received: from unknown (HELO ?192.168.0.102?) (yao@127.0.0.2) by mail.codesourcery.com with ESMTPA; 13 May 2011 11:07:04 -0000 Message-ID: <4DCD10CC.6030801@codesourcery.com> Date: Fri, 13 May 2011 11:07:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [patch, testsuite] store memory address in unsigned type Content-Type: multipart/mixed; boundary="------------030303090402080906030400" X-IsSubscribed: yes 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: 2011-05/txt/msg00322.txt.bz2 This is a multi-part message in MIME format. --------------030303090402080906030400 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-length: 316 In gdb.trace/tfile.c:add_memory_block(), we store memory address in long, and assign (extend) to long long. It is not correct if the MSB of address is 1, and signed extension will fill the upper 32-bit of long long with 1, which is not what we want here. This patch is to use unsigned type. OK? -- Yao (齐尧) --------------030303090402080906030400 Content-Type: text/x-patch; name="unsigned_address.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="unsigned_address.patch" Content-length: 803 gdb/testsuite/ 2011-05-13 Yao Qi * gdb.trace/tfile.c (add_memory_block): Store address in unsigned type. Index: testsuite/gdb.trace/tfile.c =================================================================== --- testsuite/gdb.trace/tfile.c (revision 325446) +++ testsuite/gdb.trace/tfile.c (working copy) @@ -49,13 +49,13 @@ add_memory_block (char *addr, int size) { short short_x; - long long ll_x; + unsigned long long ll_x; *((char *) trptr) = 'M'; trptr += 1; - ll_x = (long) addr; - memcpy (trptr, &ll_x, sizeof (long long)); - trptr += sizeof (long long); + ll_x = (unsigned long) addr; + memcpy (trptr, &ll_x, sizeof (unsigned long long)); + trptr += sizeof (unsigned long long); short_x = size; memcpy (trptr, &short_x, 2); trptr += 2; --------------030303090402080906030400--