MKSYSDEBUG: conditionally compile more debug code

This commit is contained in:
Arun Thomas
2011-09-16 14:57:49 +02:00
parent 90cde23c19
commit 92fa3189ab
5 changed files with 22 additions and 0 deletions

View File

@@ -136,6 +136,10 @@ CPPFLAGS+= -DUSE_COVERAGE
CPPFLAGS+= -DUSE_LIVEUPDATE
.endif
.if ${USE_SYSDEBUG} != "no"
CPPFLAGS+= -DUSE_SYSDEBUG
.endif
CPPFLAGS.sched_start.c+= -I${MINIXSRCDIR}
.if (${CC} == "gcc") || (${CC} == "clang")

View File

@@ -34,6 +34,7 @@ typedef unsigned int reg_t;
void util_nstrcat(char *str, unsigned long number)
{
#if USE_SYSDEBUG
int n = 10, lead = 1;
char nbuf[12], *p;
p = nbuf;
@@ -51,16 +52,21 @@ void util_nstrcat(char *str, unsigned long number)
*p++ = ' ';
*p++ = '\0';
strcat(str, nbuf);
#endif /* USE_SYSDEBUG */
}
void util_stacktrace(void)
{
#if USE_SYSDEBUG
FUNC_STACKTRACE(printf("0x%lx ", (unsigned long) pc));
printf("\n");
#endif /* USE_SYSDEBUG */
}
void util_stacktrace_strcat(char *str)
{
#if USE_SYSDEBUG
FUNC_STACKTRACE(util_nstrcat(str, pc));
#endif /* USE_SYSDEBUG */
}