public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sam Halliday <fommil@yahoo.ie>
To: gcc-help@gcc.gnu.org
Subject: Re: Memory corruption problem
Date: Thu, 24 Oct 2002 13:26:00 -0000	[thread overview]
Message-ID: <20021024212645.40e109be.fommil@yahoo.ie> (raw)
In-Reply-To: <a66bebc8.ebc8a66b@uqo.ca>

On Thu, 24 Oct 2002 15:29:47 -0400 ducharme@uqo.ca wrote:
> I am using gcc 2.95 on Sun SPARC Solaris 8.
poor you...

> I am experimenting a memory corruption problem in a C++
> program.  I have put in some traces and I know exactly
> where the memory corrruption happens but, at that point,
> I have most likely already overwritten some memory.
> The program terminates normally but outputs partially
> corrupted data.
> I have been through my source code but I cannot seem to
> find where I could be writing to some unallocated memory.
have you broke your algos into tiny standalone programs and seen if any
of them show the effects individually?

> I was wondering if there was some library routines which
> could help me locate where I am overwriting unaloocated
> memory.
there certainly are... try Taj Khattra's mpr package at
ftp://metalab.unc.edu/pub/Linux/devel/lang/c/mpr-2.2.tar.gz
read the docs about it, essentially you build this static lib and build
with it (making sure to use -g), set some environment variables and run
your program. the output when you run your program will gove you no info
at all.. but use the output  with the mprlk program in the same
package... a shortcut would be
export MPRPC='mprpc <your program name>'
export MPRFI='cat > badmem.log'
mpr -f -l <your program name> < badmem.log | mprlk
i've never used it myself, but a programming book i once read spoke well
of its uses...

or you can use electric fence at
ftp://metalab.unc.edu/pub/Linux/devel/lang/c/ElectricFence-2.0.5.tar.gz

or use a lint brush like splint
http://www.splint.org/

i have only ever used splint.. which is nice the first few time syou run
it and learn a bit, but annoying afterwards....

im afraid its a lot of RTFM form there as i cant help any more than
this...

cheers,
Sam
-- 
If you aren't rich you should always look useful.
-- Louis-Ferdinand Celine

      reply	other threads:[~2002-10-24 20:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-24 12:29 ducharme
2002-10-24 13:26 ` Sam Halliday [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021024212645.40e109be.fommil@yahoo.ie \
    --to=fommil@yahoo.ie \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).