Author Topic: CB 13.12 debugging fails  (Read 3650 times)

Offline eightbits2015

  • Single posting newcomer
  • *
  • Posts: 8
CB 13.12 debugging fails
« on: March 25, 2016, 09:25:03 pm »

PC: Ubuntu 15.04 , Processor Intel Core i5-4460 @ 3.20GHZ x 4, Graphics Haswell Desktop,
                                  OS type 64 Bit Disk 113.8

 Problem with CodeBlocks (13.12) debug mode:
When using Debug,  a simple Hello World C++ code I only get the message:
“warning: GDB: Failed to set controlling terminal: Operation not permitted” displayed in the
terminal window. The code will execute as expected when using the run mode. Also, setting the


gcc version 4.9.2 (Ubuntu 4.9.2-10ubuntu13)
gdb version: GNU gdb (Ubuntu 7.9-1ubuntu1) 7.9

The following is the Debugger log content:
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: /home/jlo/Programming/c++/SecondTry/
Adding source dir: /home/jlo/Programming/c++/SecondTry/
Adding file: /home/jlo/Programming/c++/SecondTry/bin/Debug/SecondTry
Changing directory to: /home/jlo/Programming/c++/SecondTry/.
Set variable: LD_LIBRARY_PATH=.:
Starting debugger: /usr/bin/gdb -nx -fullname  -quiet  -args /home/jlo/Programming/c++/SecondTry/bin/Debug/SecondTry
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb (Ubuntu 7.9-1ubuntu1) 7.9
At /home/jlo/Programming/c++/SecondTry/main.cpp:7
Debugger finished with status 0

