Choosing C++ debugger on linux
I recently changed from Windows where I was using Qt Creator to Ubuntu.
The problem is that Qt Creator in Ubuntu can't properly debug due to some problem attaching ptrace to the program which was cause by a security upgrade as I found out. The only way to debug is to mess with the system settings and change the ptrace variable configuration but I'm not comfortable with this, as it compromises security.
So my question is, is there anything close to Qt Creator or Visual Studio debugger in Linux? I mean being able to track variable values and pointers, etc.
If not what's the standard debugger for Linux? I don't mind using console tools as long as they offer the same functionality
Solution 1:
Have you looked at gdb? It's a command line interface tool.
Another option is to go with Eclipse C/C++, which is a full fledged C and C++ IDE that provides front-end for gdb (CDT GNU Toolchain Debug).
I have not used the latter as am pretty comfortable with gdb.
Solution 2:
Without ptrace, I can't think of a debugger that will work. This other question has an answer that describes how to temporarily disable the ptrace restriction. It's not a gaping security problem to disable it temporarily for debugging. Generally, however, users don't need that functionality and there's no reason to allow it without reason.
Saying having ptrace enabled at all ever is a problem is a lot like saying plugging in an Ethernet cable is a problem. While it can be construed as correct, debugging without debugging permissions is not possible.
Solution 3:
I can recommend gdb (it comes in package with GCC/g++ compiler suite I think - also you can use Qt Creator in Ubuntu). I have used it with and without ptrace and I don't really spot the difference, to be honest. But that's just maybe the way am developing. Also worth mentioning is Intel compiler: free for non-commercial use, and it has debugger integrated with Eclipse. However, it also requires to disable ptrace.