Stacktrace autoprint

Stacktrace autoprint

Postby paul424 » 18 Jun 2014, 00:43

Bertram and others , could you try branch 'paul424-stacktrace' .
I put the code to print the stacktrace, though it might need some slight modifications ; just try to crash the game ( like starttileculling )
I wonder whether it can be build on WIndows as well . Please test and merge into , if it works fine ...
User avatar
paul424
OD Moderator
 
Posts: 660
Joined: 24 Jan 2012, 13:54

Re: Stacktrace autoprint

Postby Bertram » 19 Jun 2014, 20:31

Hi Paul, :)

First of all, thank you for commiting this in a separate branch. :)

Here are my first comments on the stacktrace 2 first commits.
The code style looks fine but there are two things you should do:
- First of all, you should move the code and includes within a separate cpp file.
- Secondly, for unsupported platforms, such as osx, the code should disable itself instead of provoking an error.

- The whole indentation of this code block below is broken.
- This block should be put within a function and called from there. You could then simply not call the function when the platform isn't supported.
struct sigaction sigact; <-- The word struct shouldn't be here.
+
+sigact.sa_sigaction = crit_err_hdlr;
+sigact.sa_flags = SA_RESTART | SA_SIGINFO;
+
+if (sigaction(SIGSEGV, &sigact, (struct sigaction *)NULL) != 0)
+{
+fprintf(stderr, "error setting signal handler for %d (%s)\n",
+ SIGSEGV, strsignal(SIGSEGV));
+
+exit(EXIT_FAILURE);
+}

Could you fix all that?

thanks
User avatar
Bertram
VT Moderator
 
Posts: 1652
Joined: 09 Nov 2012, 12:26

Re: Stacktrace autoprint

Postby Dm3d » 19 Jun 2014, 22:09

Hello paul, I've tried this build on linux mint 17 and I managed to crash the game by enabling culling, holding one of the rotate camera buttons down(E) and moving the camera around rapidly for a short period of time.

I don't have much experience with this :oops:, so bear with me. I ran the .bin in gdb and this was the output(I had to hand copy it since I lose interface control inside game).
{l Code}: {l Select All Code}
1
0
1
3
1
3
1

Program received signal SIGSEGV, Segmentation fault. 0x00007ffff5e90508 in std::basic_string <char, std::char_traits<char>,
 std::allocator<char> >::basic_string (std::string const&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6


I'm not sure if this is the information you're looking for.
Dm3d
 
Posts: 57
Joined: 10 Jun 2014, 16:08

Re: Stacktrace autoprint

Postby paul424 » 19 Jun 2014, 23:07

Well , with my new branch you should get similar result, except you would get the WHOLE STACKTRACE , not only the first frame ( that is the instnce of the function which blundered the program) . Heh , are you any good in Computer Science ?
Ahh you run GDB ... now you would get a detailed stacktrace everytime the game crashes, isn't that nice ?
Well I knew about this error. Sorry for large delays, we have political earthquake in Poland, nobody knows whether to cry of laugh ...
User avatar
paul424
OD Moderator
 
Posts: 660
Joined: 24 Jan 2012, 13:54

Re: Stacktrace autoprint

Postby Dm3d » 20 Jun 2014, 04:06

Oh, so that information was from gdb itself? how do you get the stack trace from your build directly?
paul424 {l Wrote}:Heh , are you any good in Computer Science ?

I'm kind of a beginner at it. I can hack together various libraries to make a very simplistic application. but I don't have a good enough grasp on the architectural and theory side of it to really go beyond that.
paul424 {l Wrote}:Ahh you run GDB ... now you would get a detailed stacktrace everytime the game crashes, isn't that nice ?

Definitely makes life a lot easier. sadly,I've never really been in a situation where I had to actually use it... so it's still mostly a mystery to me.
paul424 {l Wrote}:Sorry for large delays, we have political earthquake in Poland, nobody knows whether to cry of laugh ...

No worries, it's fine.
Dm3d
 
Posts: 57
Joined: 10 Jun 2014, 16:08

Re: Stacktrace autoprint

Postby Bertram » 20 Jun 2014, 09:10

Sorry for large delays, we have political earthquake in Poland, nobody knows whether to cry of laugh ...

I'm very sorry to hear that, Paul. I hope things will sort out for your country soon.
User avatar
Bertram
VT Moderator
 
Posts: 1652
Joined: 09 Nov 2012, 12:26

Re: Stacktrace autoprint

Postby paul424 » 21 Jun 2014, 23:12

All done , what you asked for , except Apple's main CPU is for a long time Intel's CPU : ( speaking of OSX platform ) :
http://www.pcworld.co.uk/gbuk/desktop-pc-monitors/desktop-pcs/apple-desktops/706_7027_70027_xx_xx/xx-criteria.html

So this code should just work on all CPU's right ? Well we lack IA_64 (italianum )
User avatar
paul424
OD Moderator
 
Posts: 660
Joined: 24 Jan 2012, 13:54

Re: Stacktrace autoprint

Postby Bertram » 22 Jun 2014, 12:09

Indeed, it looks better. :)

Yet you forgot the new files copyright headers. ;)
I've got a little readability change related to your patch in mind. I think you can merge (and add copyright headers if you have the time an will),
and I try the thing I have in mind based on this.
User avatar
Bertram
VT Moderator
 