I have uninstalled and re-installed CodeBlocks but no  change in using the debug mode :-(



Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: CB 13.12 debugging fails
« Reply #1 on: March 25, 2016, 09:58:06 pm »
Have you set a breakpoint?
Have you read this http://wiki.codeblocks.org/index.php/Debugging_with_Code::Blocks ?

p.s. the warning should be ignored
(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 eightbits2015

  • Single posting newcomer
  • *
  • Posts: 8
Re: CB 13.12 debugging fails
« Reply #2 on: March 25, 2016, 10:13:15 pm »
I did set a break point, but it doesn't stop at the break point. I will read the information in the link you provided.
But, I still can't understand “warning: GDB: Failed to set controlling terminal: Operation not permitted” as that seems to be connected with
accessing the Terminal ? I modified the Hello World code to add a couple of lines that use a int and then increment the variable and then using that
line with the variable as the break point. The same issue.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: CB 13.12 debugging fails
« Reply #3 on: March 25, 2016, 10:18:35 pm »
Just ignore it. It doesn't prevent debugging in most cases, especially the simple hello world kind applications.
(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 eightbits2015

  • Single posting newcomer
  • *
  • Posts: 8
Re: CB 13.12 debugging fails
« Reply #4 on: March 26, 2016, 12:28:52 am »
It is hard to ignore, it doesn't stop at the breakpoints. That means it isn't performing a useful function.  i am hoping that there is a solution sometime
in the future.  I did take a look at Eclispe , but it looks more complex than CodeBlocks and I really want to use it to get up to speed on C++.
You mentioned the simple Hello World examples, is that an issue with the break points not halting?

« Last Edit: March 26, 2016, 12:30:23 am by eightbits2015 »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: CB 13.12 debugging fails
« Reply #5 on: March 26, 2016, 01:53:35 pm »
It is hard to ignore, it doesn't stop at the breakpoints.
I've said to ignore the warning, because the problem is somewhere else.
Also enable full debugger logging and post it here.
(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 eightbits2015

  • Single posting newcomer
  • *
  • Posts: 8
Re: CB 13.12 debugging fails
« Reply #6 on: March 28, 2016, 12:12:46 am »
OK, I did enable the full debugger logging. I am including the code as well as the debug log listing.

Code: [Select]
#include <iostream>
using namespace std;

int main()
{
    cout << "Hello world!\n" ;
    int L =1;
    L +=L;    //breakpoint here
    cout << L;
    return 0;
}

and the debugger output:
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: /home/jlo/Programming/c++/SecondTry/
Adding source dir: /home/jlo/Programming/c++/SecondTry/
Adding file: /home/jlo/Programming/c++/SecondTry/bin/Debug/SecondTry
Changing directory to: /home/jlo/Programming/c++/SecondTry/.
Set variable: LD_LIBRARY_PATH=.:

[debug]Command-line: /usr/bin/gdb -nx -fullname  -quiet  -args /home/jlo/Programming/c++/SecondTry/bin/Debug/SecondTry
[debug]Working dir : /home/jlo/Programming/c++/SecondTry

Starting debugger: /usr/bin/gdb -nx -fullname  -quiet  -args /home/jlo/Programming/c++/SecondTry/bin/Debug/SecondTry
done

[debug]Reading symbols from /home/jlo/Programming/c++/SecondTry/bin/Debug/SecondTry...done.
[debug](gdb)
[debug]> set prompt >>>>>>cb_gdb:

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

[debug]>>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (Ubuntu 7.9-1ubuntu1) 7.9
[debug]Copyright (C) 2015 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 "x86_64-linux-gnu".
[debug]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]Find the GDB manual and other documentation resources online at:
[debug]<http://www.gnu.org/software/gdb/documentation/>.
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (Ubuntu 7.9-1ubuntu1) 7.9

[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 disassembly-flavor intel
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source /usr/share/codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory /home/jlo/Programming/c++/SecondTry/
[debug]Source directories searched: /home/jlo/Programming/c++/SecondTry:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> break "/home/jlo/Programming/c++/SecondTry/main.cpp:9"
[debug]Breakpoint 2 at 0x4007f4: file /home/jlo/Programming/c++/SecondTry/main.cpp, line 9.
[debug]>>>>>>cb_gdb:
[debug]> tty /dev/pts/19
[debug]Queued:[tty /dev/pts/19]
[debug]>>>>>>cb_gdb:
[debug]> start
[debug]Temporary breakpoint 3 at 0x4007de: file /home/jlo/Programming/c++/SecondTry/main.cpp, line 7.
[debug]Starting program: /home/jlo/Programming/c++/SecondTry/bin/Debug/SecondTry
[debug]Temporary breakpoint 3, main () at /home/jlo/Programming/c++/SecondTry/main.cpp:7
[debug]/home/jlo/Programming/c++/SecondTry/main.cpp:7:56:beg:0x4007de
[debug]>>>>>>cb_gdb:

At /home/jlo/Programming/c++/SecondTry/main.cpp:7

[debug]> info program
[debug]   Using the running image of child process 10961.
[debug]Program stopped at 0x4007de.
[debug]It stopped at a breakpoint that has since been deleted.
[debug]Type "info stack" or "info registers" for more information.
[debug]>>>>>>cb_gdb:
[debug]> quit

Debugger finished with status 0

The debugger output may be too long, should it have been inserted another way ?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: CB 13.12 debugging fails
« Reply #7 on: March 28, 2016, 10:18:48 am »
Yes use code or quote tags.

I don't see anything wrong in the log.
How are you starting the program?
What happens if you hit f8 (debug -> continue) after the debugger stops?
(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 eightbits2015

  • Single posting newcomer
  • *
  • Posts: 8
Re: CB 13.12 debugging fails
« Reply #8 on: April 09, 2016, 02:35:21 am »
Well, I have kept attempting and the more I do , the less things seem to work.
 I have a 2nd PC (Xubuntu) that worked once and did the debugging for both C and C++. I just tried it again, and the debugger does not halt
at the break point. I have been trying to get the Ubuntu PC to run. Now, I notice that I seem to not set the location of the file  for the file. When ever I create a new project, select the console method, select C as the language. But when I 'finish' setting everything up, it only shows a drop down
display (right side of screen). When I do get the source file to display and set a break point, build and then select start in the Debug start drop down, it
does not halt. So, I am starting to think I will not be able to get this to work :-(. I am thinking I wll have to go back to Python and just use
WxPython.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2464
Re: CB 13.12 debugging fails
« Reply #9 on: April 10, 2016, 11:06:11 pm »
Your description is a bit confusing...
To be honest i don't understand anything you are writing. So lets try to clear things up a bit:

NOTE: I have no idea how big your understanding of compiler and debugger is, so the following list is written as easy as possible. Don't be offended by the noobish writing, but you have a problem and we are trying to fix it. I request you to follow the steps, step by step so we can somehow localize the error.

1) Create a new c++ project. Let everything as it is. Make sure you save the project in a location where you have permission to write (your home directory would be fine)
2) Hit the compile and run button --> The project should build and run fine...
3) Add a breakpoint on the
Code: [Select]
cout << "Hello world!" << endl;
line. This should be the 7. line of code
4) Make sure you have selected the "Debug" target in the  drop down menu near the build tool bar
5) Hit the debug button (red arrow, or hit F8)
6) The debugger should stop at this line.
6a) if not: Post a full rebuild log (hit the blue arrows near the build button) and post the log from the build log tab
6b) if it is working: lets go to your project..

