1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
/* Debugging macros and interface.
Copyright (c) 2005, 2011 Rocky Bernstein <rocky@gnu.org>
GNU Make is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Make is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Make; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "makeint.h"
#include "make.h"
#include "debug.h"
#include "print.h"
debug_level_mask_t debug_dummy_level_mask;
debug_enter_debugger_t debug_dummy_enter_debugger_mask;
int debug_flag = 0;
/*! If true, enter the debugger before updating goal. */
bool b_debugger_goal = false;
stringlist_t *db_flags;
/** Toggle -d on receipt of SIGUSR1. */
#ifdef SIGUSR1
RETSIGTYPE
debug_signal_handler (int sig)
{
UNUSED_ARGUMENT(sig);
db_level = db_level ? DB_NONE : DB_BASIC;
}
#endif
/*! Set the global db_level mask based on the command option list
db_flags.
*/
void
decode_debug_flags (int b_debug_flag, stringlist_t *ppsz_db_flags)
{
const char **pp;
if (b_debug_flag)
db_level = DB_ALL;
if (!ppsz_db_flags)
return;
for (pp=ppsz_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_BASIC | DB_IMPLICIT;
break;
case 'j':
db_level |= DB_JOBS;
break;
case 'm':
db_level |= DB_BASIC | DB_MAKEFILES;
break;
case 'r':
db_level |= DB_BASIC | DB_READ_MAKEFILES;
break;
case 'v':
db_level |= DB_BASIC | DB_VERBOSE;
break;
default:
OS ( fatal, NILF, _("unknown debug level specification `%s'"), p);
}
while (*(++p) != '\0')
if (*p == ',' || *p == ' ')
break;
if (*p == '\0')
break;
++p;
}
}
}
/*
* Local variables:
* eval: (c-set-style "gnu")
* indent-tabs-mode: nil
* End:
*/
|