зеркало из https://github.com/mozilla/gecko-dev.git
Bug 788396: Centralize usage of ipc::LoggingEnabled() and ensure it goes to logcat on bionic OSes. r=bent
This commit is contained in:
Родитель
b4fdf2f847
Коммит
97fdaf5406
|
@ -570,10 +570,10 @@ AsyncChannel::Clear()
|
|||
static void
|
||||
PrintErrorMessage(bool isChild, const char* channelName, const char* msg)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "\n###!!! [%s][%s] Error: %s\n\n",
|
||||
isChild ? "Child" : "Parent", channelName, msg);
|
||||
#endif
|
||||
if (LoggingEnabled()) {
|
||||
printf_stderr("\n###!!! [%s][%s] Error: %s\n\n",
|
||||
isChild ? "Child" : "Parent", channelName, msg);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -115,9 +115,9 @@ LoggingEnabled()
|
|||
inline void
|
||||
ProtocolErrorBreakpoint(const char* aMsg)
|
||||
{
|
||||
#if defined(DEBUG)
|
||||
printf("Protocol error: %s\n", aMsg);
|
||||
#endif
|
||||
if (LoggingEnabled()) {
|
||||
printf_stderr("Protocol error: %s\n", aMsg);
|
||||
}
|
||||
}
|
||||
|
||||
typedef IPCMessageStart ProtocolId;
|
||||
|
|
|
@ -446,8 +446,9 @@ RPCChannel::Incall(const Message& call, size_t stackDepth)
|
|||
}
|
||||
|
||||
if (LoggingEnabled()) {
|
||||
fprintf(stderr, " (%s: %s won, so we're%sdeferring)\n",
|
||||
mChild ? "child" : "parent", winner, defer ? " " : " not ");
|
||||
printf_stderr(" (%s: %s won, so we're%sdeferring)\n",
|
||||
mChild ? "child" : "parent", winner,
|
||||
defer ? " " : " not ");
|
||||
}
|
||||
|
||||
if (defer) {
|
||||
|
@ -626,30 +627,29 @@ RPCChannel::DebugAbort(const char* file, int line, const char* cond,
|
|||
const char* why,
|
||||
const char* type, bool reply) const
|
||||
{
|
||||
fprintf(stderr,
|
||||
"###!!! [RPCChannel][%s][%s:%d] "
|
||||
"Assertion (%s) failed. %s (triggered by %s%s)\n",
|
||||
mChild ? "Child" : "Parent",
|
||||
file, line, cond,
|
||||
why,
|
||||
type, reply ? "reply" : "");
|
||||
printf_stderr("###!!! [RPCChannel][%s][%s:%d] "
|
||||
"Assertion (%s) failed. %s (triggered by %s%s)\n",
|
||||
mChild ? "Child" : "Parent",
|
||||
file, line, cond,
|
||||
why,
|
||||
type, reply ? "reply" : "");
|
||||
// technically we need the mutex for this, but we're dying anyway
|
||||
DumpRPCStack(stderr, " ");
|
||||
fprintf(stderr, " remote RPC stack guess: %lu\n",
|
||||
mRemoteStackDepthGuess);
|
||||
fprintf(stderr, " deferred stack size: %lu\n",
|
||||
mDeferred.size());
|
||||
fprintf(stderr, " out-of-turn RPC replies stack size: %lu\n",
|
||||
mOutOfTurnReplies.size());
|
||||
fprintf(stderr, " Pending queue size: %lu, front to back:\n",
|
||||
mPending.size());
|
||||
DumpRPCStack(" ");
|
||||
printf_stderr(" remote RPC stack guess: %lu\n",
|
||||
mRemoteStackDepthGuess);
|
||||
printf_stderr(" deferred stack size: %lu\n",
|
||||
mDeferred.size());
|
||||
printf_stderr(" out-of-turn RPC replies stack size: %lu\n",
|
||||
mOutOfTurnReplies.size());
|
||||
printf_stderr(" Pending queue size: %lu, front to back:\n",
|
||||
mPending.size());
|
||||
|
||||
MessageQueue pending = mPending;
|
||||
while (!pending.empty()) {
|
||||
fprintf(stderr, " [ %s%s ]\n",
|
||||
pending.front().is_rpc() ? "rpc" :
|
||||
(pending.front().is_sync() ? "sync" : "async"),
|
||||
pending.front().is_reply() ? "reply" : "");
|
||||
printf_stderr(" [ %s%s ]\n",
|
||||
pending.front().is_rpc() ? "rpc" :
|
||||
(pending.front().is_sync() ? "sync" : "async"),
|
||||
pending.front().is_reply() ? "reply" : "");
|
||||
pending.pop_front();
|
||||
}
|
||||
|
||||
|
@ -657,15 +657,12 @@ RPCChannel::DebugAbort(const char* file, int line, const char* cond,
|
|||
}
|
||||
|
||||
void
|
||||
RPCChannel::DumpRPCStack(FILE* outfile, const char* const pfx) const
|
||||
RPCChannel::DumpRPCStack(const char* const pfx) const
|
||||
{
|
||||
NS_WARN_IF_FALSE(MessageLoop::current() != mWorkerLoop,
|
||||
"The worker thread had better be paused in a debugger!");
|
||||
|
||||
if (!outfile)
|
||||
outfile = stdout;
|
||||
|
||||
fprintf(outfile, "%sRPCChannel 'backtrace':\n", pfx);
|
||||
printf_stderr("%sRPCChannel 'backtrace':\n", pfx);
|
||||
|
||||
// print a python-style backtrace, first frame to last
|
||||
for (uint32_t i = 0; i < mCxxStackFrames.size(); ++i) {
|
||||
|
@ -673,8 +670,8 @@ RPCChannel::DumpRPCStack(FILE* outfile, const char* const pfx) const
|
|||
const char* dir, *sems, *name;
|
||||
mCxxStackFrames[i].Describe(&id, &dir, &sems, &name);
|
||||
|
||||
fprintf(outfile, "%s[(%u) %s %s %s(actor=%d) ]\n", pfx,
|
||||
i, dir, sems, name, id);
|
||||
printf_stderr("%s[(%u) %s %s %s(actor=%d) ]\n", pfx,
|
||||
i, dir, sems, name, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -294,8 +294,8 @@ private:
|
|||
const char* type="rpc", bool reply=false) const;
|
||||
|
||||
// This method is only safe to call on the worker thread, or in a
|
||||
// debugger with all threads paused. |outfile| defaults to stdout.
|
||||
void DumpRPCStack(FILE* outfile=NULL, const char* const pfx="") const;
|
||||
// debugger with all threads paused.
|
||||
void DumpRPCStack(const char* const pfx="") const;
|
||||
|
||||
//
|
||||
// Queue of all incoming messages, except for replies to sync
|
||||
|
|
Загрузка…
Ссылка в новой задаче