This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RFA: remote.c (remote_send): Do not assume what to do on error


remote_send() makes assumptions about what the caller wants to do about
errors reported by the stub.  And it assumes it should longjump!

I believe it should just return the error code (in the buffer) and let
the caller decide.  The patch below makes this change and adds a test for
the error in the only place it makes sense to do it.


        * remote.c (remote_send): Do not call error(). Do not assume what
        the caller wants to do on an error condition.  Just return the
        buffer with the error code.
        (store_register_using_P): Test for write register result.



-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9



Index: remote.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/remote.c,v
retrieving revision 1.277.8.9
retrieving revision 1.277.8.10
diff -c -p -r1.277.8.9 -r1.277.8.10
*** remote.c    2000/07/22 02:56:42     1.277.8.9
--- remote.c    2000/11/03 21:44:52     1.277.8.10
*************** store_register_using_P (int regno)
*** 3231,3236 ****
--- 3231,3239 ----
    *p = '\0';
    remote_send (buf, PBUFSIZ);

+   if (buf[0] == 'E')
+     warning ("Could not store register (Remote failure reply: %s)", buf);
+
    return buf[0] != '\0';
  }

*************** remote_send (char *buf,
*** 3815,3823 ****
  {
    putpkt (buf);
    getpkt (buf, sizeof_buf, 0);
-
-   if (buf[0] == 'E')
-     error ("Remote failure reply: %s", buf);
  }

  /* Display a null-terminated packet on stdout, for debugging, using C
--- 3818,3823 ----

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]