RE: [suse-programming-e] porting problems ....
-----Original Message----- From: William A. Mahaffey III [mailto:wam@HiWAAY.net] Sent: Tuesday, November 30, 2004 7:54 AM To: Suse Programming List Subject: [suse-programming-e] porting problems ....
.... I am trying to port some code (a Motif CAD/Grid-generator) from SGI to my SuSE 8.2 Linux box. Everything is coming fairly smoothly (actually DAMN smooth), except for 1 thing. The code is mostly C, with some leaf-FORTRAN. I use malloc/realloc & free to allocate & free mamory. I have found several places where I was calling free repeatedly with the same pointer (slides by on SGI, bombs under Linux) & corrected all of them so far. I have fixed all the simple/silly stuff (I think) & now need to go a bit deeper. I tried activating the documented memory debugging using '#define MALLOC_CHECK_' in my program main, but I get no diagnostics or core dump, just execution which gets to a specific line & hangs. I have also tried the mtrace facility, but just get mention of 3 hex addresses where memory is free'd that wasn't alloc'd. I think I am screwing something else up earlier, but can't get a core dump or any diagnostics to help me out. SGI has a nice & very handy memory debugger (malloc (3X)) which can be compiled in & activated at runtime as needed, ignored otherwise. I haven't found any such thing (yet) under Linux. My question is how do I get Linux to either dump core or give me some diagnostics (at every call to malloc or free, like SGI ;-) ) so I can find my more subtle screwups & fix them ? TIA
You could try electric fence (probably on your distro. Try 'man efence'), NJAMD (Not Just Another Malloc Debugger), or google for something similar. Also, compiling it with the -g option (Assuming gcc), and run it through gdb. -Chris Kwasneski Software Engineer YPG, AZ
On Tuesday 30 November 2004 16:14, Kwasneski, Christopher D (Northrop Grumman) wrote:
You could try electric fence (probably on your distro. Try 'man efence'), NJAMD (Not Just Another Malloc Debugger), or google for something similar. Also, compiling it with the -g option (Assuming gcc), and run it through gdb.
valgrind is an insanely useful program for debugging memory matters. Have a look at that as well
For whatever reason, I couldn't get valgrind to work on my SuSE 9.1 64-bit install using package on DVD.... (FYI) B-) On Tuesday 30 November 2004 08:27 am, Anders Johansson wrote:
On Tuesday 30 November 2004 16:14, Kwasneski, Christopher D (Northrop Grumman)
wrote:
You could try electric fence (probably on your distro. Try 'man efence'), NJAMD (Not Just Another Malloc Debugger), or google for something similar. Also, compiling it with the -g option (Assuming gcc), and run it through gdb.
valgrind is an insanely useful program for debugging memory matters. Have a look at that as well
For whatever reason, I couldn't get valgrind to work on my SuSE 9.1 64-bit install using package on DVD.... (FYI)
Last time I check, valgrind only runs on 32-bit machines -- NEU +++ DSL Komplett von GMX +++ http://www.gmx.net/de/go/dsl GMX DSL-Netzanschluss + Tarif zum superg�nstigen Komplett-Preis!
On Tuesday 30 November 2004 17:19, cincaipatron@gmx.net wrote:
For whatever reason, I couldn't get valgrind to work on my SuSE 9.1 64-bit install using package on DVD.... (FYI)
Last time I check, valgrind only runs on 32-bit machines
Was there a 64 bit version of 8.2?
Anders Johansson wrote:
On Tuesday 30 November 2004 17:19, cincaipatron@gmx.net wrote:
Last time I check, valgrind only runs on 32-bit machines
Was there a 64 bit version of 8.2?
Well, I checked it using google, and it brought me to a milis archive of 2003. Since I couldn't find anything on valgrind website, I presume this is still valid. Would like to be corrected though, as I need a free memory checker on 64-bit (Opteron) too. Regards, Verdi -- NEU +++ DSL Komplett von GMX +++ http://www.gmx.net/de/go/dsl GMX DSL-Netzanschluss + Tarif zum superg�nstigen Komplett-Preis!
Verdi March wrote:
Anders Johansson wrote:
On Tuesday 30 November 2004 17:19, cincaipatron@gmx.net wrote:
Last time I check, valgrind only runs on 32-bit machines
Was there a 64 bit version of 8.2?
Well, I checked it using google, and it brought me to a milis archive of 2003. Since I couldn't find anything on valgrind website, I presume this is still valid. Would like to be corrected though, as I need a free memory checker on 64-bit (Opteron) too.
Regards, Verdi
Does whatever code you want to check out run 32-bit as well ? If so, you could check it for clean 32-bit, then port to 64-bit .... just a thought.
Not really, It is a Qt app. I have enterprise license, and it doesn't like to co-exist with itself both 32 & 64 without more tweaking than I am willing to do. I have other 32-bit machines though, and actually, they are what the final build runs on for clients. I can debug out there, and of course it is more convenient to debug on my dev box. B-) On Wednesday 01 December 2004 09:13 am, William A. Mahaffey III wrote:
Verdi March wrote:
Anders Johansson wrote:
On Tuesday 30 November 2004 17:19, cincaipatron@gmx.net wrote:
Last time I check, valgrind only runs on 32-bit machines
Was there a 64 bit version of 8.2?
Well, I checked it using google, and it brought me to a milis archive of 2003. Since I couldn't find anything on valgrind website, I presume this is still valid. Would like to be corrected though, as I need a free memory checker on 64-bit (Opteron) too.
Regards, Verdi
Does whatever code you want to check out run 32-bit as well ? If so, you could check it for clean 32-bit, then port to 64-bit .... just a thought.
Anders Johansson wrote:
On Tuesday 30 November 2004 16:14, Kwasneski, Christopher D (Northrop Grumman) wrote:
You could try electric fence (probably on your distro. Try 'man efence'), NJAMD (Not Just Another Malloc Debugger), or google for something similar. Also, compiling it with the -g option (Assuming gcc), and run it through gdb.
valgrind is an insanely useful program for debugging memory matters. Have a look at that as well
Thanks for the multitude of replys. Is valgrind on my distro ROMs ? If so, what is the package name ? TIA
On Tuesday 30 November 2004 17:46, William A. Mahaffey III wrote:
Thanks for the multitude of replys. Is valgrind on my distro ROMs ? If so, what is the package name ? TIA
Yes, valgrind was in 8.2, the package name is 'valgrind', if you don't have your CDs handy it is available at ftp://ftp.gwdg.de/linux/suse/ftp.suse.com/suse/i386/8.2/suse/i586/valgrind-1.9.4-6.i586.rpm and an updated version is available at ftp://ftp.gwdg.de/linux/suse/ftp.suse.com/suse/i386/supplementary/KDE/update_for_8.2/development/valgrind-2.2.0-3.i586.rpm
Anders Johansson wrote:
On Tuesday 30 November 2004 17:46, William A. Mahaffey III wrote:
Thanks for the multitude of replys. Is valgrind on my distro ROMs ? If so, what is the package name ? TIA
Yes, valgrind was in 8.2, the package name is 'valgrind', if you don't have your CDs handy it is available at
ftp://ftp.gwdg.de/linux/suse/ftp.suse.com/suse/i386/8.2/suse/i586/valgrind-1.9.4-6.i586.rpm
and an updated version is available at
ftp://ftp.gwdg.de/linux/suse/ftp.suse.com/suse/i386/supplementary/KDE/update_for_8.2/development/valgrind-2.2.0-3.i586.rpm
Thanks a million. I just downloaded the old & am having problems with it. I just got the new one & will try it. Thanks again :-).
Anders Johansson wrote:
On Tuesday 30 November 2004 16:14, Kwasneski, Christopher D (Northrop Grumman) wrote:
You could try electric fence (probably on your distro. Try 'man efence'), NJAMD (Not Just Another Malloc Debugger), or google for something similar. Also, compiling it with the -g option (Assuming gcc), and run it through gdb.
valgrind is an insanely useful program for debugging memory matters. Have a look at that as well
Indeed it is. I downloaded both ElectricFence & valgrind. EF (apparently) requires you to link in a different malloc library (theirs) to debug, while valgrind runs underneath the whole shebang with the stock malloc library. I like the 2nd approach better. I had to get the newer version, mentioned in a later post, but it worked wonders. I found around a dozen places where I was doubly (or more :-) ) freeing the same pointer, some separated by routine boundaries (& thus a bit tougher to find). VERY NICE CODE !!! I heartily recommend it to anyone with malloc/free problems. Thanks for the pointer :-).
participants (6)
-
Anders Johansson
-
Brad Bourn
-
cincaipatron@gmx.net
-
Kwasneski, Christopher D (Northrop Grumman)
-
Verdi March
-
William A. Mahaffey III