Counterpart to glibc's backtrace() and backtrace_symbols() on Windows?
Asked Answered
F

1

7

Glibc provides the very handy backtrace() and backtrace_symbols() functions, which can help getting the stack trace of the current function programmatically (see here).

Does the Windows API provide any similar functions?

Freeway answered 16/10, 2014 at 6:58 Comment(0)
S
8

Yes, take a look at the function CaptureStackBackTrace(). Use SymFromAddr() and its counterparts to get meaningful symbol names.

Shannan answered 16/10, 2014 at 7:0 Comment(3)
Nice, thanks! This is almost exactly what I'm looking for. It would also be nice to be able to convert the addresses returned by that function into corresponding symbol names.Freeway
@Grigory That is what SymFromAddr() does.Shannan
Nvm, I think I found an example of how to do it in this question: #22468104Freeway

© 2022 - 2024 — McMap. All rights reserved.