Posts: 1652
Joined: 09 Nov 2012, 12:26

Re: Stacktrace autoprint

Postby oln » 22 Jun 2014, 13:58

The code looks like it's from here. Doesn't give any license info though (though stackoverflow TOU says things posted are CC-BY-SA).
User avatar
oln
 
Posts: 1020
Joined: 26 Oct 2010, 22:16
Location: Norway

Re: Stacktrace autoprint

Postby paul424 » 22 Jun 2014, 14:09

Yeap , it is from there , if he does not give license , then what should I do , oln ?
User avatar
paul424
OD Moderator
 
Posts: 660
Joined: 24 Jan 2012, 13:54

Re: Stacktrace autoprint

Postby charlie » 22 Jun 2014, 14:20

CC-by-SA apparently. TBH though, it's not an issue. This is public domain stuff. Nobody will give a damn if you copy/paste from SO answers. I know that might sound flippant, but this is an entirely different scenario to copying somebody's project code. People who post answers on SO do so in order to help everybody. They don't do it to hold you to some attribution clause. 99% of posters won't even know about this CC-by-SA.

http://meta.stackexchange.com/questions ... ny-license
Free Gamer - it's the dogz
Vexi - web UI platform
User avatar
charlie
Global Moderator
 
Posts: 2131
Joined: 02 Dec 2009, 11:56
Location: Manchester, UK

Re: Stacktrace autoprint

Postby paul424 » 22 Jun 2014, 18:37

Bertram : ok done
User avatar
paul424
OD Moderator
 
Posts: 660
Joined: 24 Jan 2012, 13:54

Re: Stacktrace autoprint

Postby Bertram » 22 Jun 2014, 21:18

Cool.

Can you merge it back to development?

EDIT: Could you also have a look at my repo and tell me whether I can merge the latest stuff?

Regards,
User avatar
Bertram
VT Moderator
 
Posts: 1652
Joined: 09 Nov 2012, 12:26

Re: Stacktrace autoprint

Postby MCMic » 23 Jun 2014, 10:44

@Dm3d: With gdb you can use "bt" or "backtrace" to see the call trace after a crash (but on my computer OD does not give me my keyboard back so I’m stuck…)
User avatar
MCMic
 
Posts: 723
Joined: 05 Jan 2010, 17:40

Re: Stacktrace autoprint

Postby Bertram » 23 Jun 2014, 11:33

Ah yes, we need to add the cegui parameter we talked about before.
Need to find that back.
User avatar
Bertram
VT Moderator
 
Posts: 1652
Joined: 09 Nov 2012, 12:26

Re: Stacktrace autoprint

Postby paul424 » 23 Jun 2014, 19:26

"Ah yes, we need to add the cegui parameter we talked about before.
Need to find that back."

Ehem which cegui parameter ?
User avatar
paul424
OD Moderator
 
Posts: 660
Joined: 24 Jan 2012, 13:54

Re: Stacktrace autoprint

Postby Bertram » 23 Jun 2014, 21:47

Ehem which cegui parameter ?


Found it back:
https://github.com/Bertram25/OpenDungeo ... d5bb1e8751
With this patch, you can still play the game but use gdb freely also. This will ease OD development a lot.

Regards,
User avatar
Bertram
VT Moderator
 
Posts: 1652
Joined: 09 Nov 2012, 12:26

Re: Stacktrace autoprint

Postby paul424 » 23 Jun 2014, 22:17

My first and foremost intention was to have always stacktrace behind our eyes after the game crash, whatever the user or programmer is runnning OD , so there is some info of what went wrong , instead of the >> black box's << cog wheels got stuck ...
User avatar
paul424
OD Moderator
 
Posts: 660
Joined: 24 Jan 2012, 13:54

Re: Stacktrace autoprint

Postby Bertram » 23 Jun 2014, 23:24

My first and foremost intention was to have always stacktrace behind our eyes after the game crash, whatever the user or programmer is runnning OD , so there is some info of what went wrong , instead of the >> black box's << cog wheels got stuck ...

Sure, that feature isn't incompatible with the other, don't worry.
User avatar
Bertram
VT Moderator
 
Posts: 1652
Joined: 09 Nov 2012, 12:26

Re: Stacktrace autoprint

Postby Dm3d » 26 Jun 2014, 01:59

MCMic {l Wrote}:@Dm3d: With gdb you can use "bt" or "backtrace" to see the call trace after a crash (but on my computer OD does not give me my keyboard back so I’m stuck…)


ah, thanks for the tip! that was the same problem I had. if it crashed the only way I could regain control was to close terminal window.

Bertram {l Wrote}:
Ehem which cegui parameter ?


Found it back:
https://github.com/Bertram25/OpenDungeo ... d5bb1e8751
With this patch, you can still play the game but use gdb freely also. This will ease OD development a lot.

Regards,


Thanks Bertram, that did the trick! :D
Dm3d
 
Posts: 57
Joined: 10 Jun 2014, 16:08

Re: Stacktrace autoprint

Postby Bertram » 26 Jun 2014, 08:59

You're welcome. :)

I had to revert that patch to prevent breaking MCmic's environment, but you can change the value back to false anytime when willing to debug.

Regards,
User avatar
Bertram
VT Moderator
 
Posts: 1652
Joined: 09 Nov 2012, 12:26

Who is online

Users browsing this forum: No registered users and 1 guest