Example #1
0
void PrintCallstack(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level)
{
	u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]);  // SP

	GENERIC_LOG(type, level, "== STACK TRACE - SP = %08x ==", 
				PowerPC::ppcState.gpr[1]);

	if (LR == 0) {
		GENERIC_LOG(type, level, " LR = 0 - this is bad");	
	}
	int count = 1;
	if (g_symbolDB.GetDescription(PowerPC::ppcState.pc) != g_symbolDB.GetDescription(LR))
	{
		GENERIC_LOG(type, level, " * %s  [ LR = %08x ]", 
					g_symbolDB.GetDescription(LR), LR);
		count++;
	}

	//walk the stack chain
	while ((addr != 0xFFFFFFFF) && (addr != 0) && (count++ < 20) && (PowerPC::ppcState.gpr[1] != 0))
	{
		u32 func = Memory::ReadUnchecked_U32(addr + 4);
		const char *str = g_symbolDB.GetDescription(func);
		if (!str || strlen(str) == 0 || !strcmp(str, "Invalid"))
			str = "(unknown)";
		GENERIC_LOG(type, level, " * %s [ addr = %08x ]", str, func);
		addr = Memory::ReadUnchecked_U32(addr);
	}
}
Example #2
0
void PrintDataBuffer(LogTypes::LOG_TYPE type, u8* _pData, size_t _Size, const std::string& _title)
{
	GENERIC_LOG(type, LogTypes::LDEBUG, "%s", _title.c_str());
	for (u32 j = 0; j < _Size;)
	{
		std::string hex_line = "";
		for (int i = 0; i < 16; i++)
		{
			hex_line += StringFromFormat("%02x ", _pData[j++]);

			if (j >= _Size)
				break;
		}
		GENERIC_LOG(type, LogTypes::LDEBUG, "   Data: %s", hex_line.c_str());
	}
}
Example #3
0
void PrintDataBuffer(LogTypes::LOG_TYPE type, u8* _pData, size_t _Size, const char* _title)
{
	GENERIC_LOG(type, LogTypes::LDEBUG, "%s", _title);
	for (u32 j = 0; j < _Size;)
	{
		std::string Temp;
		for (int i = 0; i < 16; i++)
		{
			Temp.append(StringFromFormat("%02x ", _pData[j++]));

			if (j >= _Size)
				break;
		}
		GENERIC_LOG(type, LogTypes::LDEBUG, "   Data: %s", Temp.c_str());
	}
}
void VirtualDiscFileSystem::HandlerLogger(void *arg, HandlerHandle handle, LogTypes::LOG_LEVELS level, const char *msg) {
	VirtualDiscFileSystem *sys = static_cast<VirtualDiscFileSystem *>(arg);

	// TODO: Probably could do this smarter / use a lookup.
	const char *filename = NULL;
	for (auto it = sys->entries.begin(), end = sys->entries.end(); it != end; ++it) {
		if (it->second.fileIndex != (u32)-1 && it->second.handler.handle == handle) {
			filename = sys->fileList[it->second.fileIndex].fileName.c_str();
			break;
		}
	}

	if (filename != NULL) {
		GENERIC_LOG(LogTypes::FILESYS, level, "%s: %s", filename, msg);
	} else {
		GENERIC_LOG(LogTypes::FILESYS, level, "%s", msg);
	}
}
Example #5
0
void PrintCallstack(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level)
{
	GENERIC_LOG(type, level, "== STACK TRACE - SP = %08x ==",
				PowerPC::ppcState.gpr[1]);

	if (LR == 0) {
		GENERIC_LOG(type, level, " LR = 0 - this is bad");
	}
	if (g_symbolDB.GetDescription(PC) != g_symbolDB.GetDescription(LR))
	{
		GENERIC_LOG(type, level, " * %s  [ LR = %08x ]",
					g_symbolDB.GetDescription(LR).c_str(), LR);
	}
	WalkTheStack([type, level](u32 func_addr) {
		std::string func_desc = g_symbolDB.GetDescription(func_addr);
		if (func_desc.empty() || func_desc == "Invalid")
			func_desc = "(unknown)";
		GENERIC_LOG(type, level, " * %s [ addr = %08x ]", func_desc.c_str(), func_addr);
	});
}
Example #6
0
static VKAPI_ATTR VkBool32 VKAPI_CALL DebugReportCallback(VkDebugReportFlagsEXT flags,
                                                          VkDebugReportObjectTypeEXT objectType,
                                                          uint64_t object, size_t location,
                                                          int32_t messageCode,
                                                          const char* pLayerPrefix,
                                                          const char* pMessage, void* pUserData)
{
  std::string log_message =
      StringFromFormat("Vulkan debug report: (%s) %s", pLayerPrefix ? pLayerPrefix : "", pMessage);
  if (flags & VK_DEBUG_REPORT_ERROR_BIT_EXT)
    GENERIC_LOG(LogTypes::HOST_GPU, LogTypes::LERROR, "%s", log_message.c_str());
  else if (flags & (VK_DEBUG_REPORT_WARNING_BIT_EXT | VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT))
    GENERIC_LOG(LogTypes::HOST_GPU, LogTypes::LWARNING, "%s", log_message.c_str());
  else if (flags & VK_DEBUG_REPORT_INFORMATION_BIT_EXT)
    GENERIC_LOG(LogTypes::HOST_GPU, LogTypes::LINFO, "%s", log_message.c_str());
  else
    GENERIC_LOG(LogTypes::HOST_GPU, LogTypes::LDEBUG, "%s", log_message.c_str());

  return VK_FALSE;
}
Example #7
0
void LogVulkanResult(int level, const char* func_name, VkResult res, const char* msg, ...)
{
  std::va_list ap;
  va_start(ap, msg);
  std::string real_msg = StringFromFormatV(msg, ap);
  va_end(ap);

  real_msg = StringFromFormat("(%s) %s (%d: %s)", func_name, real_msg.c_str(),
                              static_cast<int>(res), VkResultToString(res));

  GENERIC_LOG(LogTypes::VIDEO, static_cast<LogTypes::LOG_LEVELS>(level), "%s", real_msg.c_str());
}