Re: Null pointer

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Thu, 15 Jan 1998 23:15:28 +0100

--MimeMultipartBoundary
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Oskar Pearson wrote:

> I never have worked out gdb...
>=20
> I can find where comm_close calls RWStateCallbackAndFree, but I can't
> find where RWStateCallbackAndFree calls 'put_free_4k_page'... doesn't i=
t
> show ALL the functions it traverses then? or only when the options
> change? Maybe I can start fixing bugs then...

GDB shows all functions in a strack trace (unless you have turned on
optimization of stack frames, but this is not the case here).

The put_free_4k_page call is probably the ->free(xxx) call.

    if (RWState->free) {
        RWState->free(RWState->buf);
        ^^^^^^^^^^^^^^ here

This is a call thought a function pointer embedded in the RWStateData
structure. The function is passed to comm_write which stores it in the
RWStateData.

To decode the RWState structure you have to check the ->free and
->handler function pointers, then search for a matching comm_write call.

When you know what the ->handler is, then you can decode the
->handler_data. Do do this you look up the function in ->handler, and
typecast ->handler_data to the structure used in that function.

Use "up", until you get to the function (RWStateCallbackAndFree) that
have the data you are interested in, then use "print *(type
*)RWState->handler_data" to recode the handler_data pointer.

Your FATAL on NULL indicates that something tried to use comm_write with
a null pointer (->buf =3D=3D null). I searched thought the 1.1.20 sources
and could not find any obious case where this could happen without
crashing earlier but could not find any. Maybe RWStateData is used for
other things besides comm_write in 1.NOVM.? I have never looked at the
NOVM sources. (or maybe it is fixed in later revisions).

Another thing you can check is the fd_table. This contains very much
information about each active file descriptor. If you know this (and the
->free and ->handler above) it should be very easy to find where the
operation was initiated.

(gdb) print fd_table[fd]

---
Henrik Nordstr=F6m
Sparetime Squid Hacker
--MimeMultipartBoundary--
Received on Tue Jul 29 2003 - 13:15:45 MDT

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