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
> >
> > Mihalis Tsoukalos wrote:
> > >
> > > I have checked it back and I have seen that the problem is not with
> Squid.
> > >
> > > So the question is now:
> > > Any hints on how to debug the (modified) squid C code?
> > >
> > > The reason I am asking is because squid is a server process. I know how
> to
> > > debug a no-server executable.
> > > I am going to use gdb.
> > >
> > > have a nice week,
> > > Mihalis.
-- Henrik Nordstrom <hno@squid-cache.org> MARA Systems AB, SwedenReceived on Fri Mar 21 2003 - 06:58:17 MST
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:19:34 MST