Skip to content

Commit

Permalink
add DEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
segzix committed Dec 4, 2024
1 parent c6a2ff9 commit 25ae566
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/lib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ FC = gfortran # gfortran is more common
# define dirs
SRCDIR = ../../src
INCLUDEDIR = $(SRCDIR)/include
CFLAGS += -I./${INCLUDEDIR} $(ARCH_FLAGS) -DDOSTAT -g
CFLAGS += -I./${INCLUDEDIR} $(ARCH_FLAGS) -DDOSTAT -DDEBUG -g -fdebug-prefix-map=${PWD}=.

# define files
SRCS := $(wildcard $(SRCDIR)/*/*.c)
Expand Down
7 changes: 7 additions & 0 deletions src/init/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,19 @@ void redirect_slave_io(int argc, char **argv) {
sprintf(outfile, "%s.log\0", argv[0]);
#endif /* NFS */
freopen(outfile, "w", stdout); // redirect stdout to file outfile
#ifdef DEBUG
setbuf(stdout, NULL);
#endif

#ifdef NFS
sprintf(outfile, "%s-%d.err\0", argv[0], system_setting.jia_pid);
#else
sprintf(outfile, "%s.err\0", argv[0]);
#endif /* NFS */
freopen(outfile, "w", stderr); // redirect stderr to file outfile
#ifdef DEBUG
setbuf(stderr, NULL);
#endif
}
}

Expand Down Expand Up @@ -355,7 +359,10 @@ void jia_init(int argc, char **argv) {
&rl); /* set maximum size of process's data segment */

redirect_slave_io(argc, argv); /*redirect slave's output*/

#ifdef DEBUG
setbuf(logfile, NULL);
#endif

initmem();
initsyn();
Expand Down

0 comments on commit 25ae566

Please sign in to comment.