Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: experimental/linux_debug_server/debugger/rsp/rsp_control_packets.cc

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 #include "debugger/rsp/rsp_control_packets.h"
5
6 namespace rsp {
7 ReadMemoryCommand::ReadMemoryCommand()
8 : addr_(0),
9 num_of_bytes_(0) {
10 }
11
12 // Example: "m" + "cffffff80,40"
13 bool ReadMemoryCommand::FromBlob(const std::string& type,
14 debug::Blob* message) {
15 std::deque<debug::Blob> tokens;
16 message->Split(debug::Blob().FromString(","), &tokens);
17 if (tokens.size() < 2)
18 return false;
19
20 bool r1 = PopIntFromFront(&tokens[0], &addr_);
21 bool r2 = PopIntFromFront(&tokens[1], &num_of_bytes_);
22 return r1 && r2;
23 }
24
25 void ReadMemoryCommand::ToBlob(debug::Blob* message) const {
26 Format(message, "m%I64x,%x", addr_, num_of_bytes_);
27 }
28
29 WriteMemoryCommand::WriteMemoryCommand()
30 : addr_(0) {
31 }
32
33 bool WriteMemoryCommand::FromBlob(const std::string& type,
34 debug::Blob* message) {
35 // example: H>[Mc00020304,1:8b]
36 std::deque<debug::Blob> tokens;
37 message->Split(debug::Blob().FromString(","), &tokens);
38 if (tokens.size() < 2)
39 return false;
40
41 if (!PopIntFromFront(&tokens[0], &addr_))
42 return false;
43 debug::Blob len_and_data = tokens[1];
44 len_and_data.Split(debug::Blob().FromString(":"), &tokens);
45 if (tokens.size() < 2)
46 return false;
47 return data_.FromHexString(tokens[1].ToString());
48 }
49
50 void WriteMemoryCommand::ToBlob(debug::Blob* message) const {
51 std::string hex_blob = data_.ToHexStringNoLeadingZeroes();
52 Format(message, "M%I64x,%x:%s", addr_, data_.size(), hex_blob.c_str());
53 }
54
55 bool WriteRegistersCommand::FromBlob(const std::string& type,
56 debug::Blob* message) {
57 return data_.FromHexString(message->ToString());
58 }
59
60 void WriteRegistersCommand::ToBlob(debug::Blob* message) const {
61 message->FromString("G");
62 message->Append(debug::Blob().FromString(data_.ToHexString()));
63 }
64 } // namespace rsp
65
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698