Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Micky on July 01, 2011, 02:48:23 pm

Title: Runtime error detection
Post by: Micky on July 01, 2011, 02:48:23 pm
Have a nice day, all!

Receiving some, e.g.,"Process returned -1073741571 (0xC00000FD) execution time : 3.328 s" runtime error from a console application started from the OS (WinXP) or within the IDE, is there a way to locate this error in the code? Alternatively, debugging the lousy code within the IDE, I get some stack window, sometimes with lines (giving some right click options), but I'm totally unaware of any way to localize the error in the code (these right click options don't work).

In Borland's Pascal there was (maybe is) a fine working option "Find Error", exactly for my needs, does codeblocks offer any possibilities in that direction?

Thanks a lot and best to you.
Title: Re: Runtime error detection
Post by: stahta01 on July 01, 2011, 02:56:56 pm
You Compiler Name and Version?
Note: Code::Blocks is NOT a Compiler!

Tim S.
Title: Re: Runtime error detection
Post by: oBFusCATed on July 01, 2011, 03:15:57 pm
Your program most probably crashed and you need to debug it.
You can use a debugger or printf...

Install a debugger's branch nightly build and try again (hitting f8 or debug->start). There the debugger works better.

p.s. You need to have gdb installed on you system.
Title: Re: Runtime error detection
Post by: Micky on July 01, 2011, 03:30:48 pm
IDE is 10.05, the compiler is MinGW from about April last year (don't know how to retrieve the correct version number). Also, gdb is installed and running fine. The problem is not that I'm not familiar with a debugger or that it isn't installed at all, it's more that endless search within some recursive (...) procedure. And, oh yes, I feel familiar too with the printf-debugging :D Simply thought, I could somewhere enter that (probably) "0xC00000FD" hex number and OK-find the bad bad line ....
Title: Re: Runtime error detection
Post by: stahta01 on July 01, 2011, 03:35:26 pm
from the MinGW GCC compiler header winbase.h

Code
#define STATUS_STACK_OVERFLOW 0xC00000FD

Your stack has overflowed; you likely need to find the bug in your code and fix it.

Edit: This is NOT an Code::Blocks topic; so this thread could be locked at any time by admin.

Tim S.
Title: Re: Runtime error detection
Post by: Micky on July 01, 2011, 03:39:53 pm
That was assumed. Adding that #define to my code could will help? (And with all respect to my code - lol! - I know, that it is wrong:D)

Edit: I beg yor pardon for having stressed the wrong forum!
Title: Re: Runtime error detection
Post by: stahta01 on July 01, 2011, 03:47:37 pm
That was assumed. Adding that #define to my code could will help? (And with all respect to my code - lol! - I know, that it is wrong:D)

Edit: I beg yor pardon for having stressed the wrong forum!

This IS NOT a site that teaches programming; if you read and understood the rules; you would likely realize this fact. The purpose of this site is to help users to use Code::Blocks NOT teach them any programming language.

Edit: From http://forums.codeblocks.org/index.php/topic,9996.0.html

Quote
1. This is NOT a general programming board. "How do I write a program that....", "Can anybody teach me how to", "I have this homework", "My program doesn't run and I don't have the slightest idea of why because I'm a C++ newcomer", "What is a compiler", "What does gcc do" is the kind of questions that is FORBIDDEN to ask.

2. Compiler errors are NOT Code::Blocks errors. Usually, C++ newcomers tend to confuse the Editor/IDE (Code::Blocks) with the Compiler (MINGW / GCC). You may see some errors in the compiler output because you missed to do something right in your code. But that's not Code::Blocks troubleshooting, that's C++ troubleshooting and does not belong in here. If your program doesn't compile, READ THE C++ MANUAL.

Tim S.
Title: Re: Runtime error detection
Post by: Micky on July 01, 2011, 04:07:22 pm
Please note, the existence of a "Find-error"-option, isn't that a codeblocks question?

And, obviously, I have to repeat it: I beg your pardon!
Title: Re: Runtime error detection
Post by: stahta01 on July 01, 2011, 04:40:22 pm
I suggest running gdb directly to look for the problem; but, this is not a valid topic for this site.
http://cboard.cprogramming.com/c-programming/139058-unsolved-segmentation-fault-2.html#post1035068

Note: The other poster (oBFusCATed) suggested using the newer debugger builds; they might be easier for you to trouble shoot the problem; but, you need to be able to use a nightly debugger build; I have no idea if the debugger builds will help you. http://forums.codeblocks.org/index.php/topic,14916.0.html

Tim S.
Title: Re: Runtime error detection
Post by: oBFusCATed on July 01, 2011, 04:44:53 pm
Please note, the existence of a "Find-error"-option, isn't that a codeblocks question?
What does this option do, exactly? I've not used BP for almost 10 years... and I don't remember such option...
Title: Re: Runtime error detection
Post by: Micky on July 01, 2011, 04:50:37 pm
Imagine that scenario:

1) You're running a console-app which crashes and gives you a hex-value of the runtime error.
2) Then you return to your ide, use the "Find Error" option, paste that hex and, after OK, you're sent to the buggy line.
Title: Re: Runtime error detection
Post by: oBFusCATed on July 01, 2011, 05:05:14 pm
Use the debugger. It does the same and it does it automatically.

The problem is that the debugger support in 10.05 is not that good and we have a special branch, where we've done many improvements to the debugger.
The other option is to use gdb directly (search the net for tutorials).
Title: Re: Runtime error detection
Post by: Micky on July 01, 2011, 05:21:10 pm
Final thanks.