7) In your project (I hope you use projects. Debugging is only possible with projects):
8) Make sure you have selected the "Debug" target as described in 4)
9) Hit the rebuild button (blue arrows near the build button or "Build->Rebuild" menu entry

10) set a breakpoint on line
Code: [Select]
L +=L;    //breakpoint here11) Hit the debug button (red arrow, or hit F8)
12) The debugger should stop here. Make sure that you have focus to codeblocks. It is possible that a other window takes the focus from codeblocks away, so after the cmd window opened go straight to the codeblocks window. It should indicate the position of the current executed code with a yellow arrow over the breakpoint symbol. If you see the arrow you are successfully debugging.
13) If you are confused about the look, make sure that you have enabled the debugger view with "View->Perspectives->GCB/CDB debugger:default"
13 a) If you have somehow overwritten this perspective you can show the debugger windows with "Debug->Debugging Windows->Call Stack" etc.
14) If all this does not work post the full rebuild log from step 9)


greetings

Offline eightbits2015

  • Single posting newcomer
  • *
  • Posts: 8
Re: CB 13.12 debugging fails
« Reply #10 on: April 11, 2016, 04:30:58 pm »
Basically I have done all mentioned. The compiler works and GDB seems to work in using the command line  activation. I have also specified the directory at the home directory as well. I did install Codelite and it works as expected, stops at the break point, etc. and displays watchs.
I also posted a complete debug log previously.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2464
Re: CB 13.12 debugging fails
« Reply #11 on: April 11, 2016, 05:29:29 pm »
Basically I have done all mentioned. The compiler works and GDB seems to work in using the command line  activation. I have also specified the directory at the home directory as well. I did install Codelite and it works as expected, stops at the break point, etc. and displays watchs.
basically is not exactly, or i tried it....

I also posted a complete debug log previously.
But i want a fresh re build log

Could it be possible that the debugger is running and working and you simply have changed the debugger layout?

Quote
stops at the break point, etc. and displays watchs.
This even more gives me the impression that there is only a miss configuration in the perspective...

7) In your project (I hope you use projects. Debugging is only possible with projects):
8) Make sure you have selected the "Debug" target as described in 4)
9) Hit the rebuild button (blue arrows near the build button or "Build->Rebuild" menu entry

10) set a breakpoint on line
Code: [Select]
L +=L;    //breakpoint here11) Hit the debug button (red arrow, or hit F8)
12) The debugger should stop here. Make sure that you have focus to codeblocks. It is possible that a other window takes the focus from codeblocks away, so after the cmd window opened go straight to the codeblocks window. It should indicate the position of the current executed code with a yellow arrow over the breakpoint symbol. If you see the arrow you are successfully debugging.
13) If you are confused about the look, make sure that you have enabled the debugger view with "View->Perspectives->GCB/CDB debugger:default"
13 a) If you have somehow overwritten this perspective you can show the debugger windows with "Debug->Debugging Windows->Call Stack" etc.
14) If all this does not work post the full rebuild log from step 9)

Well i did my best to help you. If you are not willing to do some basics i can't do more...
greetings