mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 00:56:44 +01:00
dumpmemory
This commit is contained in:
parent
2f735ca816
commit
ddc39462df
@ -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;
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user