mirror of
https://github.com/mirror/make.git
synced 2025-03-27 20:40:35 +08:00
* Update debugging to use string flags instead of integers.
This commit is contained in:
parent
ce3413f883
commit
4d5c556f00
4
debug.h
4
debug.h
@ -20,11 +20,13 @@ Boston, MA 02111-1307, USA. */
|
|||||||
|
|
||||||
#define DB_NONE (0x000)
|
#define DB_NONE (0x000)
|
||||||
#define DB_BASIC (0x001)
|
#define DB_BASIC (0x001)
|
||||||
#define DB_EXTRA (0x002)
|
#define DB_VERBOSE (0x002)
|
||||||
#define DB_JOBS (0x004)
|
#define DB_JOBS (0x004)
|
||||||
#define DB_IMPLICIT (0x008)
|
#define DB_IMPLICIT (0x008)
|
||||||
#define DB_MAKEFILES (0x100)
|
#define DB_MAKEFILES (0x100)
|
||||||
|
|
||||||
|
#define DB_ALL (0xfff)
|
||||||
|
|
||||||
extern int db_level;
|
extern int db_level;
|
||||||
|
|
||||||
#define ISDB(_l) ((_l)&db_level)
|
#define ISDB(_l) ((_l)&db_level)
|
||||||
|
@ -1455,7 +1455,7 @@ func_shell (o, argv, funcname)
|
|||||||
reap_children (1, 0);
|
reap_children (1, 0);
|
||||||
|
|
||||||
if (batch_filename) {
|
if (batch_filename) {
|
||||||
DB (DB_EXTRA, (_("Cleaning up temporary batch file %s\n"),
|
DB (DB_VERBOSE, (_("Cleaning up temporary batch file %s\n"),
|
||||||
batch_filename));
|
batch_filename));
|
||||||
remove(batch_filename);
|
remove(batch_filename);
|
||||||
free(batch_filename);
|
free(batch_filename);
|
||||||
|
81
main.c
81
main.c
@ -141,9 +141,9 @@ int just_print_flag;
|
|||||||
|
|
||||||
/* Print debugging info (--debug). */
|
/* Print debugging info (--debug). */
|
||||||
|
|
||||||
|
static struct stringlist *db_flags;
|
||||||
|
|
||||||
int db_level = 0;
|
int db_level = 0;
|
||||||
int noarg_db_level = 1;
|
|
||||||
int default_db_level = 0;
|
|
||||||
|
|
||||||
#ifdef WINDOWS32
|
#ifdef WINDOWS32
|
||||||
/* Suspend make in main for a short time to allow debugger to attach */
|
/* Suspend make in main for a short time to allow debugger to attach */
|
||||||
@ -260,9 +260,9 @@ static const struct command_switch switches[] =
|
|||||||
{ 'C', string, (char *) &directories, 0, 0, 0, 0, 0,
|
{ 'C', string, (char *) &directories, 0, 0, 0, 0, 0,
|
||||||
"directory", _("DIRECTORY"),
|
"directory", _("DIRECTORY"),
|
||||||
_("Change to DIRECTORY before doing anything") },
|
_("Change to DIRECTORY before doing anything") },
|
||||||
{ 'd', positive_int, (char *) &db_level, 1, 1, 0,
|
{ 'd', string, (char *) &db_flags, 1, 1, 0,
|
||||||
(char *) &noarg_db_level, (char *) &default_db_level,
|
"basic", 0,
|
||||||
"debug", "L",
|
"debug", _("FLAGS"),
|
||||||
_("Print different types of debugging information") },
|
_("Print different types of debugging information") },
|
||||||
#ifdef WINDOWS32
|
#ifdef WINDOWS32
|
||||||
{ 'D', flag, (char *) &suspend_flag, 1, 1, 0, 0, 0,
|
{ 'D', flag, (char *) &suspend_flag, 1, 1, 0, 0, 0,
|
||||||
@ -489,7 +489,57 @@ static RETSIGTYPE
|
|||||||
debug_signal_handler (sig)
|
debug_signal_handler (sig)
|
||||||
int sig;
|
int sig;
|
||||||
{
|
{
|
||||||
db_level = DB_NONE;
|
db_level = db_level ? DB_NONE : DB_BASIC;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
decode_debug_flags ()
|
||||||
|
{
|
||||||
|
char **pp;
|
||||||
|
|
||||||
|
if (!db_flags)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (pp=db_flags->list; *pp; ++pp)
|
||||||
|
{
|
||||||
|
const char *p = *pp;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
switch (tolower (p[0]))
|
||||||
|
{
|
||||||
|
case 'a':
|
||||||
|
db_level |= DB_ALL;
|
||||||
|
break;
|
||||||
|
case 'b':
|
||||||
|
db_level |= DB_BASIC;
|
||||||
|
break;
|
||||||
|
case 'i':
|
||||||
|
db_level |= DB_IMPLICIT;
|
||||||
|
break;
|
||||||
|
case 'j':
|
||||||
|
db_level |= DB_JOBS;
|
||||||
|
break;
|
||||||
|
case 'm':
|
||||||
|
db_level |= DB_MAKEFILES;
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
db_level |= DB_BASIC | DB_VERBOSE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fatal (NILF, _("unknown debug level specification `%s'"), p);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (*(++p) != '\0')
|
||||||
|
if (*p == ',' || *p == ' ')
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (*p == '\0')
|
||||||
|
break;
|
||||||
|
|
||||||
|
++p;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WINDOWS32
|
#ifdef WINDOWS32
|
||||||
@ -497,8 +547,8 @@ debug_signal_handler (sig)
|
|||||||
* HANDLE runtime exceptions by avoiding a requestor on the GUI. Capture
|
* HANDLE runtime exceptions by avoiding a requestor on the GUI. Capture
|
||||||
* exception and print it to stderr instead.
|
* exception and print it to stderr instead.
|
||||||
*
|
*
|
||||||
* If ! DB_EXTRA, just print a simple message and exit.
|
* If ! DB_VERBOSE, just print a simple message and exit.
|
||||||
* If DB_EXTRA, print a more verbose message.
|
* If DB_VERBOSE, print a more verbose message.
|
||||||
* If compiled for DEBUG, let exception pass through to GUI so that
|
* If compiled for DEBUG, let exception pass through to GUI so that
|
||||||
* debuggers can attach.
|
* debuggers can attach.
|
||||||
*/
|
*/
|
||||||
@ -514,7 +564,7 @@ handle_runtime_exceptions( struct _EXCEPTION_POINTERS *exinfo )
|
|||||||
LPTSTR lpszStrings[1];
|
LPTSTR lpszStrings[1];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (! ISDB (DB_EXTRA))
|
if (! ISDB (DB_VERBOSE))
|
||||||
{
|
{
|
||||||
sprintf(errmsg, _("%s: Interrupt/Exception caught "), prg);
|
sprintf(errmsg, _("%s: Interrupt/Exception caught "), prg);
|
||||||
sprintf(&errmsg[strlen(errmsg)],
|
sprintf(&errmsg[strlen(errmsg)],
|
||||||
@ -601,7 +651,7 @@ find_and_set_default_shell(char *token)
|
|||||||
/* search token path was found */
|
/* search token path was found */
|
||||||
sprintf(sh_path, "%s", search_token);
|
sprintf(sh_path, "%s", search_token);
|
||||||
default_shell = xstrdup(w32ify(sh_path,0));
|
default_shell = xstrdup(w32ify(sh_path,0));
|
||||||
DB (DB_EXTRA,
|
DB (DB_VERBOSE,
|
||||||
(_("find_and_set_shell setting default_shell = %s\n"), default_shell));
|
(_("find_and_set_shell setting default_shell = %s\n"), default_shell));
|
||||||
sh_found = 1;
|
sh_found = 1;
|
||||||
} else {
|
} else {
|
||||||
@ -644,7 +694,7 @@ find_and_set_default_shell(char *token)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sh_found)
|
if (sh_found)
|
||||||
DB (DB_EXTRA,
|
DB (DB_VERBOSE,
|
||||||
(_("find_and_set_shell path search set default_shell = %s\n"),
|
(_("find_and_set_shell path search set default_shell = %s\n"),
|
||||||
default_shell));
|
default_shell));
|
||||||
}
|
}
|
||||||
@ -949,10 +999,7 @@ int main (int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If we have the "extra" level, force the basic level too. */
|
decode_debug_flags ();
|
||||||
|
|
||||||
if (ISDB (DB_EXTRA))
|
|
||||||
db_level |= DB_BASIC;
|
|
||||||
|
|
||||||
/* Print version information. */
|
/* Print version information. */
|
||||||
|
|
||||||
@ -1514,7 +1561,7 @@ int main (int argc, char ** argv)
|
|||||||
stupidly; but if you work for Athena, that's how
|
stupidly; but if you work for Athena, that's how
|
||||||
you write your makefiles.) */
|
you write your makefiles.) */
|
||||||
|
|
||||||
DB (DB_EXTRA,
|
DB (DB_VERBOSE,
|
||||||
(_("Makefile `%s' might loop; not remaking it.\n"),
|
(_("Makefile `%s' might loop; not remaking it.\n"),
|
||||||
f->name));
|
f->name));
|
||||||
|
|
||||||
@ -2133,7 +2180,7 @@ decode_switches (argc, argv, env)
|
|||||||
|
|
||||||
case positive_int:
|
case positive_int:
|
||||||
if (optarg == 0 && argc > optind
|
if (optarg == 0 && argc > optind
|
||||||
&& ISDIGIT (argv[optind][0]))
|
&& ISDIGIT (argv[optind][0]))
|
||||||
optarg = argv[optind++];
|
optarg = argv[optind++];
|
||||||
|
|
||||||
if (!doit)
|
if (!doit)
|
||||||
|
2
read.c
2
read.c
@ -329,7 +329,7 @@ read_makefile (filename, flags)
|
|||||||
pattern_percent = 0;
|
pattern_percent = 0;
|
||||||
cmds_started = fileinfo.lineno;
|
cmds_started = fileinfo.lineno;
|
||||||
|
|
||||||
if (ISDB (DB_EXTRA))
|
if (ISDB (DB_VERBOSE))
|
||||||
{
|
{
|
||||||
printf (_("Reading makefile `%s'"), fileinfo.filenm);
|
printf (_("Reading makefile `%s'"), fileinfo.filenm);
|
||||||
if (flags & RM_NO_DEFAULT_GOAL)
|
if (flags & RM_NO_DEFAULT_GOAL)
|
||||||
|
28
remake.c
28
remake.c
@ -319,7 +319,7 @@ update_file (file, depth)
|
|||||||
change is possible below here until then. */
|
change is possible below here until then. */
|
||||||
if (f->considered == considered)
|
if (f->considered == considered)
|
||||||
{
|
{
|
||||||
DBF (DB_EXTRA, _("Pruning file `%s'.\n"));
|
DBF (DB_VERBOSE, _("Pruning file `%s'.\n"));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
f->considered = considered;
|
f->considered = considered;
|
||||||
@ -364,19 +364,19 @@ update_file_1 (file, depth)
|
|||||||
register struct dep *d, *lastd;
|
register struct dep *d, *lastd;
|
||||||
int running = 0;
|
int running = 0;
|
||||||
|
|
||||||
DBF (DB_EXTRA, _("Considering target file `%s'.\n"));
|
DBF (DB_VERBOSE, _("Considering target file `%s'.\n"));
|
||||||
|
|
||||||
if (file->updated)
|
if (file->updated)
|
||||||
{
|
{
|
||||||
if (file->update_status > 0)
|
if (file->update_status > 0)
|
||||||
{
|
{
|
||||||
DBF (DB_EXTRA,
|
DBF (DB_VERBOSE,
|
||||||
_("Recently tried and failed to update file `%s'.\n"));
|
_("Recently tried and failed to update file `%s'.\n"));
|
||||||
no_rule_error(file);
|
no_rule_error(file);
|
||||||
return file->update_status;
|
return file->update_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBF (DB_EXTRA, _("File `%s' was considered already.\n"));
|
DBF (DB_VERBOSE, _("File `%s' was considered already.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,10 +386,10 @@ update_file_1 (file, depth)
|
|||||||
case cs_deps_running:
|
case cs_deps_running:
|
||||||
break;
|
break;
|
||||||
case cs_running:
|
case cs_running:
|
||||||
DBF (DB_EXTRA, _("Still updating file `%s'.\n"));
|
DBF (DB_VERBOSE, _("Still updating file `%s'.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
case cs_finished:
|
case cs_finished:
|
||||||
DBF (DB_EXTRA, _("Finished updating file `%s'.\n"));
|
DBF (DB_VERBOSE, _("Finished updating file `%s'.\n"));
|
||||||
return file->update_status;
|
return file->update_status;
|
||||||
default:
|
default:
|
||||||
abort ();
|
abort ();
|
||||||
@ -526,13 +526,13 @@ update_file_1 (file, depth)
|
|||||||
|
|
||||||
file->updating = 0;
|
file->updating = 0;
|
||||||
|
|
||||||
DBF (DB_EXTRA, _("Finished prerequisites of target file `%s'.\n"));
|
DBF (DB_VERBOSE, _("Finished prerequisites of target file `%s'.\n"));
|
||||||
|
|
||||||
if (running)
|
if (running)
|
||||||
{
|
{
|
||||||
set_command_state (file, cs_deps_running);
|
set_command_state (file, cs_deps_running);
|
||||||
--depth;
|
--depth;
|
||||||
DBF (DB_EXTRA, _("The prerequisites of `%s' are being made.\n"));
|
DBF (DB_VERBOSE, _("The prerequisites of `%s' are being made.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -545,7 +545,7 @@ update_file_1 (file, depth)
|
|||||||
|
|
||||||
depth--;
|
depth--;
|
||||||
|
|
||||||
DBF (DB_EXTRA, _("Giving up on target file `%s'.\n"));
|
DBF (DB_VERBOSE, _("Giving up on target file `%s'.\n"));
|
||||||
|
|
||||||
if (depth == 0 && keep_going_flag
|
if (depth == 0 && keep_going_flag
|
||||||
&& !just_print_flag && !question_flag)
|
&& !just_print_flag && !question_flag)
|
||||||
@ -591,7 +591,7 @@ update_file_1 (file, depth)
|
|||||||
or its dependent, FILE, is older or does not exist. */
|
or its dependent, FILE, is older or does not exist. */
|
||||||
d->changed |= noexist || d_mtime > this_mtime;
|
d->changed |= noexist || d_mtime > this_mtime;
|
||||||
|
|
||||||
if (!noexist && ISDB (DB_BASIC|DB_EXTRA))
|
if (!noexist && ISDB (DB_BASIC|DB_VERBOSE))
|
||||||
{
|
{
|
||||||
const char *fmt = 0;
|
const char *fmt = 0;
|
||||||
|
|
||||||
@ -605,7 +605,7 @@ update_file_1 (file, depth)
|
|||||||
if (ISDB (DB_BASIC))
|
if (ISDB (DB_BASIC))
|
||||||
fmt = _("Prerequisite `%s' is newer than target `%s'.\n");
|
fmt = _("Prerequisite `%s' is newer than target `%s'.\n");
|
||||||
}
|
}
|
||||||
else if (ISDB (DB_EXTRA))
|
else if (ISDB (DB_VERBOSE))
|
||||||
fmt = _("Prerequisite `%s' is older than target `%s'.\n");
|
fmt = _("Prerequisite `%s' is older than target `%s'.\n");
|
||||||
|
|
||||||
if (fmt)
|
if (fmt)
|
||||||
@ -629,13 +629,13 @@ update_file_1 (file, depth)
|
|||||||
else if (!noexist && file->is_target && !deps_changed && file->cmds == 0)
|
else if (!noexist && file->is_target && !deps_changed && file->cmds == 0)
|
||||||
{
|
{
|
||||||
must_make = 0;
|
must_make = 0;
|
||||||
DBF (DB_EXTRA,
|
DBF (DB_VERBOSE,
|
||||||
_("No commands for `%s' and no prerequisites actually changed.\n"));
|
_("No commands for `%s' and no prerequisites actually changed.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!must_make)
|
if (!must_make)
|
||||||
{
|
{
|
||||||
if (ISDB (DB_EXTRA))
|
if (ISDB (DB_VERBOSE))
|
||||||
{
|
{
|
||||||
print_spaces (depth);
|
print_spaces (depth);
|
||||||
printf (_("No need to remake target `%s'"), file->name);
|
printf (_("No need to remake target `%s'"), file->name);
|
||||||
@ -675,7 +675,7 @@ update_file_1 (file, depth)
|
|||||||
|
|
||||||
if (file->command_state != cs_finished)
|
if (file->command_state != cs_finished)
|
||||||
{
|
{
|
||||||
DBF (DB_EXTRA, _("Commands of `%s' are being run.\n"));
|
DBF (DB_VERBOSE, _("Commands of `%s' are being run.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user