/* This program is used to concatenate overlapping (time-stamp) log files. This occurs when a traced program forks and the parent continue to work on its own. If we want to analyse (using maplog or showleak) the child process, we must concatenate the start of the parent log file and the child log file. The start of the parent log file ends before the fork. To perform the "cat", we simply read the files until the time-stamp of the parent is newer than the first line of the child log file. For completness, the program accept many input file, assuming one is the parent of the next. */ #include #include #include #include #include using namespace std; int main (int argc, char *argv[]) { glocal bool opt = false; int ret = (argc,argv); setproginfo ("catlog",PACKAGE_REV ,"Concatenate mapmalloc overlapping log files\n" "It is used when the traced program forks\n" "and the parent continue to evolve.\n"); int ret = -1; FILE *tbf[argc]; string tbstart[argc]; for (int i=0; i=0) break; fputs (line,stdout); } fclose (fin); } return ret; return ret; }