From patchwork Thu Aug 27 12:37:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 8476 Received: (qmail 49482 invoked by alias); 27 Aug 2015 12:37:46 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 49425 invoked by uid 89); 27 Aug 2015 12:37:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 27 Aug 2015 12:37:44 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 79E0BC1C49E9 for ; Thu, 27 Aug 2015 12:37:43 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7RCbgPW018694 for ; Thu, 27 Aug 2015 08:37:42 -0400 Message-ID: <55DF0495.5090208@redhat.com> Date: Thu, 27 Aug 2015 13:37:41 +0100 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: GDB Patches Subject: [ob/pushed] gdbserver/proc-service.c: bogus return value conversion And while I have the C++ branch checked out, I pushed this easy one to master... From 9d7993743ade7a632835b8809a400d01cc270c80 Mon Sep 17 00:00:00 2001 From: Pedro Alves Subject: [PATCH] gdbserver/proc-service.c: bogus return value conversion Building in C++ mode shows: int write_inferior_memory (CORE_ADDR memaddr, const unsigned char *myaddr, ^ src/gdb/gdbserver/proc-service.c:93:64: error: invalid conversion from ‘int’ to ‘ps_err_e’ [-fpermissive] return write_inferior_memory ((unsigned long) addr, buf, size); ^ It only works today by accident, write_inferior_memory does not return a ps_err_e. gdb/gdbserver/ChangeLog: 2015-08-27 Pedro Alves * proc-service.c (ps_pdwrite): Return PS_ERR/PS_OK explicily. --- gdb/gdbserver/ChangeLog | 4 ++++ gdb/gdbserver/proc-service.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 5b9b170..0be3030 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,7 @@ +2015-08-27 Pedro Alves + + * proc-service.c (ps_pdwrite): Return PS_ERR/PS_OK explicily. + 2015-08-26 Simon Marchi * ax.c (gdb_parse_agent_expr): Likewise. diff --git a/gdb/gdbserver/proc-service.c b/gdb/gdbserver/proc-service.c index f36e3fb..128939d 100644 --- a/gdb/gdbserver/proc-service.c +++ b/gdb/gdbserver/proc-service.c @@ -90,7 +90,9 @@ ps_err_e ps_pdwrite (gdb_ps_prochandle_t ph, psaddr_t addr, gdb_ps_write_buf_t buf, gdb_ps_size_t size) { - return write_inferior_memory ((unsigned long) addr, buf, size); + if (write_inferior_memory ((unsigned long) addr, buf, size) != 0) + return PS_ERR; + return PS_OK; } /* Get the general registers of LWP LWPID within the target process PH