FreeRDP/winpr/libwinpr/utils/test/TestBacktrace.c
Norbert Federa f71b6b46e8 fix string format specifiers
- fixed invalid, missing or additional arguments
- removed all type casts from arguments
- added missing (void*) typecasts for %p arguments
- use inttypes defines where appropriate
2016-12-16 13:48:43 +01:00

29 lines
487 B
C

#include <stdio.h>
#include <winpr/debug.h>
int TestBacktrace(int argc, char* argv[])
{
int rc = -1;
size_t used, x;
char **msg;
void *stack = winpr_backtrace(20);
if (!stack)
{
fprintf(stderr, "winpr_backtrace failed!\n");
return -1;
}
msg = winpr_backtrace_symbols(stack, &used);
if (msg)
{
for (x=0; x<used; x++)
printf("%"PRIuz": %s\n", x, msg[x]);
rc = 0;
}
winpr_backtrace_symbols_fd(stack, fileno(stdout));
winpr_backtrace_free(stack);
return rc;
}