Author Topic: Can't abort the debuger  (Read 22237 times)

Offline Fik

  • Multiple posting newcomer
  • *
  • Posts: 12
Can't abort the debuger
« on: March 07, 2014, 11:33:58 pm »
This is really weird. I just installed Code Block so i can practice programming C for my university, but after the first, when I press Build and run, one window flashes then disappears instantly, and all I'm left with is a blank screen. Can't stop or abort the debuger..
Any help would be great!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can't abort the debuger
« Reply #1 on: March 08, 2014, 01:36:20 am »
OS, C::B version?
Full build log?
Full log from the debugger?

I'm a bit bad at guessing all of the above.  ::)
(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 Fik

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Can't abort the debuger
« Reply #2 on: March 08, 2014, 12:04:24 pm »
win 7 64 bit, latest C::B version (codeblocks-13.12mingw)

build log:
-------------- Build: Debug in practice (compiler: GNU GCC Compiler)---------------

Target is up to date.
Nothing to be done (all items are up-to-date).


-------------- Build: Debug in practice (compiler: GNU GCC Compiler)---------------

Target is up to date.
Nothing to be done (all items are up-to-date).


-------------- Run: Debug in practice (compiler: GNU GCC Compiler)---------------

Checking for existence: C:\Users\Nikola\Programming\practice\bin\Debug\practice.exe
Executing: "C:\Program Files (x86)\CodeBlocks/cb_console_runner.exe" "C:\Users\Nikola\Programming\practice\bin\Debug\practice.exe"  (in C:\Users\Nikola\Programming\practice\.)

and absolutely nothing shows up in the debugger log...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can't abort the debuger
« Reply #3 on: March 08, 2014, 12:48:37 pm »
and absolutely nothing shows up in the debugger log...
Of course it won't show up, you're not using the debugger. In order to use is you have to go to Debug -> Start, not to Project -> Run as you're doing at the moment.
This link might help you: http://wiki.codeblocks.org/index.php?title=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 Fik

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Can't abort the debuger
« Reply #4 on: March 08, 2014, 01:18:38 pm »
I have done the Debug into Start. Nothing happens, and again I can't stop the debugger

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can't abort the debuger
« Reply #5 on: March 08, 2014, 02:24:43 pm »
Post the full log from the debugger then (you have to enable full logging in the settings).
(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 Fik

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Can't abort the debuger
« Reply #6 on: March 08, 2014, 02:31:59 pm »
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\Users\Nikola\Programming\practice\
Adding source dir: C:\Users\Nikola\Programming\practice\
Adding file: C:\Users\Nikola\Programming\practice\bin\Debug\practice.exe
Changing directory to: C:/Users/Nikola/Programming/practice/.
Set variable: PATH=.;C:\Program Files (x86)\CodeBlocks\MinGW\bin;C:\Program Files (x86)\CodeBlocks\MinGW;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon

[debug]Command-line: C:\Program Files (x86)\CodeBlocks\MINGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/Users/Nikola/Programming/practice/bin/Debug/practice.exe
[debug]Working dir : C:\Users\Nikola\Programming\practice

Starting debugger: C:\Program Files (x86)\CodeBlocks\MINGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/Users/Nikola/Programming/practice/bin/Debug/practice.exe
done

[debug]> set prompt >>>>>>cb_gdb:

Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints

[debug]Reading symbols from C:\Users\Nikola\Programming\practice\bin\Debug\practice.exe...done.
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 7.5
[debug]Copyright (C) 2012 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "i686-pc-mingw32".
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (GDB) 7.5

[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]> set new-console on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Function "__cxa_throw" not defined.
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source C:\Program Files (x86)\CodeBlocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory C:/Users/Nikola/Programming/practice/
[debug]Source directories searched: C:/Users/Nikola/Programming/practice;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: C:\Users\Nikola\Programming\practice\bin\Debug\practice.exe

Oh I forgot to add, when I press Stop Debugger this shows up in the log : Trying to pause the running process...

« Last Edit: March 08, 2014, 02:46:42 pm by Fik »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can't abort the debuger
« Reply #7 on: March 08, 2014, 03:12:44 pm »
Hm, this is rather strange behaviour.
As far as I can see C::B hasn't detected the pid of your executable correctly.

Are you experienced enough to build C::B from source yourself?
I'll do a commit which adds a bit more logging, so problems like this will be more easy to debug in future versions.
(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 Fik

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Can't abort the debuger
« Reply #8 on: March 08, 2014, 03:19:41 pm »
I'm totally not experienced in this... I'm just a beginner

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Can't abort the debuger
« Reply #9 on: March 08, 2014, 03:23:36 pm »
I'll do a commit which adds a bit more logging, so problems like this will be more easy to debug in future versions.
Great, I remember that pid detection has no debug logging. If the received text(from GDB output) is cut, there is also no debug logging, maybe there are more. :)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can't abort the debuger
« Reply #10 on: March 08, 2014, 03:29:37 pm »
Fik: Then wait some days for the next night build and try it.
ollydbg: Can you test if the last commit builds on windows?
(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 ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Can't abort the debuger
« Reply #11 on: March 08, 2014, 03:32:20 pm »
I'm totally not experienced in this... I'm just a beginner
Can you try to set a breakpoint in the main() function? the first line of the main() function body, and post the debug log again here.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Can't abort the debuger
« Reply #12 on: March 08, 2014, 03:44:52 pm »
ollydbg: Can you test if the last commit builds on windows?
Yes, rev9674 builds OK under WinXP.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Fik

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Can't abort the debuger
« Reply #13 on: March 08, 2014, 04:25:09 pm »
I insterted a break point in the first line and started the debugger. This is what i got:

Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\Users\Nikola\Programming\practice\
Adding source dir: C:\Users\Nikola\Programming\practice\
Adding file: C:\Users\Nikola\Programming\practice\bin\Debug\practice.exe
Changing directory to: C:/Users/Nikola/Programming/practice/.
Set variable: PATH=.;C:\Program Files (x86)\CodeBlocks\MinGW\bin;C:\Program Files (x86)\CodeBlocks\MinGW;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon

[debug]Command-line: C:\Program Files (x86)\CodeBlocks\MINGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/Users/Nikola/Programming/practice/bin/Debug/practice.exe
[debug]Working dir : C:\Users\Nikola\Programming\practice

Starting debugger: C:\Program Files (x86)\CodeBlocks\MINGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/Users/Nikola/Programming/practice/bin/Debug/practice.exe
done

[debug]> set prompt >>>>>>cb_gdb:

Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints

[debug]Reading symbols from C:\Users\Nikola\Programming\practice\bin\Debug\practice.exe...done.
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 7.5
[debug]Copyright (C) 2012 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "i686-pc-mingw32".
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (GDB) 7.5

[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]> set new-console on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Function "__cxa_throw" not defined.
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source C:\Program Files (x86)\CodeBlocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory C:/Users/Nikola/Programming/practice/
[debug]Source directories searched: C:/Users/Nikola/Programming/practice;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> break "C:/Users/Nikola/Programming/practice/main.c:1"
[debug]Breakpoint 2 at 0x401342: file C:\Users\Nikola\Programming\practice\main.c, line 1.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: C:\Users\Nikola\Programming\practice\bin\Debug\practice.exe

oBF, the new build is gonna be put up for download or something?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can't abort the debuger
« Reply #14 on: March 08, 2014, 05:46:48 pm »
I insterted a break point in the first line and started the debugger. This is what i got:
...
[debug]Breakpoint 2 at 0x401342: file C:\Users\Nikola\Programming\practice\main.c, line 1.
Are you sure you have code that will be executed at line 1?
It is better to place a breakpoint at the first line of your main function. This is almost guaranteed to be executed.

oBF, the new build is gonna be put up for download or something?
See the night build sub-forum. There we have new builds roughly once a month.

p.s. please use code tags for pasting logs or other long texts
(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 Fik

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Can't abort the debuger
« Reply #15 on: March 08, 2014, 06:03:14 pm »

How do you even use a code tag?

I have no clue man, my program is the Hello World example

#include <stdio.h>
#include <stdlib.h>

int main()
{
    printf("Hello world!\n");
    return 0;
}

Thats all I have.
This program is definitely not beginner friendly, i might just end up using microsoft visual studio

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can't abort the debuger
« Reply #16 on: March 08, 2014, 06:34:09 pm »

How do you even use a code tag?
Press the # button in the forum's interface.


I have no clue man, my program is the Hello World example
...
Thats all I have.
This program is definitely not beginner friendly, i might just end up using microsoft visual studio
Hm, have you tried to put a breakpoint on the line after int main()?
Also why do you want to use a debugger?
Have you read a book about programming in c/c++?
(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 Fik

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Can't abort the debuger
« Reply #17 on: March 08, 2014, 06:41:23 pm »
Code
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\Users\Nikola\Prog. 1\fuck you\
Adding source dir: C:\Users\Nikola\Prog. 1\fuck you\
Adding file: C:\Users\Nikola\Prog. 1\fuck you\bin\Debug\fuck you.exe
Changing directory to: C:/Users/Nikola/PROG~1.1/FUCKYO~1/.
Set variable: PATH=.;C:\Program Files (x86)\CodeBlocks\MinGW\bin;C:\Program Files (x86)\CodeBlocks\MinGW;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon

[debug]Command-line: C:\Program Files (x86)\CodeBlocks\MINGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/Users/Nikola/PROG~1.1/FUCKYO~1/bin/Debug/FUCKYO~1.EXE
[debug]Working dir : C:\Users\Nikola\PROG~1.1\FUCKYO~1

Starting debugger: C:\Program Files (x86)\CodeBlocks\MINGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/Users/Nikola/PROG~1.1/FUCKYO~1/bin/Debug/FUCKYO~1.EXE
done

[debug]> set prompt >>>>>>cb_gdb:

Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints

[debug]Reading symbols from C:\Users\Nikola\PROG~1.1\FUCKYO~1\bin\Debug\FUCKYO~1.EXE...done.
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 7.5
[debug]Copyright (C) 2012 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "i686-pc-mingw32".
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (GDB) 7.5

[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]> set new-console on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source C:\Program Files (x86)\CodeBlocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory C:/Users/Nikola/PROG~1.1/FUCKYO~1/
[debug]Source directories searched: C:/Users/Nikola/PROG~1.1/FUCKYO~1;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> break "C:/Users/Nikola/Prog. 1/fuck you/main.cpp:5"
[debug]Breakpoint 2 at 0x40134a: file C:\Users\Nikola\Prog. 1\fuck you\main.cpp, line 5.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: C:\Users\Nikola\PROG~1.1\FUCKYO~1\bin\Debug\FUCKYO~1.EXE

That is what I get when I put a break point where int main () is.

I had programming C and C++ in high school, but that was 3,4 years ago.

And about your question about the debugger. I have no clue... our professor demonstrated a few examples in code block and all he clicked on was build and run, nothing else.
All I wanna do is write codes for practice and when I press build and run, I just want to see the cmd window come out with the results, nothing else
« Last Edit: March 08, 2014, 06:47:41 pm by Fik »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can't abort the debuger
« Reply #18 on: March 08, 2014, 06:53:34 pm »
Then you don't need the debugger...

Do you see the cmd window?
(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 Fik

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Can't abort the debuger
« Reply #19 on: March 08, 2014, 07:03:31 pm »
Yes I do, but as i told you in the first page, one cmd window flashes then disappears right afterwards, and all I'm left is with a another BLANK cmd window.
It doesn't close when I press X, instead I must press the red x (abort button) in the UI to close it, but after that the red x button is still there and the run and build buttons are greyed out...
« Last Edit: March 08, 2014, 07:05:23 pm by Fik »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can't abort the debuger
« Reply #20 on: March 08, 2014, 07:24:00 pm »
But this problem is not related to the debugger!

I'm not using windows lately, so I don't know why you're getting this problem.
Have you tried to disable your anti virus software, if you're using any?
Have you searched the forum for related problems?
Have you tried to put getch(); or getchar(); at the end of main function?
(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 Fik

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Can't abort the debuger
« Reply #21 on: March 08, 2014, 07:27:26 pm »
I have disabled my anti-virus (I use avast)
when i add getch() at the end of the main function i get this message in the build messages:
Code
||=== Build: Debug in fuck you (compiler: GNU GCC Compiler) ===|
C:\Users\Nikola\Prog. 1\fuck you\main.cpp||In function 'int main()':|
C:\Users\Nikola\Prog. 1\fuck you\main.cpp|9|error: 'getch' was not declared in this scope|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|


Offline Fik

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Can't abort the debuger
« Reply #22 on: March 08, 2014, 07:33:18 pm »
ok i just started a new a console application. and it seems to work, i have no clue why...

Offline Fik

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Can't abort the debuger
« Reply #23 on: March 08, 2014, 07:35:43 pm »
ok nevermind, i tried to run it again and it doesn't work.. and again i have no clue why. This is really frustrating

Ok,sorry for this confusing text, looks like avast is interfering with Code Blocks.. I turned it off and it worked again
« Last Edit: March 08, 2014, 07:37:26 pm by Fik »