Commit c6d80ca7 authored by Federico G. Schwindt's avatar Federico G. Schwindt

Stringify oc->flags and oc->exp_flags on panic

parent f08820b3
......@@ -405,6 +405,18 @@ enum obj_flags {
#undef OBJ_FLAG
};
enum oc_flags {
#define OC_FLAG(U, l, v) OC_F_##U = v,
#include "tbl/oc_flags.h"
#undef OC_FLAG
};
enum oc_exp_flags {
#define OC_EXP_FLAG(U, l, v) OC_EF_##U = v,
#include "tbl/oc_exp_flags.h"
#undef OC_EXP_FLAG
};
struct objcore {
unsigned magic;
#define OBJCORE_MAGIC 0x4d301302
......@@ -421,19 +433,8 @@ struct objcore {
float keep;
uint8_t flags;
#define OC_F_BUSY (1<<1)
#define OC_F_PASS (1<<2)
#define OC_F_ABANDON (1<<4)
#define OC_F_PRIVATE (1<<5)
#define OC_F_FAILED (1<<6)
#define OC_F_DYING (1<<7)
uint8_t exp_flags;
#define OC_EF_POSTED (1<<1)
#define OC_EF_REFD (1<<2)
#define OC_EF_MOVE (1<<3)
#define OC_EF_INSERT (1<<4)
#define OC_EF_REMOVE (1<<5)
uint16_t oa_present;
......
......@@ -145,8 +145,8 @@ pan_ws(struct vsb *vsb, const struct ws *ws)
PAN_CheckMagic(vsb, ws, WS_MAGIC);
if (!(ws->id[0] & 0x20))
VSB_printf(vsb, "OVERFLOWED ");
VSB_printf(vsb, "id = \"%s\",\n", ws->id);
VSB_printf(vsb, "{s, f, r, e} = {%p", ws->s);
VSB_printf(vsb, "id = \"%s\",\n", ws->id);
VSB_printf(vsb, "{s, f, r, e} = {%p", ws->s);
if (ws->f > ws->s)
VSB_printf(vsb, ", +%ld", (long) (ws->f - ws->s));
else
......@@ -243,6 +243,7 @@ pan_boc(struct vsb *vsb, const struct boc *boc)
static void
pan_objcore(struct vsb *vsb, const char *typ, const struct objcore *oc)
{
const char *p;
VSB_printf(vsb, "objcore[%s] = %p {\n", typ, oc);
if (pan_already(vsb, oc))
......@@ -250,8 +251,20 @@ pan_objcore(struct vsb *vsb, const char *typ, const struct objcore *oc)
VSB_indent(vsb, 2);
PAN_CheckMagic(vsb, oc, OBJCORE_MAGIC);
VSB_printf(vsb, "refcnt = %d,\n", oc->refcnt);
VSB_printf(vsb, "flags = 0x%x,\n", oc->flags);
VSB_printf(vsb, "exp_flags = 0x%x,\n", oc->exp_flags);
VSB_printf(vsb, "flags = {");
p = "";
#define OC_FLAG(U, l, v) \
if (oc->flags & v) { VSB_printf(vsb, "%s" #l, p); p = ", "; }
#include "tbl/oc_flags.h"
#undef OC_FLAG
VSB_printf(vsb, "},\n");
VSB_printf(vsb, "exp_flags = {");
p = "";
#define OC_EXP_FLAG(U, l, v) \
if (oc->exp_flags & v) { VSB_printf(vsb, "%s" #l, p); p = ", "; }
#include "tbl/oc_exp_flags.h"
#undef OC_EXP_FLAG
VSB_printf(vsb, "},\n");
if (oc->boc != NULL)
pan_boc(vsb, oc->boc);
VSB_printf(vsb, "exp = {%f, %f, %f, %f}\n",
......@@ -347,7 +360,7 @@ pan_busyobj(struct vsb *vsb, const struct busyobj *bo)
p = "";
/*lint -save -esym(438,p) */
#define BO_FLAG(l, r, w, d) \
if(bo->l) { VSB_printf(vsb, "%s" #l, p); p = ", "; }
if(bo->l) { VSB_printf(vsb, "%s" #l, p); p = ", "; }
#include "tbl/bo_flags.h"
#undef BO_FLAG
/*lint -restore */
......
/*-
* Copyright (c) 2016 Varnish Software AS
* All rights reserved.
*
* Author: Federico G. Schwindt <fgsch@lodoss.net>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*lint -save -e525 -e539 */
OC_EXP_FLAG(POSTED, posted, (1<<1))
OC_EXP_FLAG(REFD, refd, (1<<2))
OC_EXP_FLAG(MOVE, move, (1<<3))
OC_EXP_FLAG(INSERT, insert, (1<<4))
OC_EXP_FLAG(REMOVE, remove, (1<<5))
/*lint -restore */
/*-
* Copyright (c) 2016 Varnish Software AS
* All rights reserved.
*
* Author: Federico G. Schwindt <fgsch@lodoss.net>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*lint -save -e525 -e539 */
OC_FLAG(BUSY, busy, (1<<1))
OC_FLAG(PASS, pass, (1<<2))
OC_FLAG(ABANDON, abandon, (1<<4))
OC_FLAG(PRIVATE, private, (1<<5))
OC_FLAG(FAILED, failed, (1<<6))
OC_FLAG(DYING, dying, (1<<7))
/*lint -restore */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment