Author Topic: Runtime error detection  (Read 22001 times)

Offline Micky

  • Single posting newcomer
  • *
  • Posts: 8
Runtime error detection
« 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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Runtime error detection
« Reply #1 on: July 01, 2011, 02:56:56 pm »
You Compiler Name and Version?
Note: Code::Blocks is NOT a Compiler!

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Runtime error detection
« Reply #2 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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Micky

  • Single posting newcomer
  • *
  • Posts: 8
Re: Runtime error detection
« Reply #3 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 ....

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Runtime error detection
« Reply #4 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.
« Last Edit: July 01, 2011, 03:37:39 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Micky

  • Single posting newcomer
  • *
  • Posts: 8
Re: Runtime error detection
« Reply #5 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!
« Last Edit: July 01, 2011, 03:44:13 pm by Micky »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Runtime error detection
« Reply #6 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.
« Last Edit: July 01, 2011, 03:50:15 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Micky

  • Single posting newcomer
  • *
  • Posts: 8
Re: Runtime error detection
« Reply #7 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!

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Runtime error detection
« Reply #8 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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Runtime error detection
« Reply #9 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...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Micky

  • Single posting newcomer
  • *
  • Posts: 8
Re: Runtime error detection
« Reply #10 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.
« Last Edit: July 01, 2011, 04:57:56 pm by Micky »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Runtime error detection
« Reply #11 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).
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Micky

  • Single posting newcomer
  • *
  • Posts: 8
Re: Runtime error detection
« Reply #12 on: July 01, 2011, 05:21:10 pm »
Final thanks.