LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-06-2015, 02:24 PM   #1
shyjuu
Member
 
Registered: Mar 2015
Posts: 47

Rep: Reputation: Disabled
how to debug in ubuntu 12.04


How to debug class file i.e .cc and other files line by line in ubuntu 12.04, is there any command in ubuntu?
 
Old 04-06-2015, 02:29 PM   #2
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 7,453
Blog Entries: 55

Rep: Reputation: Disabled
GDB is the main Linux debugger. Here's one of many tutorials found by a websearch:
http://www.cprogramming.com/gdb.html
 
1 members found this post helpful.
Old 04-07-2015, 12:55 AM   #3
shyjuu
Member
 
Registered: Mar 2015
Posts: 47

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by brianL View Post
GDB is the main Linux debugger. Here's one of many tutorials found by a websearch:
http://www.cprogramming.com/gdb.html
I want to go line by line execution, similar to Borland C, in which when i press F7 it executes the code line by line, Is this possible in gcc.
 
Old 04-07-2015, 01:09 AM   #4
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
Quote:
Originally Posted by shyjuu View Post
I want to go line by line execution, similar to Borland C, in which when i press F7 it executes the code line by line, Is this possible in gcc.
Have you actually looked at the link that BrianL provided?
Quote:
Next and Step

Just starting and stopping isn't much of a control. GDB also lets you to run the program line-by-line by the commands 'next' and 'step'. There is a little difference between the two, though. Next keeps the control strictly in the current scope whereas step follows the execution through function calls.
jdk
 
1 members found this post helpful.
Old 04-07-2015, 07:50 AM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 4,287
Blog Entries: 10

Rep: Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593
Quote:
Originally Posted by shyjuu View Post
I want to go line by line execution, similar to Borland C, in which when i press F7 it executes the code line by line, Is this possible in gcc.
Who in the world still uses Borland C? I honestly have not heard that word this entire millennium. I shouldn't knock it, I used it a lot back in the 80's as well as TurboDebugger, which was also a Borland product I believe.

What brianL and jdkaye said. GDB is very good and if you're not going to take the time to review an answer or ask a follow up, but just present your terms on exactly what you want, then you're not going to be too successful in your Linux ventures.

A thing to note is that GDB integrates very well with Emacs and when you run GDB from within Emacs, you get some more helpful UI based controls, all available in the command line, but just more well presented within Emacs.

So, run Emacs to create a Hello World! C source, you actually can compile from within Emacs using the compile command, but you should edit the command to just be "gcc -o <output-file-name> <source-file-name> and it will do a simple compile. You then can debug from within Emacs by issuing the gdb command from with Emacs. I think you'll like the interface, if you actually give it a try.
 
Old 04-07-2015, 03:23 PM   #6
shyjuu
Member
 
Registered: Mar 2015
Posts: 47

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by brianL View Post
GDB is the main Linux debugger. Here's one of many tutorials found by a websearch:
http://www.cprogramming.com/gdb.html
but in ns-2 every c++ objects will be converted to Otcl objects, so how can i debug line by line
I just want to know while aodv.cc, aodv.hh executes which function is called when
 
Old 04-07-2015, 03:29 PM   #7
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 4,287
Blog Entries: 10

Rep: Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593
Quote:
Originally Posted by shyjuu View Post
but in ns-2 every c++ objects will be converted to Otcl objects, so how can i debug line by line
I just want to know while aodv.cc, aodv.hh executes which function is called when
GDB works with C++
 
  


Reply

Tags
ns2


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gdb, debug with separate debug file and different source dir problem a4z Programming 5 10-17-2014 02:55 AM
How to debug SPI driver on ubuntu? dennisdd Programming 7 02-20-2012 12:17 PM
[SOLVED] Not able to debug a library compiled with debug information gregorian Programming 6 10-29-2011 10:53 AM
I upgrade to Ubuntu 11.04 and now /sys/kernel/debug/vgaswitcheroo missing nadavvin Ubuntu 2 04-26-2011 12:51 PM


All times are GMT -5. The time now is 10:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration