Ejemplo n.º 1
0
void BitDump(const char* tag, int level, const BYTE* buffer, UINT32 length, UINT32 flags)
{
	DWORD i;
	int nbits;
	const char* str;
	const char** strs;
	char pbuffer[64 * 8 + 1];
	size_t pos = 0;
	strs = (flags & BITDUMP_MSB_FIRST) ? BYTE_BIT_STRINGS_MSB : BYTE_BIT_STRINGS_LSB;

	for (i = 0; i < length; i += 8)
	{
		str = strs[buffer[i / 8]];
		nbits = (length - i) > 8 ? 8 : (length - i);
		pos += trio_snprintf(&pbuffer[pos], length - pos, "%.*s ", nbits, str);

		if ((i % 64) == 0)
		{
			pos = 0;
			WLog_LVL(tag, level, "%s", pbuffer);
		}
	}

	if (i)
		WLog_LVL(tag, level, "%s ", pbuffer);
}
Ejemplo n.º 2
0
void winpr_log_backtrace(const char* tag, DWORD level, DWORD size)
{
	size_t used, x;
	char **msg;
	void *stack = winpr_backtrace(20);

	if (!stack)
	{
		WLog_ERR(tag, "winpr_backtrace failed!\n");
		winpr_backtrace_free(stack);
		return;
	}

	msg = winpr_backtrace_symbols(stack, &used);
	if (msg)
	{
		for (x=0; x<used; x++)
			WLog_LVL(tag, level, "%lu: %s\n", (unsigned long)x, msg[x]);
	}
	winpr_backtrace_free(stack);
}