Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
30f4123c
Commit
30f4123c
authored
Jan 28, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a assert handler which tries to assign and report the assert
to the failing threads vtclog.
parent
a7761696
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
vtc_log.c
bin/varnishtest/vtc_log.c
+29
-0
No files found.
bin/varnishtest/vtc_log.c
View file @
30f4123c
...
...
@@ -41,6 +41,7 @@ SVNID("$Id$")
#include "libvarnish.h"
#include "vsb.h"
#include "miniobj.h"
#include "vas.h"
#include "vtc.h"
...
...
@@ -56,6 +57,8 @@ struct vtclog {
pthread_mutex_t
mtx
;
};
static
pthread_key_t
log_key
;
/**********************************************************************/
void
...
...
@@ -65,6 +68,7 @@ vtc_loginit(char *buf, unsigned buflen)
vtclog_buf
=
buf
;
vtclog_left
=
buflen
;
AZ
(
pthread_mutex_init
(
&
vtclog_mtx
,
NULL
));
AZ
(
pthread_key_create
(
&
log_key
,
NULL
));
}
/**********************************************************************/
...
...
@@ -80,6 +84,7 @@ vtc_logopen(const char *id)
vl
->
id
=
id
;
vl
->
vsb
=
vsb_newauto
();
AZ
(
pthread_mutex_init
(
&
vl
->
mtx
,
NULL
));
AZ
(
pthread_setspecific
(
log_key
,
vl
));
return
(
vl
);
}
...
...
@@ -274,3 +279,27 @@ vtc_hexdump(struct vtclog *vl, unsigned lvl, const char *pfx, const unsigned cha
pthread_exit
(
NULL
);
}
}
/**********************************************************************/
static
void
vtc_log_vas_fail
(
const
char
*
func
,
const
char
*
file
,
int
line
,
const
char
*
cond
,
int
err
,
int
xxx
)
{
struct
vtclog
*
vl
;
(
void
)
err
;
(
void
)
xxx
;
vl
=
pthread_getspecific
(
log_key
);
if
(
vl
==
NULL
)
{
fprintf
(
stderr
,
"Assert error in %s(), %s line %d:
\n
"
" Condition(%s) not true.
\n
"
,
func
,
file
,
line
,
cond
);
}
else
{
vtc_log
(
vl
,
0
,
"Assert error in %s(), %s line %d:"
" Condition(%s) not true.
\n
"
,
func
,
file
,
line
,
cond
);
}
}
vas_f
*
vas_fail
=
vtc_log_vas_fail
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment