Re: [suse-programming-e] porting problems ....
"William A. Mahaffey III" <wam@HiWAAY.net> writes:
.... 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 might want to look into ElectricFence (also available on 8.2). markgray@soyo:/usr/X11R6> rpm -qi ElectricFence Name : ElectricFence Relocations: (not relocatable) Version : 2.2.2 Vendor: SUSE LINUX AG, Nuernberg, Germany Release : 529 Build Date: Fri 01 Oct 2004 08:49:24 PM EDT Install date: Thu 25 Nov 2004 12:22:21 PM EST Build Host: morricone.suse.de Group : Development/Tools/Debuggers Source RPM: ElectricFence-2.2.2-529.src.rpm Size : 74121 License: LGPL Signature : DSA/SHA1, Fri 01 Oct 2004 08:58:12 PM EDT, Key ID a84edae89c800aca Packager : http://www.suse.de/feedback URL : http://perens.com/FreeSoftware Summary : Malloc Debugger Description : Tool for debugging your C-programs (malloc debugger). Authors: -------- Bruce Perens <Bruce@Pixar.com> Distribution: SuSE Linux 9.2 (i586)
Mark Gray wrote:
"William A. Mahaffey III" <wam@HiWAAY.net> writes:
.... 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 might want to look into ElectricFence (also available on 8.2).
markgray@soyo:/usr/X11R6> rpm -qi ElectricFence Name : ElectricFence Relocations: (not relocatable) Version : 2.2.2 Vendor: SUSE LINUX AG, Nuernberg, Germany Release : 529 Build Date: Fri 01 Oct 2004 08:49:24 PM EDT Install date: Thu 25 Nov 2004 12:22:21 PM EST Build Host: morricone.suse.de Group : Development/Tools/Debuggers Source RPM: ElectricFence-2.2.2-529.src.rpm Size : 74121 License: LGPL Signature : DSA/SHA1, Fri 01 Oct 2004 08:58:12 PM EDT, Key ID a84edae89c800aca Packager : http://www.suse.de/feedback URL : http://perens.com/FreeSoftware Summary : Malloc Debugger Description : Tool for debugging your C-programs (malloc debugger).
Authors: -------- Bruce Perens <Bruce@Pixar.com> Distribution: SuSE Linux 9.2 (i586)
I searched my 3 ROMs (SuSE 8.2 personal) & it's not there, professional only ? On mirrors ? TIA
participants (2)
-
Mark Gray
-
William A. Mahaffey III