attempt to use function hooks.

This commit is contained in:
Christopher Jeffrey 2014-09-30 15:53:13 -07:00
parent 057ab4da03
commit 70edf28235
3 changed files with 40 additions and 3 deletions

View File

@ -41,6 +41,7 @@
'cflags_cc': [
'-fexceptions',
'-frtti',
# '-finstrument-functions',
],
'libraries': [
# standard libs:

View File

@ -57,7 +57,7 @@ process.on = function(name, listener) {
return;
}
}
return on.apply(this, arguments);
return Bitcoin._processOn.apply(this, arguments);
};
Bitcoin.prototype.start = function(callback) {
@ -92,7 +92,7 @@ Bitcoin.prototype.start = function(callback) {
});
// Finally set signal handlers
process.on = process.addListener = Bitcoind._processOn;
process.on = process.addListener = Bitcoin._processOn;
Bitcoin._signalQueue.forEach(function(event) {
process.on(event[0], event[1]);
});

View File

@ -88,6 +88,7 @@
#include <stdint.h>
#include <signal.h>
#include <stdio.h>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem.hpp>
@ -1226,7 +1227,7 @@ NAN_METHOD(FillTransaction) {
}
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());
std::string tx_hex = std::string(*tx_hex_);
@ -2366,6 +2367,41 @@ jstx_to_ctx(const Local<Object> entry, CTransaction& tx, uint256 hashBlock) {
}
#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
*/