Author Topic: DEBUGGING problem  (Read 11949 times)

Offline Skeezix

  • Single posting newcomer
  • *
  • Posts: 8
DEBUGGING problem
« on: April 09, 2008, 12:35:04 am »
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

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: DEBUGGING problem
« Reply #1 on: April 09, 2008, 01:33:31 am »

Offline Skeezix

  • Single posting newcomer
  • *
  • Posts: 8
Re: DEBUGGING problem
« Reply #2 on: April 09, 2008, 11:26:48 pm »
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...

Offline Skeezix

  • Single posting newcomer
  • *
  • Posts: 8
Re: DEBUGGING problem
« Reply #3 on: April 09, 2008, 11:39:12 pm »
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;
      }
   }
}

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


Offline BCCISProf

  • Multiple posting newcomer
  • *
  • Posts: 60
    • Professor Langsam's Home Page
Re: DEBUGGING problem
« Reply #4 on: April 10, 2008, 01:22:48 am »
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.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: DEBUGGING problem
« Reply #5 on: April 10, 2008, 08:25:33 am »
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
De debugger is so kind to tell you several times what your probelm is. Please enable debugging symbols for compilation (and probably linking, depending on your compiler suite). Keep in mind that you have to do a re-build for the changes to take effect.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Skeezix

  • Single posting newcomer
  • *
  • Posts: 8
Re: DEBUGGING problem
« Reply #6 on: April 11, 2008, 04:22:05 pm »
i followed the instruction STEP BY STEP so yes i check the generate debbuging symbols..or something like that

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: DEBUGGING problem
« Reply #7 on: April 11, 2008, 04:29:27 pm »
i followed the instruction STEP BY STEP so yes i check the generate debbuging symbols..or something like that
Make sure that (in addition) you *don't* have stripping symbols (-s) and any optimisation enabled(-O1... -On). Otherwise please post a minimal example project here for us to try.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline BCCISProf

  • Multiple posting newcomer
  • *
  • Posts: 60
    • Professor Langsam's Home Page
Re: DEBUGGING problem
« Reply #8 on: April 11, 2008, 10:58:18 pm »
i followed the instruction STEP BY STEP so yes i check the generate debbuging symbols..or something like that
Make sure that (in addition) you *don't* have stripping symbols (-s) and any optimisation enabled(-O1... -On). Otherwise please post a minimal example project here for us to try.

I tried his code that he gave above and the debugger worked perfectly. I wonder if he is using a project or just compiling and trying to debug the .cpp file alone.

Offline Skeezix

  • Single posting newcomer
  • *
  • Posts: 8
Re: DEBUGGING problem
« Reply #9 on: April 12, 2008, 07:51:20 am »
i followed the instruction STEP BY STEP so yes i check the generate debbuging symbols..or something like that
Make sure that (in addition) you *don't* have stripping symbols (-s) and any optimisation enabled(-O1... -On). Otherwise please post a minimal example project here for us to try.
i tried what you said but its still not working

[attachment deleted by admin]

Offline Skeezix

  • Single posting newcomer
  • *
  • Posts: 8
Re: DEBUGGING problem
« Reply #10 on: April 12, 2008, 07:54:26 am »
try this file the first one is wrong

[attachment deleted by admin]

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: DEBUGGING problem
« Reply #11 on: April 12, 2008, 10:05:36 am »
I tried your project, worked perfectly (on OpenSuse 10.2).
Your project file looks OK, so those settings are ok.


Could you post the full building log.
To see this do : Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"

and then do rebuild all and paste the build log.

Offline Skeezix

  • Single posting newcomer
  • *
  • Posts: 8
Re: DEBUGGING problem
« Reply #12 on: April 12, 2008, 01:40:41 pm »
I tried your project, worked perfectly (on OpenSuse 10.2).
Your project file looks OK, so those settings are ok.


Could you post the full building log.
To see this do : Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"

and then do rebuild all and paste the build log.

Building Log:
Quote
mingw32-g++.exe -Wall -g -fexceptions  -g  -O1 -O  -g    -c "C:\IDEandCompilers\CodeBlocks\PROJS\Sieve of Eratosthenes\main.cpp" -o obj\Debug\main.o
mingw32-g++.exe  -o "bin\Debug\Sieve of Eratosthenes.exe" obj\Debug\main.o   -s 
Output size is 270.50 KB
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 0 warnings

Also here are the info he debugger(log) ouputed:
Quote
Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Adding source dir: C:\IDEandCompilers\CodeBlocks\PROJS\Sieve of Eratosthenes\
Adding source dir: C:\IDEandCompilers\CodeBlocks\PROJS\Sieve of Eratosthenes\
Adding file: bin\Debug\Sieve of Eratosthenes.exe
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.
Child process PID: 3552
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
Program exited normally.
Debugger finished with status 0

Offline ironhead

  • Almost regular
  • **
  • Posts: 210
Re: DEBUGGING problem
« Reply #13 on: April 12, 2008, 02:30:04 pm »
Building Log:
Quote
mingw32-g++.exe -Wall -g -fexceptions  -g  -O1 -O  -g    -c "C:\IDEandCompilers\CodeBlocks\PROJS\Sieve of Eratosthenes\main.cpp" -o obj\Debug\main.o
mingw32-g++.exe  -o "bin\Debug\Sieve of Eratosthenes.exe" obj\Debug\main.o   -s 
Output size is 270.50 KB
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 0 warnings

You are stripping the debug symbols from your executable when you are linking (as MortenMacFly menitoned, see the '-s' above).

Offline Skeezix

  • Single posting newcomer
  • *
  • Posts: 8
Re: DEBUGGING problem
« Reply #14 on: April 12, 2008, 03:43:35 pm »
how do i turn it off...i already did the Project->Build Options->Compiler settings thing