Re: Debugging xfree() (WAS: , in the URL)

From: Mihalis Tsoukalos <ekefe@dont-contact.us>
Date: Sat, 22 Mar 2003 11:43:09 +0200

I have already downloaded valgrind and installed it thanks to your
suggestions :-)
Any recommendations on how to run valgrind against squid?

Also, according to your suggestions I won't try to use the XMALLOC_TRACE and
XMALLOC_DEBUG features.

TIA,
Mihalis.

----- Original Message -----
From: "Henrik Nordstrom" <hno@squid-cache.org>
To: "Mihalis Tsoukalos" <ekefe@freemail.gr>
Cc: <squid-dev@squid-cache.org>
Sent: Friday, March 21, 2003 3:58 PM
Subject: Re: Debugging xfree() (WAS: , in the URL)

> If you crash in free() when you have a memory corruption issue like
>
> * buffer overrun
> * Reuse of memory after free().
> * Incorrectly sized memory allocation (smaller than intended)
>
> Use of malloc debugging tools like valgrind is recommended for detecting
> where this corruption occurs. It is almost impossible to debug with gdb
> alone.
>
> Regards
> Henrik
>
>
>
> fre 2003-03-21 klockan 11.20 skrev Mihalis Tsoukalos:
> > While I was trying to debug the changes that some colleagues have made
to
> > squid source code, I came up to the following situation:
> >
> > Program received signal SIGSEGV, Segmentation fault.
> > 0x4011ddcb in chunk_free () from /lib/libc.so.6
> >
> > (part of (gdb) where full)
> > #2 0x080b8623 in xfree (s=0x847c038) at util.c:484
> > No locals.
> >
> > (gdb) where
> > #0 0x4011ddcb in chunk_free () from /lib/libc.so.6
> > #1 0x4011dc53 in free () from /lib/libc.so.6
> > #2 0x080b8623 in xfree (s=0x847c038) at util.c:484
> > #3 0x08065b99 in **A custom function() ** (fd=16) at client_side.c:3613
> > #4 0x08061512 in clientWriteComplete (fd=16, bufnotused=0x0, size=3295,
> > errflag=0, data=0x84792c0) at client_side.c:2096
> > #5 0x08066994 in CommWriteStateCallbackAndFree (fd=16, code=0) at
comm.c:98
> > #6 0x08068ee0 in commHandleWrite (fd=16, data=0x8471e50) at comm.c:881
> > #7 0x08069f80 in comm_poll (msec=355) at comm_select.c:446
> > #8 0x0808d31d in main (argc=2, argv=0xbffff8e4) at main.c:859
> > #9 0x400c69ed in __libc_start_main () from /lib/libc.so.6
> > (gdb)
> >
> > As I understand the problem is the s pointer. It is either NULL or what?
> > I thought that xfree() was doing all the necessary tests in order to
avoid
> > such errors.
> > Am I missing something?
> >
> > many thanks in advance,
> > Mihalis
> >
> > ----- Original Message -----
> > From: "Henrik Nordstrom" <hno@squid-cache.org>
> > To: "Mihalis Tsoukalos" <ekefe@freemail.gr>
> > Cc: <squid-users@squid-cache.org>
> > Sent: Monday, March 17, 2003 9:13 AM
> > Subject: Re: AW: [squid-users] , in the URL
> >
> >
> > > You use GDB as usual.. a process is a process.
> > >
> > > Either use the -N command line option when starting Squid from within
> > > gdb, or attach to the running process.
> > >
> > > Regards
> > > Henrik
Received on Sat Mar 22 2003 - 02:43:26 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:19:34 MST