Author Topic: Debugging code Help  (Read 6947 times)

Offline Дмитро

  • Multiple posting newcomer
  • *
  • Posts: 101
Debugging code Help
« on: June 22, 2016, 12:41:37 am »
Good night!
I decided to try establishing a kodeblok.
Nastromyv I couple of breakpoints.
And I ran across a couple of breakpoints.
Do not stop them!
No, do not stop passing by.
The function performed approximately three times or more,
only then stops on that delete [] Ves_masyv [J];
zhovtenkyy drawing a triangle.
How would a breakpoint that good?
I did not know how.
« Last Edit: June 22, 2016, 12:43:36 am by Дмитро »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2566
Re: Debugging code Help
« Reply #1 on: June 22, 2016, 01:04:11 am »
have you enabled the debugging symbols, and disabled any optimization? If optimization is turned on, it could be that your break point code is optimized out... (check for -O flags in the project build options and turn them off)

Offline Дмитро

  • Multiple posting newcomer
  • *
  • Posts: 101
Re: Debugging code Help
« Reply #2 on: June 22, 2016, 01:16:34 am »
Thank you, BlueHazzard!
I did not set any flags.
Now I'll check.



There is only one flag, -g, no more
no.
« Last Edit: June 22, 2016, 01:24:23 am by Дмитро »

Offline Дмитро

  • Multiple posting newcomer
  • *
  • Posts: 101
Re: Debugging code Help
« Reply #3 on: June 22, 2016, 01:43:26 am »
Look no screen required.
Especially important is nothing.







« Last Edit: June 22, 2016, 02:01:45 am by Дмитро »

Offline Дмитро

  • Multiple posting newcomer
  • *
  • Posts: 101
Re: Debugging code Help
« Reply #4 on: June 22, 2016, 11:51:36 am »




So what? Maybe I'm on the wrong button, shake, or something wrong done? Or what?



That compiler flags - only one flag is no more at all.
« Last Edit: June 22, 2016, 11:55:50 am by Дмитро »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2566
Re: Debugging code Help
« Reply #5 on: June 22, 2016, 02:55:34 pm »
Hi, sory i am on my phone, so the answer may be not 100% correct, but you will get the idea.
1) the settings about optimization is under
Project->build options->compiler settings
Make sure you have selected "debug" on the left side.
Make sure you use the debug target for using the debugger:
Select "debug" in the dropdown menu near the build button

2) you put the breakpoint in a decleration line. The compiler may ignore this line, try to place the breakpoint ine line 161 instead...

3) the debugger stops at the delete, because your application crashes there, probably you delete some wrong\incorrect pointer...
I have no idea, why you get a sigtrap at the delete.... If you delete a corupt pointer you get a sig segfault...

Greetings
« Last Edit: June 22, 2016, 04:36:03 pm by BlueHazzard »

Offline Дмитро

  • Multiple posting newcomer
  • *
  • Posts: 101
Re: Debugging code Help
« Reply #6 on: June 23, 2016, 12:40:25 am »
Thank you! So I'm kind of doing so.
It is already late, the second half of the night, or the day after tomorrow I will think carefully.

More. I'm not sure I understand.
Select "debug" in the dropdown menu near the build button


I put a lot of break points in various locations and functions.

« Last Edit: June 23, 2016, 12:46:30 am by Дмитро »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2566
Re: Debugging code Help
« Reply #7 on: June 23, 2016, 12:51:38 am »
Quote
I put a lot of break points in various locations and functions.
And none worked?

Offline Дмитро

  • Multiple posting newcomer
  • *
  • Posts: 101
Re: Debugging code Help
« Reply #8 on: June 23, 2016, 10:29:32 am »

    The same. Really nobody worked.

I actually started to ask in the forum, after pyat or six hours tried to do something on their own.
« Last Edit: June 23, 2016, 10:43:26 am by Дмитро »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2566
Re: Debugging code Help
« Reply #9 on: June 23, 2016, 11:46:33 pm »
strange,

can you please post a full rebuild log (Build->Rebuild) and copy and post it here. Don't use a image, but post the actual "BUILD LOG"

then please start the debugger and post the debug log (the content of the log window from your screenshot) here.

