Re: howto debug unzip under cygwin?

Greg Roelofs <[email protected]> Thu, 12 Feb 2004 23:34:16 -0800
Newsgroups gmane.comp.archivers.info-zip
Message-ID <[email protected]>
Thomas L Roche <tlroche-r/[email protected]> wrote:

> >> >     735 [main] unzip 1820 cmalloc: cmalloc returned NULL
> >> > error:  zipfile probably corrupt (segmentation violation)

> What do I need to do to build unzip with debug info under Cygwin?

It appears that unzip-5.50-5.sh is the key.  See how it's invoking
the compiler when given "build" as an argument, and add -g to the
command line somehow (e.g., to CFLAGS or even the definition of CC).
(Presumably Cygwin uses gcc, which uses -g....)  Possibly the script
even has a debug option that's ready to go, but I don't know anything
about Cygwin's build procedures.

> Also, I'd appreciate information about 

> * the plausibility of my hypothesis. I suspect there is a problem in
>   the new cygwin's malloc code: something that formerly did not return
>   NULL now does, which is choking unzip. Does this sound reasonable?

Yes.  UnZip should have failure checks for all malloc/calloc calls,
but it's possible that the calloc() failure is triggering other problems
or is itself triggered by a larger problem that is also causing other
badness to occur.

> * where should I look for the underlying malloc code (cygwin1.dll?
>   libc*?), and how should I build/debug that?

No clue.  The Cygwin folks will have to answer that.

Regards,
-- 
Greg Roelofs            [email protected]             http://pobox.com/~newt/
Newtware, PNG Group, Info-ZIP, AlphaWorld Map, Philips Semiconductors, ...