Add more support for debugging plugins.
Added support for plugin debug messages and better error reporting when something goes wrong during start up of SLPlugin. Also added more debug output regarding general plugin messages as well as debug output related to AIFilePicker.
This commit is contained in:
@@ -674,7 +674,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
|
||||
mDirtyRect.unionWith(newDirtyRect);
|
||||
}
|
||||
|
||||
LL_DEBUGS("Plugin") << "adjusted incoming rect is: ("
|
||||
LL_DEBUGS("PluginUpdated") << "adjusted incoming rect is: ("
|
||||
<< newDirtyRect.mLeft << ", "
|
||||
<< newDirtyRect.mTop << ", "
|
||||
<< newDirtyRect.mRight << ", "
|
||||
|
||||
@@ -100,6 +100,13 @@ public:
|
||||
// Returns -1 on failure, otherwise returns the number of key/value pairs in the message.
|
||||
int parse(const std::string &message);
|
||||
|
||||
enum LLPLUGIN_LOG_LEVEL {
|
||||
LOG_LEVEL_DEBUG,
|
||||
LOG_LEVEL_INFO,
|
||||
LOG_LEVEL_WARN,
|
||||
LOG_LEVEL_ERR,
|
||||
};
|
||||
|
||||
// For debugging purposes.
|
||||
friend std::ostream& operator<<(std::ostream& os, LLPluginMessage const& message) { return os << message.mMessage; }
|
||||
|
||||
|
||||
@@ -227,6 +227,7 @@ void LLPluginProcessChild::idle(void)
|
||||
|
||||
case STATE_DONE:
|
||||
// just sit here.
|
||||
LL_WARNS("Plugin") << "Calling LLPluginProcessChild::idle while in STATE_DONE!" << LL_ENDL;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -598,7 +598,16 @@ void LLPluginProcessParent::sendMessage(const LLPluginMessage &message)
|
||||
}
|
||||
|
||||
std::string buffer = message.generate();
|
||||
LL_DEBUGS("Plugin") << "Sending: " << buffer << LL_ENDL;
|
||||
#if LL_DEBUG
|
||||
if (message.getName() == "mouse_event")
|
||||
{
|
||||
LL_DEBUGS("PluginMouseEvent") << "Sending: " << buffer << LL_ENDL;
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_DEBUGS("Plugin") << "Sending: " << buffer << LL_ENDL;
|
||||
}
|
||||
#endif
|
||||
writeMessageRaw(buffer);
|
||||
|
||||
// Try to send message immediately.
|
||||
@@ -876,7 +885,7 @@ void LLPluginProcessParent::servicePoll()
|
||||
// It parses the message and passes it on to LLPluginProcessParent::receiveMessage.
|
||||
void LLPluginProcessParent::receiveMessageRaw(const std::string &message)
|
||||
{
|
||||
LL_DEBUGS("Plugin") << "Received: " << message << LL_ENDL;
|
||||
LL_DEBUGS("PluginRaw") << "Received: " << message << LL_ENDL;
|
||||
|
||||
LLPluginMessage parsed;
|
||||
if(parsed.parse(message) != -1)
|
||||
@@ -998,8 +1007,7 @@ void LLPluginProcessParent::receiveMessage(const LLPluginMessage &message)
|
||||
|
||||
mCPUUsage = message.getValueReal("cpu_usage");
|
||||
|
||||
LL_DEBUGS("Plugin") << "cpu usage reported as " << mCPUUsage << LL_ENDL;
|
||||
|
||||
LL_DEBUGS("PluginHeartbeat") << "cpu usage reported as " << mCPUUsage << LL_ENDL;
|
||||
}
|
||||
else if(message_name == "shutdown")
|
||||
{
|
||||
@@ -1024,6 +1032,30 @@ void LLPluginProcessParent::receiveMessage(const LLPluginMessage &message)
|
||||
mSharedMemoryRegions.erase(iter);
|
||||
}
|
||||
}
|
||||
else if(message_name == "log_message")
|
||||
{
|
||||
std::string msg=message.getValue("message");
|
||||
S32 level=message.getValueS32("log_level");
|
||||
|
||||
switch(level)
|
||||
{
|
||||
case LLPluginMessage::LOG_LEVEL_DEBUG:
|
||||
LL_DEBUGS("Plugin child")<<msg<<LL_ENDL;
|
||||
break;
|
||||
case LLPluginMessage::LOG_LEVEL_INFO:
|
||||
LL_INFOS("Plugin child")<<msg<<LL_ENDL;
|
||||
break;
|
||||
case LLPluginMessage::LOG_LEVEL_WARN:
|
||||
LL_WARNS("Plugin child")<<msg<<LL_ENDL;
|
||||
break;
|
||||
case LLPluginMessage::LOG_LEVEL_ERR:
|
||||
LL_ERRS("Plugin child")<<msg<<LL_ENDL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS("Plugin") << "Unknown internal message from child: " << message_name << LL_ENDL;
|
||||
|
||||
Reference in New Issue
Block a user