LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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, 01: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, 01:29 PM   #2
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,298
Blog Entries: 61

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-06-2015, 11:55 PM   #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, 12:09 AM   #4
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,465

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, 06:50 AM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
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, 02: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, 02:29 PM   #7
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
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



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 01:55 AM
How to debug SPI driver on ubuntu? dennisdd Programming 7 02-20-2012 11:17 AM
[SOLVED] Not able to debug a library compiled with debug information gregorian Programming 6 10-29-2011 09:53 AM
I upgrade to Ubuntu 11.04 and now /sys/kernel/debug/vgaswitcheroo missing nadavvin Ubuntu 2 04-26-2011 11:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:13 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
Open Source Consulting | Domain Registration