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

Side by Side Diff: debugger/rsp/rsp_blob_utils.h

Issue 7466014: Add rsp::GetOffsets command + reply (Closed) Base URL: http://nativeclient-sdk.googlecode.com/svn/trunk/src/
Patch Set: Created 9 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | debugger/rsp/rsp_blob_utils_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 #ifndef DEBUGGER_RSP_RSP_BLOB_UTILS_H_ 4 #ifndef DEBUGGER_RSP_RSP_BLOB_UTILS_H_
5 #define DEBUGGER_RSP_RSP_BLOB_UTILS_H_ 5 #define DEBUGGER_RSP_RSP_BLOB_UTILS_H_
6 6
7 #include <deque> 7 #include <deque>
8 #include "debugger/base/debug_blob.h" 8 #include "debugger/base/debug_blob.h"
9 9
10 namespace rsp { 10 namespace rsp {
(...skipping 24 matching lines...) Expand all
35 35
36 blob->PopFront(); 36 blob->PopFront();
37 if (0 == i) 37 if (0 == i)
38 *result = dig; 38 *result = dig;
39 else 39 else
40 *result = (*result << 4) + dig; 40 *result = (*result << 4) + dig;
41 } 41 }
42 return (i > 0); 42 return (i > 0);
43 } 43 }
44 44
45 /// leading zeroes are ignored
46 template <class T>
47 debug::Blob& PushIntToBack(T value, debug::Blob* blob) {
48 if (NULL == blob)
49 return *blob;
mmortensen 2011/07/21 17:19:33 If blob is NULL, we don't want to deference it. In
garianov1 2011/07/21 17:31:45 changed to assert(NULL != blob);
50
51 debug::Blob tmp;
52 for (size_t i = 0; i < sizeof(value); i++) {
53 uint8_t x = (value & 0xFF);
54 tmp.PushFront(debug::Blob::GetHexDigit(x, 0));
55 tmp.PushFront(debug::Blob::GetHexDigit(x, 1));
56 if (sizeof(value) > 1)
57 value = value >> 8;
58 }
59 tmp.PopMatchingBytesFromFront(debug::Blob().FromString("0"));
60 if (0 == tmp.size())
61 blob->PushBack('0');
62 else
63 blob->Append(tmp);
64 return *blob;
65 }
66
45 /// removes space characters from front and from back of the blob. 67 /// removes space characters from front and from back of the blob.
46 /// @param blob blob to perform operation on 68 /// @param blob blob to perform operation on
47 void RemoveSpacesFromBothEnds(debug::Blob* blob); 69 void RemoveSpacesFromBothEnds(debug::Blob* blob);
48 70
49 /// removes space characters from front and from back of the blobs. 71 /// removes space characters from front and from back of the blobs.
50 /// @param blobs blobs to perform operation on 72 /// @param blobs blobs to perform operation on
51 void RemoveSpacesFromBothEnds(std::deque<debug::Blob>* blobs); 73 void RemoveSpacesFromBothEnds(std::deque<debug::Blob>* blobs);
52 74
53 /// Writes formatted data to Blob. 75 /// Writes formatted data to Blob.
54 /// @param blob blob to perform operation on 76 /// @param blob blob to perform operation on
55 /// @param[in] fmt string that contains the text to be written to the Blob. 77 /// @param[in] fmt string that contains the text to be written to the Blob.
56 /// @return reference to |blob| 78 /// @return reference to |blob|
57 debug::Blob& Format(debug::Blob* blob, const char* fmt, ...); 79 debug::Blob& Format(debug::Blob* blob, const char* fmt, ...);
58 80
59 } // namespace rsp 81 } // namespace rsp
60 82
61 #endif // DEBUGGER_RSP_RSP_BLOB_UTILS_H_ 83 #endif // DEBUGGER_RSP_RSP_BLOB_UTILS_H_
62 84
OLDNEW
« no previous file with comments | « no previous file | debugger/rsp/rsp_blob_utils_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698