Reputation: 1983
I need to debug a C program that includes posix threads, socket programming (udp client, server). I use ubuntu 12.04 and as IDE/SDK, Qt Creator 2.4.1 and Netbeans IDE 7.1.2. I know they use gdb for debugging.
When I start to debug my program, the program stops running after 5 min or so and neither Qt Creator or Netbeans output any error or warning, although I use debugging feature and my program suppose to listen for a UDP port.
I use printf for all line of my code, and I can see that my program works as it suppose to and listen the UDP port and waits. I can not figure the problem out why it stops without any reason and since IDEs that I am using do not show any debug error, warning, I can not think any reason.
I wonder if anyone can suggest me a debug program that monitors all/some variables and threads during the run time. Thank you.
Upvotes: 0
Views: 265
Reputation: 70981
gdb
isn't too comfortable but always available.
To do runtime analysis of different types, especially checking memory access, Valgrind
(see here for docs) might be the tool of choice.
Update: I'm referring to *IX systems. For Windows gbd
also works in the cygwin
enviroment. Nativly there is VC Express, which is free and includes IDE and debugger.
Upvotes: 3
Reputation: 10695
I'm not quite sure what debugger is used for your kind of application. The only debugger I know about on Linux is gdb. It along with printf statements is all I need.
gdb is simple, though not "too comfortable" as @alk said, but seems to be ubiquitous.
There is also Eclipse, and that's quite a nice development and debugging platform, too.
Upvotes: 2
Reputation: 22679
An old, but reliable tool is ddd, which is basically the gdb GUI wrapper. Although, I usually do debugging directly with Emacs, ddd is the tool that you'll be able to run on almost all *nix platforms.
Upvotes: 4