User forums > Using Code::Blocks

DEBUGGING problem

(1/4) > >>

Skeezix:
my problem is this i followed the instruction on the wiki about debugging and watching a variable but thew problem is my debugger is way to fast...i think its not even using the breakpoints i assigned,it just stopped to get input then zoom its over already..can you help me on this..maybe a step by step process on how to use the debbugger...also is there a way to step line per line in the debugger?

thanks

Pecan:
http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/codeblocks-instructions.pdf

See the section on debugging a program.

Skeezix:
ive already tried that article...the problem is when i click on 'run to cursor' the other option for debugging cant be click any more also it doesnt do what the article said it would do...

Skeezix:
here is my code:

--- Code: ---#include <iostream>
#include <iomanip>

using namespace std;

void Seive( int test, int *ar, int bound );

int main()
{
   int x=5;
   cout<<x;
   cout << "Input the largest number to get the primes:" << endl;
   int limit = 0;
   cin >> limit;
   int bound = limit + 1;
   int array[bound];
   for ( int i = 0;i < bound;++i )
   {
      array[i] = 1;
   }
   array[0] = array[1] = 0;
   Seive( 2, array, bound );
   Seive( 3, array, bound );
   Seive( 5, array, bound );
   Seive( 7, array, bound );

   cout << "PRIME NUMBERS" << endl;
   int p = 0 ;
   for ( int i = 0; i < bound;++i )
   {
      if ( array[i] != 0 )
      {
         cout << setw( 5 ) << i << " ";
         ++p;
         if ( !( p % 4 ) )
         {
            cout << endl;
         }
      }
   }

   return 0;
}

void Seive( int test, int *ar, int bound )
{
   int mod = 0;
   for ( int i = 0;i < bound;++i )
   {
      mod = i % test;
      if ( mod == 0 && i != test )
      {
         ar[i] = 0;
      }
   }
}


--- End code ---
here is the output when i used 'runto cursor'


Starting debugger:
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
(no debugging symbols found)
Debugger name and version: GNU gdb 6.7.50.20071127
No symbol table is loaded.  Use the "file" command.
No symbol table is loaded.  Use the "file" command.
No symbol table is loaded.  Use the "file" command.
Child process PID: 3548 /***it stops here for a while to get the input then continued to the finished***/
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
Program exited normally.
Debugger finished with status 0

BCCISProf:
Hi,

Do you have the Build target set as Debug?

I just ran your code, and it worked exactly as described in the manual. I was able to run to cursor, run to breakpoints, step in, etc. and use the watch window.

Navigation

[0] Message Index

[#] Next page

Go to full version