C++ Tools List on Linux



  • I am moving my Windows C++ skills to the Linux platform and would like to know what are some of the tools I can use to diagnosis a process.

    Can people list the tools they use on the Linux system for C++ coding & diagnostics.

    Some of the tools I love to use on Windows are WinDbg, Resource Hacker & all the System Internal tools.

    http://technet.microsoft.com/en-us/sysinternals

    I am looking for equivalent tools on Linux. Please note I am looking for answers specific to bare C++ hacking on Linux and not tools specific to QT apps.

    I know about gdb for debugging a process.

    If I want to monitor the memory usage of a specific process, what else can I use beside top?

    I've heard of Valgrind for detecting memory leaks, is there some other way to determine memory leaks??

    What is a good way to benchmark a process? I know netbeans has some cool stuff.

    How do I determine what modules link to a binary or are loaded in a running process?

    Also is there a system logger on Linux? On Window I can use of OS Event Logging and Performance monitoring counters. Is there an equivalent on Linux?

    Thanks All



  • Valgrind is actually a whole suite of tools: memory profiling, cache profiling, etc... When it comes to performance counters I would recommend oprofile. If your are looking for something more Windowish, try the zoom profiler. One thing you may have noticed: people in the Linux/Unix environment use shells, so you will have to learn one, first.



  • I've been using Linux at home exclusively for a year and I feel comfortable with the shell. Most of my focus has been with web 2.0 hacking, primarily Ruby on Rails. I recently fell in love with QT and have been able to transfer my Windows MFC skills over to QT GUI coding in very short order.

    I figure it's time I got more familiar with C++ system tools on Linux.

    What is the web-site for zoom profile??



  • "rotateright.com":http://rotateright.com. You were listing only GUI frontends from Windows, thought you are looking for a similar experience on Linux. By the way it is called "Qt", with small 't'.



  • Thanks for the link, I really like both the tools you mentioned!

    Window unfortunately is primarily gui front-end driven, have you see the power of cmd.exe, it's antiquated msdos! I haven't come across many C++ developer who use the command line on Windows, including myself. On Linux it seems to be the other way around, which I actually find more productive with some things.

    btw, Qt got it, small 't', don't want to upset the Trolls ;-)



  • [quote author="ryadav" date="1298140567"]If I want to monitor the memory usage of a specific process, what else can I use beside top?
    [/quote]
    ksysguard or one of a million other system monitors ;-)

    [quote author="ryadav" date="1298140567"]
    What is a good way to benchmark a process? I know netbeans has some cool stuff.
    [/quote]
    QTestLib has some support for benchmarking. Have a read of the "docs":http://doc.qt.nokia.com/latest/qtestlib-manual.html#creating-a-benchmark.

    Remember to run your benchmarks on a release build.

    You can also use valgrind --callgrind to get a trace of where your app spends each fraction of its time. You can view the output with kcachegrind. This will let you know where to focus your optimisation efforts.

    [quote author="ryadav" date="1298140567"]
    How do I determine what modules link to a binary or are loaded in a running process?

    Also is there a system logger on Linux? On Window I can use of OS Event Logging and Performance monitoring counters. Is there an equivalent on Linux?
    [/quote]

    To see what dynamic libraries are needed by an app at runtime use:
    @ldd /path/to/lib/or/app@

    You can use strace to get a trace of every syscall made by your application. Use it like:

    @strace myapp@

    The output will be very verbose so it is often useful to redirect it into a file that you can grep later.

    Another useful tool is "lsof" which will tell you about all of the open file handles your application has.

    Do not be afraid to make use of qDebug() statements. You can easily disable them in a release build by defining QT_NO_DEBUG_OUTPUT. ie just add

    @
    CONFIG(release, debug|release) {
    DEFINES += QT_NO_DEBUG_OUTPUT
    }
    @

    to your .pro file.

    I'm sure you'll pick up many more tips/tricks as you go along.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.