To post this logs please paste it inside code tags (the # symbol in the new post editor)

greetings

Offline Дмитро

  • Multiple posting newcomer
  • *
  • Posts: 101
Re: Debugging code Help
« Reply #10 on: June 24, 2016, 05:34:38 pm »

Code: [Select]
-------------- Clean: default in Pars1 (compiler: GNU GCC Compiler)---------------

Cleaned "Pars1 - default"

-------------- Build: default in Pars1 (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -g -g -fpermissive  -c "C:\Копия PISDETS-22\NOW\Pars_utf8.cpp" -o .objs\Pars_utf8.o
C:\Копия PISDETS-22\NOW\Pars_utf8.cpp: В функции «void print_symbols(in_iterator, in_iterator, std::ofstream&, char***, int*, spilna_pamyat*)»:
C:\Копия PISDETS-22\NOW\Pars_utf8.cpp:120:55: предупреждение: «nakopychuvach» не имеет аргументов, зависящих от параметра-шаблона, поэтому должна быть доступна декларация «nakopychuvach» [-fpermissive]
  nakopychuvach(Symbol, Ves_masyv, ZastarivPamjatay, Ps);
                                                       ^
C:\Копия PISDETS-22\NOW\Pars_utf8.cpp: В функции «void nakopychuvach(char*, char***, int*, spilna_pamyat*)»:
C:\Копия PISDETS-22\NOW\Pars_utf8.cpp:263:40: предупреждение: некорректное преобразование из «char*» в «char» [-fpermissive]
      dokument[NUMRYADOK][ NUMZNAK ][0] = Symbol;
                                        ^
mingw32-g++.exe  -o Pars1.exe .objs\Pars_utf8.o  -static-libgcc 
Output file is Pars1.exe with size 164,87 KB
Process terminated with status 0 (0 minute(s), 19 second(s))
2 error(s), 0 warning(s) (0 minute(s), 20 second(s))
 



I think it's probably 90%, I make a mistake.
Nevertheless, I can not understand where I am wrong.
I apologize in advance.

Please log here restructuring.


This is what you asked? I understood correctly?


I also attach the debugger.
I do not know, maybe it does not matter.
However, I will do.

Code: [Select]
Building to ensure sources are up-to-date
Selecting target:
default
Adding source dir: C:\Копия PISDETS-22\NOW\
Adding source dir: C:\Копия PISDETS-22\NOW\
Adding file: C:\Копия PISDETS-22\NOW\Pars1.exe
Changing directory to: C:/PISDET~2/NOW/.
Set variable: PATH=.;C:\MinGW\bin;C:\MinGW;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;C:\Program Files\TortoiseSVN\bin;C:\Strawberry_Perl\c\bin;C:\Strawberry_Perl\perl\site\bin;C:\Strawberry_Perl\perl\bin
Starting debugger: C:\MinGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/PISDET~2/NOW/Pars1.exe
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.6.1
Child process PID: 1656
Program received signal SIGTRAP, Trace/breakpoint trap.
In ntdll!DbgBreakPoint () (C:\WINDOWS\system32\ntdll.dll)
#11 0x00401c8c in _fu9___ZSt4cout () at C:\Копия PISDETS-22\NOW\Pars_utf8.cpp:280
C:\Копия PISDETS-22\NOW\Pars_utf8.cpp:280:6111:beg:0x401c8c
At C:\Копия PISDETS-22\NOW\Pars_utf8.cpp:280
« Last Edit: June 24, 2016, 06:44:33 pm by Дмитро »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12122
    • Travis build status
Re: Debugging code Help
« Reply #11 on: June 24, 2016, 07:44:47 pm »
Don't use paths with spaces, other strange characters, Cyrillic characters and so on. Using such characters is known to fail.

Read this also: http://wiki.codeblocks.org/index.php/Debugging_with_Code::Blocks
(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 Дмитро

  • Multiple posting newcomer
  • *
  • Posts: 101
Re: Debugging code Help
« Reply #12 on: June 25, 2016, 06:35:55 pm »

Thank you!
Please, please specify how reliable that is going version - debuh version or release version? which of them exactly?

And sure created debug version? What evidence, testimony signs?
What do kodebloke regulation should apply, I usually can get confused and not know it, and probably it is, because I'm only mastering this Wednesday.

How to change version? Maybe it's my inability chi bug associated with the not the version?
« Last Edit: June 25, 2016, 07:07:40 pm by Дмитро »

Offline Дмитро

  • Multiple posting newcomer
  • *
  • Posts: 101
Re: Debugging code Help
« Reply #13 on: June 25, 2016, 09:34:06 pm »
Blurted out! It works as it should.
You know, I do not understand what has changed.
I tried to change the way the compiler to use the other ... He returned to the still. Like all the same.
Trinket work!

Building to ensure sources are up-to-date
Selecting target:
default
Adding source dir: C:\S22\NOW\
Adding source dir: C:\S22\NOW\
Adding file: C:\S22\NOW\Pars1.exe
Changing directory to: C:/S22/NOW/.
Set variable: PATH=.;C:\MinGW\bin;C:\MinGW;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;C:\Program Files\TortoiseSVN\bin;C:\Strawberry_Perl\c\bin;C:\Strawberry_Perl\perl\site\bin;C:\Strawberry_Perl\perl\bin
Starting debugger: C:\MinGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/S22/NOW/Pars1.exe
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.6.1
Child process PID: 1636
At C:\S22\NOW\Pars_utf8.cpp:148

Offline Дмитро

  • Multiple posting newcomer
  • *
  • Posts: 101
Re: Debugging code Help
« Reply #14 on: June 28, 2016, 11:36:04 pm »
Code: [Select]
if(Ves_masyv!=NULL){

 for( int i = 0; i <= NUMRYADOK+1; ++i )
  {
        for( int J = 0; J <= ZastarivPamjatay[NUMRYADOK]+1; ++J )
   {

        delete[] Ves_masyv[ i ][J];

   }


  }

Debugger, itself stops here on this site.

I was not completely satisfied. Debugged program is better, so that it falls at once, and sometimes passing this place for the fortieth time or more. Cycle itself also remove more than the larger.
How to make the program go straight to the collapse of the space? What would stop took place exactly on the line when she fell program own catching collapse.
« Last Edit: June 28, 2016, 11:38:10 pm by Дмитро »