Commit 62a97934 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ntdll: Allow specifying per-process channels.

Based on a patch by Michael Müller.
parent 8c985449
......@@ -129,7 +129,7 @@ static void add_option( const char *name, unsigned char set, unsigned char clear
}
/* parse a set of debugging option specifications and add them to the option list */
static void parse_options( const char *str )
static void parse_options( const char *str, const char *app_name )
{
char *opt, *next, *options;
unsigned int i;
......@@ -137,11 +137,18 @@ static void parse_options( const char *str )
if (!(options = strdup(str))) return;
for (opt = options; opt; opt = next)
{
const char *p;
char *p;
unsigned char set = 0, clear = 0;
if ((next = strchr( opt, ',' ))) *next++ = 0;
if ((p = strchr( opt, ':' )))
{
*p = 0;
if (strcasecmp( opt, app_name )) continue;
opt = p + 1;
}
p = opt + strcspn( opt, "+-" );
if (!p[0]) p = opt; /* assume it's a debug channel name */
......@@ -182,7 +189,7 @@ static void debug_usage(void)
{
static const char usage[] =
"Syntax of the WINEDEBUG variable:\n"
" WINEDEBUG=[class]+xxx,[class]-yyy,...\n\n"
" WINEDEBUG=[[process:]class]+xxx,[[process:]class]-yyy,...\n\n"
"Example: WINEDEBUG=+relay,warn-heap\n"
" turns on relay traces, disable heap warnings\n"
"Available message classes: err, warn, fixme, trace\n";
......@@ -194,6 +201,7 @@ static void debug_usage(void)
static void init_options(void)
{
char *wine_debug = getenv("WINEDEBUG");
const char *app_name, *p;
struct stat st1, st2;
nb_debug_options = 0;
......@@ -208,7 +216,11 @@ static void init_options(void)
}
if (!wine_debug) return;
if (!strcmp( wine_debug, "help" )) debug_usage();
parse_options( wine_debug );
app_name = main_argv[1];
while ((p = strpbrk( app_name, "/\\" ))) app_name = p + 1;
parse_options( wine_debug, app_name );
}
/***********************************************************************
......
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