Hi godbach,

On Tue, Oct 15, 2013 at 12:06:41AM +0800, Godbach wrote:
> Hi Willy,
> 
> Since http_silent_debug()(src/proto_http.c) uses some members which only
> exist in the snapshot before struct channel is introduced, compile
> errors occur once DEBUG_FSM is enabled.

Hmmm good catch, as you can see I don't use this define often.

> The codes of http_silent_debug() are as below ans only req related codes
> are token as an example:
> 
> #if defined(DEBUG_FSM)
> static void http_silent_debug(int line, struct session *s)
> {
>       chunk_printf(&trash,
>                    "[%04d] req: p=%d(%d) s=%d bf=%08x an=%08x data=%p size=%d
> l=%d w=%p r=%p o=%p sm=%d fw=%ld tf=%08x\n",
>                    line,
>                    s->si[0].state, s->si[0].fd, s->txn.req.msg_state,
> s->req->flags, s->req->analysers,
>                    s->req->buf->data, s->req->buf->size, s->req->l,
> s->req->w, s->req->r, s->req->buf->p, s->req->buf->o,
> s->req->to_forward, s->txn.flags);
>       write(-1, trash.str, trash.len);
> 
> ...
> }
> 
> The following members are obsolete:
> * s->si[0].fd
> * s->req->l
> * s->req->w
> * s->req->r
>
> According to the latest implementation, the above members should be
> replaced as below in my opinion:
> * s->si[0].fd  =>  s->si[0].conn->t.sock.fd
> * s->req->l    =>  buffer_len(s->req->buf)
> * s->req->w    =>  bo_ptr(s->req->buf)
> * s->req->r    =>  bi_ptr(s->req->buf)
> 
> In addition ,I was confused by "o=%p", what should it be. If it should
> be s->req->buf->p, it is the same as bi_ptr(s->req->buf) actually.
> 
> If the replacements are correct and the use of  "o=%p" can be confirmed,
> I will send a patch later.

It would make more sense to completely redefine the output based on the
information we have now in my opinion. So better dump the elements of
the channel one by one instead of trying to map them to the old ones.
Indeed, the only reason for printing these info is to be able to quickly
use "print *<some-address>" in GDB.

You may be interested in reading "doc/internals/buffer-ops.fig" to see
how the buffers changed and what they contain right now.

Cheers,
Willy


Reply via email to