MCPcopy Create free account
hub / github.com/NetHack/NetHack / win32_cr_gettrace

Function win32_cr_gettrace

sys/windows/windsys.c:1352–1376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1350#endif
1351
1352int
1353win32_cr_gettrace(int maxframes USED_IF_BACKTRACE,
1354 char *out USED_IF_BACKTRACE,
1355 int outsize USED_IF_BACKTRACE)
1356{
1357#ifdef USE_BACKTRACE
1358 userstate.error_count = 0;
1359 userstate.good_count = 0;
1360 userstate.out = out;
1361 userstate.outsize = outsize;
1362 userstate.maxframes = maxframes;
1363 static char binfile[MAX_PATH];// assumes !longPathAware in manifest (Win10+)
1364 DWORD rv = GetModuleFileNameA(NULL, binfile, sizeof(binfile));
1365 struct backtrace_state *state
1366 = backtrace_create_state(binfile, 0, btecb_fn, &userstate);
1367 if(!state) return userstate.error_count + userstate.good_count;
1368 rv=backtrace_full(state, 0, btfcb_fn, btecb_fn, &userstate);
1369printf("rv=%d\n",rv);
1370 // XXX rv not checked
1371 // XXX this API leaks its memory; there is no free function
1372 return userstate.error_count + userstate.good_count;
1373#else
1374 return 0;
1375#endif
1376}
1377#else
1378// Use win32 API with Visual Studio (and probably MSVC).
1379#include <dbghelp.h>

Callers 1

submit_web_reportFunction · 0.85

Calls 2

printfFunction · 0.85
swr_add_uricodedFunction · 0.85

Tested by

no test coverage detected