Skip to content
This repository was archived by the owner on Feb 16, 2026. It is now read-only.

Commit def50e6

Browse files
committed
ws: Polish debug logs to make them easier to follow
1 parent e9b41f8 commit def50e6

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

bin/varnishd/cache/cache_ws.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ WS_Assert(const struct ws *ws)
4444
{
4545

4646
CHECK_OBJ_NOTNULL(ws, WS_MAGIC);
47-
DSLb(DBG_WORKSPACE, "WS(%p) = (%s, %p %zu %zu %zu)",
48-
ws, ws->id, ws->s, pdiff(ws->s, ws->f),
47+
DSLb(DBG_WORKSPACE, "WS(%s, %p) = {%p %zu %zu %zu}",
48+
ws->id, ws, ws->s, pdiff(ws->s, ws->f),
4949
ws->r == NULL ? 0 : pdiff(ws->f, ws->r),
5050
pdiff(ws->s, ws->e));
5151
assert(ws->s != NULL);
@@ -85,7 +85,7 @@ WS_Init(struct ws *ws, const char *id, void *space, unsigned len)
8585
unsigned l;
8686

8787
DSLb(DBG_WORKSPACE,
88-
"WS_Init(%p, \"%s\", %p, %u)", ws, id, space, len);
88+
"WS_Init(%s, %p, %p, %u)", id, ws, space, len);
8989
assert(space != NULL);
9090
INIT_OBJ(ws, WS_MAGIC);
9191
ws->s = space;
@@ -116,12 +116,12 @@ WS_Reset(struct ws *ws, uintptr_t pp)
116116
WS_Assert(ws);
117117
AN(pp);
118118
if (pp == snap_overflowed) {
119-
DSLb(DBG_WORKSPACE, "WS_Reset(%p, overflowed)", ws);
119+
DSLb(DBG_WORKSPACE, "WS_Reset(%s, %p, overflowed)", ws->id, ws);
120120
AN(WS_Overflowed(ws));
121121
return;
122122
}
123123
p = (char *)pp;
124-
DSLb(DBG_WORKSPACE, "WS_Reset(%p, %p)", ws, p);
124+
DSLb(DBG_WORKSPACE, "WS_Reset(%s, %p, %p)", ws->id, ws, p);
125125
assert(ws->r == NULL);
126126
assert(p >= ws->s);
127127
assert(p <= ws->e);
@@ -176,7 +176,7 @@ WS_Alloc(struct ws *ws, unsigned bytes)
176176
}
177177
r = ws->f;
178178
ws->f += bytes;
179-
DSLb(DBG_WORKSPACE, "WS_Alloc(%p, %u) = %p", ws, bytes, r);
179+
DSLb(DBG_WORKSPACE, "WS_Alloc(%s, %p, %u) = %p", ws->id, ws, bytes, r);
180180
WS_Assert(ws);
181181
return (r);
182182
}
@@ -202,7 +202,7 @@ WS_Copy(struct ws *ws, const void *str, int len)
202202
r = ws->f;
203203
ws->f += bytes;
204204
memcpy(r, str, len);
205-
DSLb(DBG_WORKSPACE, "WS_Copy(%p, %d) = %p", ws, len, r);
205+
DSLb(DBG_WORKSPACE, "WS_Copy(%s, %p, %d) = %p", ws->id, ws, len, r);
206206
WS_Assert(ws);
207207
return (r);
208208
}
@@ -214,10 +214,11 @@ WS_Snapshot(struct ws *ws)
214214
WS_Assert(ws);
215215
assert(ws->r == NULL);
216216
if (WS_Overflowed(ws)) {
217-
DSLb(DBG_WORKSPACE, "WS_Snapshot(%p) = overflowed", ws);
217+
DSLb(DBG_WORKSPACE, "WS_Snapshot(%s, %p) = overflowed",
218+
ws->id, ws);
218219
return (snap_overflowed);
219220
}
220-
DSLb(DBG_WORKSPACE, "WS_Snapshot(%p) = %p", ws, ws->f);
221+
DSLb(DBG_WORKSPACE, "WS_Snapshot(%s, %p) = %p", ws->id, ws, ws->f);
221222
return ((uintptr_t)ws->f);
222223
}
223224

@@ -236,7 +237,7 @@ WS_ReserveAll(struct ws *ws)
236237
b = pdiff(ws->f, ws->r);
237238

238239
WS_Assert(ws);
239-
DSLb(DBG_WORKSPACE, "WS_ReserveAll(%p) = %u", ws, b);
240+
DSLb(DBG_WORKSPACE, "WS_ReserveAll(%s, %p) = %u", ws->id, ws, b);
240241

241242
return (b);
242243
}
@@ -259,7 +260,7 @@ WS_ReserveSize(struct ws *ws, unsigned bytes)
259260
return (0);
260261
}
261262
ws->r = ws->f + bytes;
262-
DSLb(DBG_WORKSPACE, "WS_ReserveSize(%p, %u/%u) = %u",
263+
DSLb(DBG_WORKSPACE, "WS_ReserveSize(%s, %p, %u/%u) = %u", ws->id,
263264
ws, bytes, l, bytes);
264265
WS_Assert(ws);
265266
return (bytes);
@@ -270,7 +271,7 @@ WS_Release(struct ws *ws, unsigned bytes)
270271
{
271272
WS_Assert(ws);
272273
assert(bytes <= ws->e - ws->f);
273-
DSLb(DBG_WORKSPACE, "WS_Release(%p, %u)", ws, bytes);
274+
DSLb(DBG_WORKSPACE, "WS_Release(%s, %p, %u)", ws->id, ws, bytes);
274275
assert(ws->r != NULL);
275276
assert(ws->f + bytes <= ws->r);
276277
ws->f += PRNDUP(bytes);
@@ -282,7 +283,8 @@ void
282283
WS_ReleaseP(struct ws *ws, const char *ptr)
283284
{
284285
WS_Assert(ws);
285-
DSLb(DBG_WORKSPACE, "WS_ReleaseP(%p, %p (%zd))", ws, ptr, ptr - ws->f);
286+
DSLb(DBG_WORKSPACE, "WS_ReleaseP(%s, %p, %p (%zd))", ws->id, ws, ptr,
287+
ptr - ws->f);
286288
assert(ws->r != NULL);
287289
assert(ptr >= ws->f);
288290
assert(ptr <= ws->r);

0 commit comments

Comments
 (0)