Code::Blocks Forums

User forums => Help => Topic started by: thanhbuu on July 31, 2012, 05:37:20 pm

Title: Debugging error
Post by: thanhbuu on July 31, 2012, 05:37:20 pm
http://www.flickr.com/photos/50914177@N02/7684695908/in/photostream (http://www.flickr.com/photos/50914177@N02/7684695908/in/photostream)
As you can see in the picture in the link. I have run to line 44, it must output number in line 43 but I can't see it, I think it is because the error above: "warning: GDB: Failed to set controlling terminal: Operation not permitted".
I have searched google for this error but I found there is no topic can solve this :( Could somebody help me with this problem?
Your help is appreciated !!! Thank you!
Title: Re: Debugging error
Post by: oBFusCATed on July 31, 2012, 05:47:57 pm
Read this please: http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks

Also keep in mind that the warning is quite harmless, it is something else causing you problems.
Title: Re: Debugging error
Post by: thanhbuu on August 01, 2012, 05:53:48 am
Thanks for replying,
I'm still stuck with this problem. I just have installed ubuntu on my system and then codeblocks is the first one I installed on ubuntu so I think your "something else" is not possible :( Can you suggest more solution, thank you!
Title: Re: Debugging error
Post by: oBFusCATed on August 01, 2012, 09:09:22 am
How can I give you sollution without the log from the debugger?
Does it work from the command line?
Are you sure you have not optimizations or the stripping options enabled?
Title: Re: Debugging error
Post by: thanhbuu on August 01, 2012, 05:28:18 pm
1. Here is the best I can do. Is it the log file that you want or can you show me how to do it?
Code
-------------- Clean: Debug in CodeBlocks_U (compiler: GNU GCC Compiler)---------------
-------------- Build: Debug in CodeBlocks_U (compiler: GNU GCC Compiler)---------------
g++ -Wall -g -fexceptions  -g     -c /media/DATA1/CodeBlocks_U/PTREE.cpp -o obj/Debug/PTREE.o
g++  -o bin/Debug/CodeBlocks_U obj/Debug/PTREE.o    
Output size is 54.40 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings (0 minutes, 0 seconds)
-------------- Build: Debug in CodeBlocks_U (compiler: GNU GCC Compiler)---------------
Target is up to date.
Nothing to be done (all items are up-to-date).

2. I don't understand what you mean. Do you mean this? http://wiki.codeblocks.org/index.php?title=Code::Blocks_command_line_arguments (http://wiki.codeblocks.org/index.php?title=Code::Blocks_command_line_arguments) If yes then it also warned the same and didn't show anything.
3. I'm sure about this.
Title: Re: Debugging error
Post by: oBFusCATed on August 01, 2012, 07:28:36 pm
1. This is not the log from the debugger, but the compiler
2. Start a terminal and run gdb your_app, then put breakpoints and see if the problem is the same.
3. Yes, it seems there are no optimizations.
Title: Re: Debugging error
Post by: thanhbuu on August 01, 2012, 08:12:39 pm
http://www.flickr.com/photos/50914177@N02/7692625838/in/photostream (http://www.flickr.com/photos/50914177@N02/7692625838/in/photostream)
Sorry but as in the picture in the given link but no it didn't show anything :(
Title: Re: Debugging error
Post by: oBFusCATed on August 01, 2012, 10:23:35 pm
Cannot compute...
Title: Re: Debugging error
Post by: Jenna on August 01, 2012, 11:33:37 pm
http://www.flickr.com/photos/50914177@N02/7692625838/in/photostream (http://www.flickr.com/photos/50914177@N02/7692625838/in/photostream)
Sorry but as in the picture in the given link but no it didn't show anything :(
Why do you expect C::B's debug log to show anything, if you run gdb from commandline ?

The picture in your first post shows the Debugger's log and it shows clearly some output there.

And don't forget to check the option "Full (Debug) Log" in the debugger settings.
Title: Re: Debugging error
Post by: thanhbuu on August 02, 2012, 04:35:35 am
Fortunately, when I look around, I changed to "printf("%d\n", u)", it works. But printf("%d', u) it doesn't work. Maybe this is the whole problem. Could you explain me or how to fix it? Thank you!
Title: Re: Debugging error
Post by: thanhbuu on August 03, 2012, 01:45:21 pm
Somebody please help me. I think this is the common error in Codeblocks in ubuntu :)
Title: Re: Debugging error
Post by: Jenna on August 03, 2012, 02:19:33 pm
Somebody please help me. I think this is the common error in Codeblocks in ubuntu :)
No it's not, it's the compiler and not C::B.

Read (e.g.) this:
http://stackoverflow.com/questions/1716296/why-does-printf-not-flush-after-the-call-unless-a-newline-is-in-the-format-strin (http://stackoverflow.com/questions/1716296/why-does-printf-not-flush-after-the-call-unless-a-newline-is-in-the-format-strin)
Title: Re: Debugging error
Post by: thanhbuu on August 03, 2012, 05:45:12 pm
Thank you! Problem solved :)
Title: Re: Debugging error
Post by: northcamel on September 17, 2012, 04:53:21 pm
How can you slove the warning "warning: GDB: Failed to set controlling terminal: Operation not permitted"?
Title: Re: Debugging error
Post by: oBFusCATed on September 17, 2012, 07:49:31 pm
How can you slove the warning "warning: GDB: Failed to set controlling terminal: Operation not permitted"?
Modify the source of gdb and recompile it. Or the best options - just ignore it.
Title: Re: Debugging error
Post by: thanhbuu on September 18, 2012, 11:17:32 am
How can you slove the warning "warning: GDB: Failed to set controlling terminal: Operation not permitted"?
here: "Fortunately, when I look around, I changed to "printf("%d\n", u)", it works. But printf("%d', u) it doesn't work. Maybe this is the whole problem." Or you should flush the output. Good luck!