while (proceed==true) {
switch (phase) {
case 0 : //checking parameters
- if ((params=par_getparams(argc,argv,"c:d:fhr:v"))==(ARGTYP *)0) {
+ if ((params=par_getparams(argc,argv,"c:d:D:fhr:v"))==(ARGTYP *)0) {
phase=999; //no need to go further
}
break;
//(void) rou_alert(0,"%s JMPDBG phase='%d'",OPEP,phase);
switch (phase) {
case 0 : //checking parameters
- if ((params=par_getparams(argc,argv,"c:d:fhi:r:v"))==(ARGTYP *)0) {
+ if ((params=par_getparams(argc,argv,"c:d:D:fhi:r:v"))==(ARGTYP *)0) {
proceed=false; //no need to go further
}
break;
//(void) fprintf(stdout,"%s (pid=%08d) JMPDBG phase='%d'\n",OPEP,getpid(),phase);
switch (phase) {
case 0 : //checking parameters
- if ((params=par_getparams(argc,argv,"c:d:fh:r:v"))==(ARGTYP *)0) {
+ if ((params=par_getparams(argc,argv,"c:d:D:fh:r:v"))==(ARGTYP *)0) {
proceed=false; //no need to go further
}
break;
//(void) rou_alert(0,"%s JMPDBG phase='%d'",OPEP,phase);
switch (phase) {
case 0 : //checking parameters
- if ((params=par_getparams(argc,argv,"c:d:fhi:r:v"))==(ARGTYP *)0) {
+ if ((params=par_getparams(argc,argv,"c:d:D:fhi:r:v"))==(ARGTYP *)0) {
proceed=false; //no need to go further
}
break;
//Public variables
PUBLIC int debug=0; //debug level
+PUBLIC char *dbglive; //procedure reference to be debugged live
PUBLIC _Bool foreground=false; //process is always started in background mode
PUBLIC char *rootdir=(char *)0;//working directory (debugging)
{
#define DBG "DBGLIVE"
-char *ptr;
-
-if ((debug>=dlevel)&&((ptr=getenv(DBG))!=(char *)0)) {
- (void) rou_alert(0,"Bigre ptr=<%s>",ptr);
- if (strstr(ptr,prcref)!=(char *)0) {
+(void) rou_alert(0,"BIGRE Bigre dbglive=<%s>",dbglive);
+if ((debug>=dlevel)&&(dbglive!=(char *)0)) {
+ (void) rou_alert(0,"Bigre dbglive=<%s>",dbglive);
+ if (strstr(dbglive,prcref)!=(char *)0) {
char *nstr;
va_list args;
extern int debug; //application debug mode
extern _Bool foreground; //process is in foreground mode
+extern char *dbglive; //string to check for live debugging
extern char *rootdir; //application root directory
extern char *appname; //application "official" name
extern char execname[]; //Application exec/binary name
static char *options[]={
"c[-c config]",
"d[-d debug]",
+ "D[-D dbglive]",
"f[-f]",
"h[-h]",
"i[-i IP]",
static char *details[]={
"-c config\t: set config file\n",
"-d level\t: debug level [1-10]\n",
+ "-D dbglive\t: Procedure name to use with live debug\n",
"-f\t\t: start program in foreground (CLI) mode\n",
"-h\t\t: print this help message\n",
"-i IP\t\t: IP to be used as source IP\n",
}
(void) free(params);
params=(ARGTYP *)0;
+ rou_freestr(dbglive);
+ dbglive=(char *)0;
}
return params;
}
debug=atoi(optarg);
(void) rou_alert(1,"debug level is now '%d'",debug);
break;
+ case 'D' : //debug level
+ dbglive=strdup(optarg);
+ (void) rou_alert(1,"debug live string=<%s>",dbglive);
+ break;
case 'f' : //background/daemon mode
foreground=true;
(void) fprintf(stdout,"%s-%s, foreground mode requested\n",
#options available to debug mailleur
#OPTIONS="-d9"
#this is to debug a specific function within a specific module
-#DBGLIV="lvleml.c:checkto,modrec.c:docontact"
+#OPTIONS="-d9 -Dlvleml.c:checkto,modrec.c:docontact
#-------------------------------------------