Created
February 11, 2014 15:44
-
-
Save vitillo/8937398 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/xpcom/threads/nsTimerImpl.cpp b/xpcom/threads/nsTimerImpl.cpp | |
--- a/xpcom/threads/nsTimerImpl.cpp | |
+++ b/xpcom/threads/nsTimerImpl.cpp | |
@@ -9,16 +9,19 @@ | |
#include "nsAutoPtr.h" | |
#include "nsThreadManager.h" | |
#include "nsThreadUtils.h" | |
#include "plarena.h" | |
#include "pratom.h" | |
#include "GeckoProfiler.h" | |
#include "mozilla/Atomics.h" | |
+#include <cxxabi.h> | |
+#include <dlfcn.h> | |
+ | |
using mozilla::Atomic; | |
using mozilla::TimeDuration; | |
using mozilla::TimeStamp; | |
static Atomic<int32_t> gGenerator; | |
static TimerThread* gThread = nullptr; | |
#ifdef DEBUG_TIMERS | |
@@ -491,16 +494,29 @@ NS_IMETHODIMP nsTimerImpl::SetTarget(nsI | |
if (aTarget) | |
mEventTarget = aTarget; | |
else | |
mEventTarget = static_cast<nsIEventTarget*>(NS_GetCurrentThread()); | |
return NS_OK; | |
} | |
+void printFunctionName(void *function) | |
+{ | |
+ int status; | |
+ Dl_info info; | |
+ status = dladdr(function, &info); | |
+ | |
+ if (status && info.dli_sname) { | |
+ char *realname = abi::__cxa_demangle(info.dli_sname, 0, 0, &status); | |
+ printf("%s\n", realname); | |
+ } else { | |
+ printf("Couldn't retrieve the name of the function\n"); | |
+ } | |
+} | |
void nsTimerImpl::Fire() | |
{ | |
if (mCanceled) | |
return; | |
PROFILER_LABEL("Timer", "Fire"); | |
@@ -543,16 +559,17 @@ void nsTimerImpl::Fire() | |
if (callbackType == CALLBACK_TYPE_INTERFACE) | |
NS_ADDREF(callback.i); | |
else if (callbackType == CALLBACK_TYPE_OBSERVER) | |
NS_ADDREF(callback.o); | |
ReleaseCallback(); | |
switch (callbackType) { | |
case CALLBACK_TYPE_FUNC: | |
+ printFunctionName((void *)callback.c); | |
callback.c(this, mClosure); | |
break; | |
case CALLBACK_TYPE_INTERFACE: | |
callback.i->Notify(this); | |
break; | |
case CALLBACK_TYPE_OBSERVER: | |
callback.o->Observe(static_cast<nsITimer*>(this), | |
NS_TIMER_CALLBACK_TOPIC, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment