aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-03-16 10:44:57 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-03-16 10:44:57 -0700
commit2b45cb827f0a65a84c5577a11f7d9572446124d8 (patch)
treee0e0af0ab13a018e68acda8f97da047649684576 /test
parentce2b3084e77d36a54b4e57c1a97f68d90846ae7e (diff)
clang-format code
Diffstat (limited to 'test')
-rw-r--r--test/core/util/test_config.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/test/core/util/test_config.c b/test/core/util/test_config.c
index 83bbc0f4c4..554c653072 100644
--- a/test/core/util/test_config.c
+++ b/test/core/util/test_config.c
@@ -59,21 +59,23 @@ static unsigned seed(void) { return _getpid(); }
#pragma comment(lib, "dbghelp.lib")
static void print_current_stack() {
- typedef USHORT(WINAPI *CaptureStackBackTraceType)(__in ULONG, __in ULONG, __out PVOID*, __out_opt PULONG);
- CaptureStackBackTraceType func = (CaptureStackBackTraceType)(GetProcAddress(LoadLibrary(L"kernel32.dll"), "RtlCaptureStackBackTrace"));
+ typedef USHORT(WINAPI * CaptureStackBackTraceType)(
+ __in ULONG, __in ULONG, __out PVOID *, __out_opt PULONG);
+ CaptureStackBackTraceType func = (CaptureStackBackTraceType)(
+ GetProcAddress(LoadLibrary(L"kernel32.dll"), "RtlCaptureStackBackTrace"));
- if (func == NULL)
- return; // WOE 29.SEP.2010
+ if (func == NULL) return; // WOE 29.SEP.2010
- // Quote from Microsoft Documentation:
- // ## Windows Server 2003 and Windows XP:
- // ## The sum of the FramesToSkip and FramesToCapture parameters must be less than 63.
+// Quote from Microsoft Documentation:
+// ## Windows Server 2003 and Windows XP:
+// ## The sum of the FramesToSkip and FramesToCapture parameters must be less
+// than 63.
#define MAX_CALLERS 62
- void * callers_stack[MAX_CALLERS];
+ void *callers_stack[MAX_CALLERS];
unsigned short frames;
- SYMBOL_INFOW * symbol;
- HANDLE process;
+ SYMBOL_INFOW *symbol;
+ HANDLE process;
process = GetCurrentProcess();
SymInitialize(process, NULL, TRUE);
frames = (func)(0, MAX_CALLERS, callers_stack, NULL);
@@ -81,18 +83,19 @@ static void print_current_stack() {
symbol->MaxNameLen = 255;
symbol->SizeOfStruct = sizeof(SYMBOL_INFOW);
- const unsigned short MAX_CALLERS_SHOWN = 32;
+ const unsigned short MAX_CALLERS_SHOWN = 32;
frames = frames < MAX_CALLERS_SHOWN ? frames : MAX_CALLERS_SHOWN;
for (unsigned int i = 0; i < frames; i++) {
SymFromAddrW(process, (DWORD64)(callers_stack[i]), 0, symbol);
- fwprintf(stderr, L"*** %d: %016I64LX %ls - 0x%0X\n", i, (DWORD64)callers_stack[i], symbol->Name, symbol->Address);
+ fwprintf(stderr, L"*** %d: %016I64LX %ls - 0x%0X\n", i,
+ (DWORD64)callers_stack[i], symbol->Name, symbol->Address);
}
free(symbol);
}
static void print_stack_from_context(CONTEXT c) {
- STACKFRAME s; // in/out stackframe
+ STACKFRAME s; // in/out stackframe
memset(&s, 0, sizeof(s));
DWORD imageType;
#ifdef _M_IX86
@@ -129,21 +132,17 @@ static void print_stack_from_context(CONTEXT c) {
HANDLE process = GetCurrentProcess();
HANDLE thread = GetCurrentThread();
- SYMBOL_INFOW *symbol = (SYMBOL_INFOW *)calloc(sizeof(SYMBOL_INFOW) + 256 * sizeof(char), 1);
+ SYMBOL_INFOW *symbol =
+ (SYMBOL_INFOW *)calloc(sizeof(SYMBOL_INFOW) + 256 * sizeof(char), 1);
symbol->MaxNameLen = 255;
symbol->SizeOfStruct = sizeof(SYMBOL_INFOW);
- while (StackWalk(imageType,
- process,
- thread,
- &s,
- &c,
- 0,
- SymFunctionTableAccess,
- SymGetModuleBase,
- 0)) {
- BOOL has_symbol = SymFromAddrW(process, (DWORD64)(s.AddrPC.Offset), 0, symbol);
- fwprintf(stderr, L"*** %016I64LX %ls - 0x%0X\n", (DWORD64)(s.AddrPC.Offset), has_symbol ? symbol->Name : L"<<no symbol>>", symbol->Address);
+ while (StackWalk(imageType, process, thread, &s, &c, 0,
+ SymFunctionTableAccess, SymGetModuleBase, 0)) {
+ BOOL has_symbol =
+ SymFromAddrW(process, (DWORD64)(s.AddrPC.Offset), 0, symbol);
+ fwprintf(stderr, L"*** %016I64LX %ls - 0x%0X\n", (DWORD64)(s.AddrPC.Offset),
+ has_symbol ? symbol->Name : L"<<no symbol>>", symbol->Address);
}
free(symbol);