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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | debugger/rsp/rsp_blob_utils_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: debugger/rsp/rsp_blob_utils.h
===================================================================
--- debugger/rsp/rsp_blob_utils.h (revision 956)
+++ debugger/rsp/rsp_blob_utils.h (working copy)
@@ -4,6 +4,7 @@
#ifndef DEBUGGER_RSP_RSP_BLOB_UTILS_H_
#define DEBUGGER_RSP_RSP_BLOB_UTILS_H_
+#include <assert.h>
#include <deque>
#include "debugger/base/debug_blob.h"
@@ -42,6 +43,31 @@
return (i > 0);
}
+ /// Appends hex representation of |value| to the |blob|,
+ /// with no leading zeroes. Example:
+ /// 0x123 -> {'1', '2', '3'}
+ /// @param[in] value integer to be appended
+ /// @param[out] blob pointer to the destination blob.
+ /// @return reference to |blob|.
+ template <class T>
+ debug::Blob& PushIntToBack(T value, debug::Blob* blob) {
+ assert(NULL != blob);
+ debug::Blob tmp;
+ for (size_t i = 0; i < sizeof(value); i++) {
+ uint8_t x = (value & 0xFF);
+ tmp.PushFront(debug::Blob::GetHexDigit(x, 0));
+ tmp.PushFront(debug::Blob::GetHexDigit(x, 1));
+ if (sizeof(value) > 1)
+ value = value >> 8;
+ }
+ tmp.PopMatchingBytesFromFront(debug::Blob().FromString("0"));
+ if (0 == tmp.size())
+ blob->PushBack('0');
+ else
+ blob->Append(tmp);
+ return *blob;
+ }
+
/// removes space characters from front and from back of the blob.
/// @param blob blob to perform operation on
void RemoveSpacesFromBothEnds(debug::Blob* blob);
« 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