Author Topic: Question regarding using GDB for use with C in codeblocks 12.11  (Read 4932 times)

Offline anshbansal

  • Single posting newcomer
  • *
  • Posts: 3
    • My personal blog
I have tried to use GDB in Code:Blocks 12.11. I have some confusion regarding that.

Is there some way to get a proper terminal(like the linux terminal) integrated with use of GDB? I mean the only place I can place commands for running the debugger is at the Debugger window at the bottom. It isn't convenient to copy-paste again and again.

Also is there any place I can find the commands of GDB that can be used with code:blocks?

I have used GDB mostly in Code:Blocks. I used it in linux once and it was great experience to use it. Debugging helps a lot but debugging without a terminal is a pain.

Any help or suggestions?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Question regarding using GDB for use with C in codeblocks 12.11
« Reply #1 on: August 07, 2013, 05:39:59 pm »
I have tried to use GDB in Code:Blocks 12.11. I have some confusion regarding that.

Is there some way to get a proper terminal(like the linux terminal) integrated with use of GDB? I mean the only place I can place commands for running the debugger is at the Debugger window at the bottom. It isn't convenient to copy-paste again and again.
No, there isn't anything else because C::B is GDB wrapper, so there should be no need to execute command by hand most of the times. It is preferable to use the UI.
On newer gtks you should be able to use up/down arrows to access previous commands. On RHEL5/Centos5 this doesn't work.

Also is there any place I can find the commands of GDB that can be used with code:blocks?
All commands are available, but some are dangerous to use, because they'll confuse C::B's internal state related to the debugger.
Generally commands for stepping (step, next, finish, continue) and commands for breakpoints (break, delete) should not be executed if you don't know what you're doing:)

I have used GDB mostly in Code:Blocks. I used it in linux once and it was great experience to use it. Debugging helps a lot but debugging without a terminal is a pain.
Most of the regular activities done in cmd line gdb have UI in C::B, so it is better to use it.

What commands do you want to execute?
(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 anshbansal

  • Single posting newcomer
  • *
  • Posts: 3
    • My personal blog
Re: Question regarding using GDB for use with C in codeblocks 12.11
« Reply #2 on: August 07, 2013, 05:47:27 pm »
This is something I did a few months ago. I didn't knew there was a forum so I am asking this from memory. If something doesn't make sense then please ask for clarification.

I implemented merge sort. I was getting errors so I tried to step through the program to view the memory elements of the dynamically allocated array. To display the memory there is some cryptic syntax that I don't remember now. I am a beginner to debugging and I was messing up so  I had to rewrite that every time. In case of linux terminal all I had to do was quit GDB rerun it and press Up key.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Question regarding using GDB for use with C in codeblocks 12.11
« Reply #3 on: August 07, 2013, 06:21:00 pm »
What about using the Debug -> Debugger windows -> Memory dump? :)
Also the up/down arrow keys work on newer distros.
(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!]