Subject: Re: [linux-audio-dev] Debugging question
From: Erik de Castro Lopo (erikd_AT_zip.com.au)
Date: ke tammi 05 2000 - 13:13:46 EST
Hi Juhana,
Juhana Sadeharju wrote:
>
> Hello. I'm annoyingly stuck with my wave editor programming: suddenly
> the window resizes itself to some large size. I guess some part of my
> program overwrites some important memory location. I have gone through
> my code, verified initializations, mallocs, returns of malloced structures
> from functions, etc. but simply cannot see where something goes wrong.
> Assuming the trouble is not in GTK+ 1.2.6, how should I attack this
> problem more systematically, more better?
Isn't debugging event-driven apps fun :-)?
> Should I write some verifying code for every assigment? Eek.
> How good programmers do it? Are there any automatic ways to check these?
> Where is Linux Lint? That sure would help for some kind of bugs.
There is a program called lclint (try freshmeat) but I don't think
there is any bug it can find which won't be found by gcc with all
the warnings turned on. I usually set CFLAGS as follows for
development work :
CFLAGS = -Wall -Wstrict-prototypes -pedantic-errors -g -O0
That should find most compile time recognisable C problems.
Unfortunately your problem sounds much more likely to be a buffer
overrun than something that can be found by a C compiler. For this
kind of problem you need a malloc debugger. Have a look at the GNU
Checker:
http://www.gnu.org/software/checker/checker.html
I've never used it but I have heard that its a good tool.
Also have a look here:
http://www.cs.colorado.edu/homes/zorn/public_html/MallocDebug.html
Electric Fence looks interesting as it uses virtual memory to track
down out of bounds errors.
Hope this helps,
Erik
-- +-------------------------------------------------+ Erik de Castro Lopo erikd_AT_zip.com.au +-------------------------------------------------+ "Two hands working can do more than a thousand clasped in prayer." -- anonymous
This archive was generated by hypermail 2b28 : pe maalis 10 2000 - 07:23:26 EST