From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,153827a547d1e006 X-Google-Attributes: gidfee84,public From: Jeff Sullivan Subject: Re: Nightmare pointer problem Date: 1999/01/22 Message-ID: <36A8A994.F21F11@zk3.dec.com>#1/1 X-Deja-AN: 435680585 Content-Transfer-Encoding: 7bit References: <36A71F67.56BE@vegauk.co.uk> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Compaq Computer Corporation Mime-Version: 1.0 Newsgroups: comp.unix.osf.osf1 Brian Charlton wrote: > > We have developed a very large C++ application program on a DEC ALPHA > runnning OSF1, which appears to be working fine 50% of the time. > However, now and then it crashes with a segmentation violation. When we > compile for debug the program will crash in a different location, > usually in library functions which we only have the binaries for. > > Some data has become corrupted, perhaps an object is being deleted > twice? > > I am aware of tools, available for the PC, which fill unused memory with > zeros to help show up bad pointers sooner. What version of the compiler and OS are you using? There are a few of things that you can try. The Digital C++ compiler contains a -trapuv switch (similar to DEC C), which initializes all uninitialized data to some "known bad" value. If the problem is due to an uninitialized pointer (and hence unpredictable results), this will make the problem much more reproducible. See man cxx(1) for details. There is a tool called ATOM third degree that is a heap usage and leak profiler, and memory-access error checker for C and C++ programs. What you do is ATOMize the application and run it as you normally would. It will produce a log file of potential memory overwrites, etc. It's worked for me in the past to debug just this type of problem. See man third(1) for details. You can also enable more diagnostics in the compiler itself, either by enabling more messages or compiling in a stricter mode. See the -msg_enable and -std flags in the cxx(1) man page. These are applicable for DIGITAL C++ V6.0 and later. Hope it helps. -Jeff -- Jeff Sullivan | Compaq Computer Corp | jps@zk3.dec.com DEC C and C++ | Nashua, NH ZK3-2/X29 | sullivan@zko.dec.com