• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Debugging C on Unix

barbary

Senior member

Well I haven't worked since September the 11th caused everyone in the Airline industry to get sacked. 1 year further on and I have a sniff at a new contract.

Problem is it won't be easy. I used to do loads of C on UNiX. But I haven't realy done much real indepth stuff for a long time and this company has big problems with Core Dumps.

1) I have hardely use HP-Unix only AIX and Sloaris. Are there any big difference's I should know?
2) Any wonderful advice on solving problems with Core Dumps, Reading Core Dumps and Debugging tools?

The interview is tommorow my Anandtech chums and I need help refreshing the old nogging. Getting old these days and stuff doesn't come back that quickly. Anyhelp no matter how trivial is most apprecated.
 
i'm no C programmer, but IIRC purify is a tool for testing memory leaks. gdb is what i always hear about in regards to debugging. not really sure about anything beyond that.
 
Purify is expensive, but it really rocks as a debugging & testing tool. Read up on their site.
It does really slow things down though.
 
I worked on HP-UX for many years, and everything was very solid. I always used HP compilers, which were superior to anything else, in my opinion. Debugging was always a problem. I never had access to any graphical debugger, and the standard tools were pitiful (xdb, whatever). There must be better tools now, but I switched to PC's years back. My stuff is very portable, so I compile on Unix only when everthing is thoroughly tested.

Let us know about your findings...
 
I always used HP compilers, which were superior to anything else, in my opinion.
I'm pretty sure that GNU's GCC will beat anything HP has put out recently. However, I have absolutely no data to back this up. I'm just generalizing from what most platforms have witnessed over the last few years.

2) Any wonderful advice on solving problems with Core Dumps, Reading Core Dumps and Debugging tools?
As long as you compiled using GCC with the "-g" option (to include debugging info), you can load the core file in GDB and figure out where the program crashed. It's also helpful to compile without optimization, which sometimes makes debugging more difficult by moving sections of code around without your knowledge. The relevant section in the GDB documentation on specifying core files as GDB targets can be found here.
 
I currently program on HP-UX and Linux and the HP-UX compiler is better IMHO than GCC.

On HP-UX I use xdb as my debugger.
On Linux I use gdb which has taken some getting use to.

You can also use DDD on both I think, basically a GUI wrapper for the debugger.

GCC has more/better warnings than the HP compiler but the HP compiler produces code.
So I would use both.

One down side is that the default compiler that comes with HP-UX is K&R only. If you
need ANSI support or debugger support you need to by the C or C++ developers bundle.

 
I'm pretty sure that GNU's GCC will beat anything HP has put out recently. However, I have absolutely no data to back this up. I'm just generalizing from what most platforms have witnessed over the last few years.

Doubtfull. As much as I like GCC it's non-x86 support is pretty bad. KDE 3 won't even compile properly on Alpha Linux because of C++ problems.
 
Doubtfull. As much as I like GCC it's non-x86 support is pretty bad.

I'll take your word for it, then. I don't work with anything outside of x86, Sparc, and MIPS, so I don't have any data to make the claim on HP or Alpha platforms.

But on Sparc especially, in my limited experience GCC is every bit as fast (and sometimes faster) than Sun's CC compiler.

That was how I generalized. But it seems that HP's compiler teams have done a better job than I gave them credit for. I apologize to them 🙂
 
I'll take your word for it, then. I don't work with anything outside of x86, Sparc, and MIPS, so I don't have any data to make the claim on HP or Alpha platforms.

Are you using the C or the C++ compiler? I think the C compiler support is pretty good across the board, it's C++ that's the real problem.
 
Are you using the C or the C++ compiler?
Definitely C. Haven't used C++ for a while... When I want serious performance, C or Fortran are my only picks. 🙂

But then again, he didn't say that performance was any concern, and I brought up the GNU tools mainly because he can find reasonably good debugging tools for GCC et al. that will at least have extensive standard documentation available for free. Plus, more people seem to be familiar with GNU tools these days and would be more willing to lend a hand.

I didn't mean to belittle HP's compilers. I am largely ignorant of them, so I should have just kept quiet. 😱
 
barbary,

awsome I found you, sorry can't help w/ your question as I don't know fanny about C programming or Unix.

Don't belive this guy folks, he's not as old as you think.

I'd tell you to go get drunk barbary, but your a man who can hold his own 😉.

hope the interview went well 🙂.
 
Back
Top