From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4597 invoked by alias); 5 Jun 2012 21:21:03 -0000 Received: (qmail 4589 invoked by uid 22791); 5 Jun 2012 21:21:02 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,TW_YM,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 05 Jun 2012 21:20:48 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q55LKlsU010957 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 5 Jun 2012 17:20:47 -0400 Received: from host2.jankratochvil.net (ovpn-116-47.ams2.redhat.com [10.36.116.47]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q55LKgi6021530 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 5 Jun 2012 17:20:45 -0400 Date: Tue, 05 Jun 2012 21:21:00 -0000 From: Jan Kratochvil To: Siddhesh Poyarekar Cc: gdb-patches@sourceware.org, Tom Tromey Subject: [commit] Change target_read_memory size_t->ssize_t [Re: [PATCH] Memory reads and writes should have size_t length] Message-ID: <20120605212042.GA31768@host2.jankratochvil.net> References: <20120531125320.65ad1f8f@spoyarek> <20120601174809.GA21938@host2.jankratochvil.net> <20120602012958.4a6d9a7c@spoyarek> <20120604215419.GA27980@host2.jankratochvil.net> <20120605084605.186d537a@spoyarek> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120605084605.186d537a@spoyarek> User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2012-06/txt/msg00159.txt.bz2 On Tue, 05 Jun 2012 05:16:05 +0200, Siddhesh Poyarekar wrote: > OK, thanks for the explanation. Updated patch attached. To align the previous change: commit a29f40b662a2626f877d7e9ca485af6c56959c35 2012-06-04 Jan Kratochvil * symfile-mem.c: 3 new gdb_static_assert for target_read_memory_bfd parameters. (target_read_memory_bfd): New function. (symbol_file_add_from_memory): Use it. which used size_t with the ssize_t style parameters checked in this patch. As there is now the target_read_memory_bfd stub the prototype no longer has to be exactly the same bfd/<->gdb/. tested on {x86_64,x86_64-m32}-fedora18pre-linux-gnu. Thanks, Jan http://sourceware.org/ml/gdb-cvs/2012-06/msg00037.html --- src/gdb/ChangeLog 2012/06/05 19:50:48 1.14327 +++ src/gdb/ChangeLog 2012/06/05 21:18:04 1.14328 @@ -1,3 +1,10 @@ +2012-06-05 Jan Kratochvil + + * symfile-mem.c: Change gdb_static_assert to ssize_t. + (target_read_memory_bfd): Cast gdb_assert LEN to ssize_t. + * target.c (target_read_memory): Change LEN to ssize_t. + * target.h (target_read_memory): Change LEN to ssize_t. + 2012-06-05 Pedro Alves PR backtrace/13866 --- src/gdb/symfile-mem.c 2012/06/04 14:35:25 1.27 +++ src/gdb/symfile-mem.c 2012/06/05 21:18:05 1.28 @@ -60,7 +60,7 @@ gdb_static_assert (sizeof (CORE_ADDR) == sizeof (bfd_vma)); gdb_static_assert (sizeof (gdb_byte) == sizeof (bfd_byte)); -gdb_static_assert (sizeof (size_t) <= sizeof (bfd_size_type)); +gdb_static_assert (sizeof (ssize_t) <= sizeof (bfd_size_type)); /* Provide bfd/ compatible prototype for target_read_memory. Casting would not be enough as LEN width may differ. */ @@ -69,8 +69,8 @@ target_read_memory_bfd (bfd_vma memaddr, bfd_byte *myaddr, bfd_size_type len) { /* MYADDR must be already allocated for the LEN size so it has to fit in - size_t. */ - gdb_assert ((size_t) len == len); + ssize_t. */ + gdb_assert ((ssize_t) len == len); return target_read_memory (memaddr, myaddr, len); } --- src/gdb/target.c 2012/06/01 16:37:59 1.308 +++ src/gdb/target.c 2012/06/05 21:18:05 1.309 @@ -1756,7 +1756,7 @@ it makes no progress, and then return how much was transferred). */ int -target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, size_t len) +target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len) { /* Dispatch to the topmost target, not the flattened current_target. Memory accesses check target->to_has_(all_)memory, and the --- src/gdb/target.h 2012/06/01 16:37:59 1.236 +++ src/gdb/target.h 2012/06/05 21:18:05 1.237 @@ -997,7 +997,7 @@ extern int target_read_string (CORE_ADDR, char **, int, int *); extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, - size_t len); + ssize_t len); extern int target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, int len);