0

I'm trying to print the call-stack of my program, in case of an assert in the code. I'm using the following code: Win32 - Backtrace from C code (except that my stack size is 60, and the 1st parameter of CaptureStackBackTrace is 2).

Only in the minority of the cases the output looks like this:

0: MyFunction - 0x009DF4D0
1: main - 0x00A533E0
2: __tmainCRTStartup - 0x00A56AF0
3: mainCRTStart - 0x00A56AD0
4: BaseThreadInitThunk - 0x76603378
5: RtlInitializeExceptionChain - 0x77DC989F

But in most of the cases, the printStack's output looks something like that:

0: BaseThreadInitThunk - 0x74CB3358
1: BaseThreadInitThunk - 0x74CB3358
2: BaseThreadInitThunk - 0x74CB3358
3: BaseThreadInitThunk - 0x74CB3358
4: BaseThreadInitThunk - 0x74CB3358
5: BaseThreadInitThunk - 0x74CB3358
6: BaseThreadInitThunk - 0x74CB3358
7: BaseThreadInitThunk - 0x74CB3358
8: BaseThreadInitThunk - 0x74CB3358
9: BaseThreadInitThunk - 0x74CB3358
10: BaseThreadInitThunk - 0x74CB3358
11: BaseThreadInitThunk - 0x74CB3358
12: BaseThreadInitThunk - 0x74CB3358
13: BaseThreadInitThunk - 0x74CB3358
14: RtlInitializeExceptionChain - 0x773D989F

When I run the program from a computer that's not my own, I always get the latter case. When I run the program from my computer, in some cases I get the former case, and in some the latter case.

Any help?

Community
  • 1
  • 1
Nir S.
  • 53
  • 5
  • When run on another computer, probably the symbol files are not available. `SymInitialize` will then return false (which is not checked in the example code). When run from your computer and it fails, possibly the stack is corrupt. Lookup the functions used on msdn. – Paul Ogilvie Jul 13 '17 at 13:52
  • The symbol file (i.e. the PDB file) is located on a remote server. Both my PC and the other PCs run the same remote EXE file. Both files reside on the same directory. Maybe the other PCs don't know the location of the PDB file? – Nir S. Jul 13 '17 at 14:25

0 Answers0