| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2010 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #include <assert.h> | 7 #include <assert.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 | 10 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 116 } |
| 117 | 117 |
| 118 // Send the main payload | 118 // Send the main payload |
| 119 int offs = 0; | 119 int offs = 0; |
| 120 while ((ch = ptr[offs++]) != 0) { | 120 while ((ch = ptr[offs++]) != 0) { |
| 121 outstr << ch; | 121 outstr << ch; |
| 122 run_xsum += ch; | 122 run_xsum += ch; |
| 123 } | 123 } |
| 124 | 124 |
| 125 if (GetFlags() & DEBUG_SEND) { | 125 if (GetFlags() & DEBUG_SEND) { |
| 126 NaClLog(LOG_INFO, "TX %s\n", outstr.str().c_str()); | 126 NaClLog(1, "TX %s\n", outstr.str().c_str()); |
| 127 } | 127 } |
| 128 | 128 |
| 129 // Send XSUM as two nible 8bit value preceeded by '#' | 129 // Send XSUM as two nible 8bit value preceeded by '#' |
| 130 outstr << '#'; | 130 outstr << '#'; |
| 131 IntToNibble((run_xsum >> 4) & 0xF, &ch); | 131 IntToNibble((run_xsum >> 4) & 0xF, &ch); |
| 132 outstr << ch; | 132 outstr << ch; |
| 133 IntToNibble(run_xsum & 0xF, &ch); | 133 IntToNibble(run_xsum & 0xF, &ch); |
| 134 outstr << ch; | 134 outstr << ch; |
| 135 | 135 |
| 136 return io_->Write(outstr.str().data(), | 136 return io_->Write(outstr.str().data(), |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 if (!GetChar(&ch)) return false; | 180 if (!GetChar(&ch)) return false; |
| 181 | 181 |
| 182 int val; | 182 int val; |
| 183 NibbleToInt(ch, & val); | 183 NibbleToInt(ch, & val); |
| 184 fin_xsum = val << 4; | 184 fin_xsum = val << 4; |
| 185 | 185 |
| 186 if (!GetChar(&ch)) return false; | 186 if (!GetChar(&ch)) return false; |
| 187 NibbleToInt(ch, &val); | 187 NibbleToInt(ch, &val); |
| 188 fin_xsum |= val; | 188 fin_xsum |= val; |
| 189 | 189 |
| 190 if (GetFlags() & DEBUG_RECV) NaClLog(LOG_INFO, "RX %s\n", in.c_str()); | 190 if (GetFlags() & DEBUG_RECV) NaClLog(1, "RX %s\n", in.c_str()); |
| 191 | 191 |
| 192 pkt->ParseSequence(); | 192 pkt->ParseSequence(); |
| 193 | 193 |
| 194 // If ACKs are off, we are done. | 194 // If ACKs are off, we are done. |
| 195 if (GetFlags() & IGNORE_ACK) return true; | 195 if (GetFlags() & IGNORE_ACK) return true; |
| 196 | 196 |
| 197 // If the XSUMs don't match, signal bad packet | 197 // If the XSUMs don't match, signal bad packet |
| 198 if (fin_xsum == run_xsum) { | 198 if (fin_xsum == run_xsum) { |
| 199 char out[3] = { '+', 0, 0 }; | 199 char out[3] = { '+', 0, 0 }; |
| 200 int32_t seq; | 200 int32_t seq; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 213 | 213 |
| 214 NaClLog(LOG_INFO, "RX Bad XSUM, retry\n"); | 214 NaClLog(LOG_INFO, "RX Bad XSUM, retry\n"); |
| 215 goto retry; | 215 goto retry; |
| 216 } | 216 } |
| 217 | 217 |
| 218 return true; | 218 return true; |
| 219 } | 219 } |
| 220 | 220 |
| 221 } // End of namespace gdb_rsp | 221 } // End of namespace gdb_rsp |
| 222 | 222 |
| OLD | NEW |