CEGUI::Exception Stack Trace

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

User avatar
tgraupmann
Quite a regular
Quite a regular
Posts: 78
Joined: Thu Aug 18, 2005 00:47
Contact:

CEGUI::Exception Stack Trace

Postby tgraupmann » Tue Nov 27, 2007 06:14

I'm looking at the CEGUI::Exception:

Code: Select all

class  CEGUIEXPORT Exception
{
public:
   /*************************************************************************
      Construction and Destruction
   *************************************************************************/
   Exception(const String& message);
   virtual ~Exception(void);

   /*!
   \brief
      Return a reference to the String object describing the reason for the exception being thrown.

   \return
      String object containing a message describing the reason for the exception.
   */
   const String&   getMessage(void) const      {return d_message;}


protected:
   String   d_message;
};


Why isn't there a way to get a stack trace? There isn't a place for function, file, or line number to be recorded. This would help with debugging...

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Tue Nov 27, 2007 11:42

If you are using the SVN version, then this might be what you are looking for: http://www.cegui.org.uk/phpBB2/viewtopic.php?t=2799

:)
Check out my released snake game using Cegui!

User avatar
fjeronimo
CEGUI Tools Developer (Retired)
Posts: 59
Joined: Tue Sep 11, 2007 16:57
Location: Lisbon, Portugal
Contact:

Postby fjeronimo » Tue Nov 27, 2007 13:54

Hi tgraupmann,

The SVN CEGUI trunk version already has line and file exception info (link scriptkid supplied above).

I'm currently working on adding stack trace to the CELayoutEditor - initially on windows platforms and later on linux. Unfortunately, there isn't a "standard" way of achieving this goal on all platforms and it isn't as trivial as it might sound at first (lots of little nuances)...

Also, on windows, without using nasty hacks that aren't guaranteed to work on all cases, there isn't an easy way to obtain the stack trace at the exception level itself. The safest and most efficient method is by using VEH (Vectored Exception Handling). This difficults inserting the stack trace mechanism inside CEGUI itself (which is why it is being handled in the CELayoutEditor application, where it can manage not only CEGUI exceptions but all thrown exceptions including fatal win32 ones).

Afterwards, I can perhaps create a tutorial document explaining how to do this in any other application that uses CEGUI (although this is generic and can be used in many other situations).

On linux, the backtrace() and backtrace_symbols() functions (execinfo.h) greatly ease the process and allow you to obtain stack trace at the exception level (e.g. exception->printStackTrace()).

I hope this helps. :)
Frederico Jerónimo
Ignite Games - http://www.ignite-games.com
Ignite Games Institutional Site - http://we.ignite-games.com

User avatar
tgraupmann
Quite a regular
Quite a regular
Posts: 78
Joined: Thu Aug 18, 2005 00:47
Contact:

Postby tgraupmann » Tue Nov 27, 2007 23:56

This is a nice feature to have. I'll wait for the official release. When do you think the next version of CEGUI will be coming out? Are you going to finish the port for all platforms first?

User avatar
fjeronimo
CEGUI Tools Developer (Retired)
Posts: 59
Joined: Tue Sep 11, 2007 16:57
Location: Lisbon, Portugal
Contact:

Postby fjeronimo » Wed Nov 28, 2007 11:51

It's still a little too soon to talk about a release date, but work is being done in that direction. :)

I'll start by finishing the Windows stack trace (on CELayoutEditor, not on CEGUI for the reasons stated above) which will be included in the next CELayoutEditor SVN update and then add linux stack trace (probably at exception level in CEGUI itself).

Then, at a later stage, I'll check if it is possible and desirable to add windows stack trace inside CEGUI itself (I'm guessing this will be quite a thorn)...

In the meantime, if you use CEGUI SVN trunk you'll get file and line info, which will already help in the debug process. :)
Frederico Jerónimo

Ignite Games - http://www.ignite-games.com

Ignite Games Institutional Site - http://we.ignite-games.com

User avatar
tgraupmann
Quite a regular
Quite a regular
Posts: 78
Joined: Thu Aug 18, 2005 00:47
Contact:

Postby tgraupmann » Wed Nov 28, 2007 20:35

For now, I've increased the CEGUI log level which helps with debugging. I'm slowly upgrading my layout files from CEGUI 4 to 5.

User avatar
fjeronimo
CEGUI Tools Developer (Retired)
Posts: 59
Joined: Tue Sep 11, 2007 16:57
Location: Lisbon, Portugal
Contact:

Postby fjeronimo » Thu Dec 06, 2007 20:42

There's a new update to the CELayoutEditor SVN trunk that adds stack trace support.

Check it here : http://www.cegui.org.uk/phpBB2/viewtopic.php?t=2821

:)
Frederico Jerónimo

Ignite Games - http://www.ignite-games.com

Ignite Games Institutional Site - http://we.ignite-games.com


Return to “Help”

Who is online

Users browsing this forum: No registered users and 14 guests