Stacktrace in mingw on Windows/multiplatform ?

Stacktrace in mingw on Windows/multiplatform ?

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Stacktrace in mingw on Windows/multiplatform ?

Post by hughperkins »

Hi,

Random question: how can one obtain the stack-trace for unexpected exceptions in mingw or, preferably, multiplatform?

Edit: it seems like, if we were using gcc on linux, we'd have backtrace()/execinfo.h available. If we were using msvc on windows we'd have StackWalk. mingw seems not to have either
:?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Moreover, it's not really working right now, which is a problem, since the current builds are very unstable at the moment.
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Post by hughperkins »

Argh wrote:Moreover, it's not really working right now, which is a problem, since the current builds are very unstable at the moment.
"It"? Stacktrace in linux?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Stacktrace, period, from my understanding. See my thread about this lower down.
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Post by hughperkins »

Ah.... the cryptically named "stacktrace" thread :lol:

Oh... so mingw can create stacktraces???

Or is this a "core" which is then converted to a stacktrace by something like gdb?

Ideally, I'd like to be able to get a stacktrace following an exception, without having a full-blown uncaught-exception shutdown.
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Post by hughperkins »

Ah... apparently stackwalk works in mingw. Interesting.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Now I'm confused: do you mean creating stacktraces programatically from the crashing program or from an external debugger?

For programatically created stacktraces, that's what current Spring (build in MinGW!) already does, see:
https://spring.clan-sy.com/svn/spring/t ... andler.cpp

As you say yourself, this can be done in Linux using backtrace() and backtrace_symbols(), the latter of course being useless unless compiled with debugging symbols enabled.

As for debugging, there's GDB and a number of frontends (codeblocks too I thought?). I never tried any frontends on Windows though, on Linux I usually use KDevelop as IDE including GDB frontend.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Argh wrote:Moreover, it's not really working right now, which is a problem, since the current builds are very unstable at the moment.
Good point, probably forgot to move over the file with debugging symbols.

Will fix ASAP. Remember though that stacktraces created by nightly builds can not be passed to the stacktraceTranslator!
Post Reply

Return to “Engine”