public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: GDB Patches <gdb-patches@sourceware.org>
Subject: [ob/pushed] gdbserver/proc-service.c: bogus return value conversion
Date: Thu, 27 Aug 2015 12:37:00 -0000	[thread overview]
Message-ID: <55DF0495.5090208@redhat.com> (raw)

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 <palves@redhat.com>
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  <palves@redhat.com>

	* 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  <palves@redhat.com>
+
+	* proc-service.c (ps_pdwrite): Return PS_ERR/PS_OK explicily.
+
 2015-08-26  Simon Marchi  <simon.marchi@ericsson.com>
 
 	* 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
-- 
1.9.3

                 reply	other threads:[~2015-08-27 12:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55DF0495.5090208@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).