attempt to use function hooks.
This commit is contained in:
parent
057ab4da03
commit
70edf28235
|
@ -41,6 +41,7 @@
|
||||||
'cflags_cc': [
|
'cflags_cc': [
|
||||||
'-fexceptions',
|
'-fexceptions',
|
||||||
'-frtti',
|
'-frtti',
|
||||||
|
# '-finstrument-functions',
|
||||||
],
|
],
|
||||||
'libraries': [
|
'libraries': [
|
||||||
# standard libs:
|
# standard libs:
|
||||||
|
|
|
@ -57,7 +57,7 @@ process.on = function(name, listener) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return on.apply(this, arguments);
|
return Bitcoin._processOn.apply(this, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
Bitcoin.prototype.start = function(callback) {
|
Bitcoin.prototype.start = function(callback) {
|
||||||
|
@ -92,7 +92,7 @@ Bitcoin.prototype.start = function(callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Finally set signal handlers
|
// Finally set signal handlers
|
||||||
process.on = process.addListener = Bitcoind._processOn;
|
process.on = process.addListener = Bitcoin._processOn;
|
||||||
Bitcoin._signalQueue.forEach(function(event) {
|
Bitcoin._signalQueue.forEach(function(event) {
|
||||||
process.on(event[0], event[1]);
|
process.on(event[0], event[1]);
|
||||||
});
|
});
|
||||||
|
|
|
@ -88,6 +88,7 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
@ -1226,7 +1227,7 @@ NAN_METHOD(FillTransaction) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Local<Object> js_tx = Local<Object>::Cast(args[0]);
|
Local<Object> js_tx = Local<Object>::Cast(args[0]);
|
||||||
Local<Object> options = Local<Object>::Cast(args[1]);
|
// Local<Object> options = Local<Object>::Cast(args[1]);
|
||||||
|
|
||||||
String::Utf8Value tx_hex_(js_tx->Get(NanNew<String>("hex"))->ToString());
|
String::Utf8Value tx_hex_(js_tx->Get(NanNew<String>("hex"))->ToString());
|
||||||
std::string tx_hex = std::string(*tx_hex_);
|
std::string tx_hex = std::string(*tx_hex_);
|
||||||
|
@ -2366,6 +2367,41 @@ jstx_to_ctx(const Local<Object> entry, CTransaction& tx, uint256 hashBlock) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hooks
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
static int last_height = -1;
|
||||||
|
|
||||||
|
extern "C" void __attribute__ ((constructor))
|
||||||
|
trace_begin(void) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void __attribute__ ((destructor))
|
||||||
|
trace_end(void) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
__cyg_profile_func_enter(void *func, void *caller) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
__cyg_profile_func_exit(void *func, void *caller) {
|
||||||
|
int cur_height = chainActive.Height();
|
||||||
|
if (cur_height != last_height) {
|
||||||
|
printf("new block\n");
|
||||||
|
last_height = cur_height;
|
||||||
|
}
|
||||||
|
// if (func == &AcceptBlock || caller == &AcceptBlock || func == AcceptBlock || caller == AcceptBlock) {
|
||||||
|
// printf("accept block\n");
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init
|
* Init
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue