0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 00:56:44 +01:00

dumpmemory

This commit is contained in:
Dwight 2007-11-12 10:10:43 -05:00
parent 2f735ca816
commit ddc39462df
2 changed files with 11 additions and 3 deletions

View File

@ -297,6 +297,7 @@ cout << "hello2" << endl;
int main(int argc, char* argv[], char *envp[] )
{
dumpmemory("hello world", 12);
quicktest();
//cout << "fork then sleep" << endl;

View File

@ -6,21 +6,28 @@
#include "../stdafx.h"
inline void dumpmemory(const char *data, int len) {
if( len > 1024 )
len = 1024;
try {
const char *q = data;
const char *p = q;
while( len > 0 ) {
for( int i = 0; i < 16; i++ ) {
cout << (*p >= 32 && *p <= 126) ? *p : '.';
if( *p >= 32 && *p <= 126 )
cout << *p;
else
cout << '.';
p++;
}
cout << " ";
p -= 16;
for( int i = 0; i < 16; i++ )
cout << (unsigned) *p << ' ';
cout << (unsigned) ((unsigned char)*p++) << ' ';
cout << endl;
len -= 16;
}
} catch(...) { }
} catch(...) {
}
}
#include <boost/thread/thread.hpp>