Commit f9392d7a authored by Andreas Tille's avatar Andreas Tille
Browse files

Try to find the problem that causes coredump

parent d9cb7de5
Loading
Loading
Loading
Loading
+165 −0
Original line number Diff line number Diff line
Author: Andreas Tille <tille@debian.org>
Last-Update: Fri, 28 Sep 2018 14:24:07 +0200
Bug-Debian: https://bugs.debian.org/909530
Description: Try to find the problem that causes coredump

--- a/t_coffee_source/util_lib/util_constraints_list.c
+++ b/t_coffee_source/util_lib/util_constraints_list.c
@@ -1335,6 +1335,7 @@ Constraint_list *  undump_constraint_lis
 	int *entry, b, c, e, tot;
 	FILE *fp;
 
+fprintf (stderr, "\nDEBUG %s(%i):  file = %s", __FILE__, __LINE__, file);
 	if (!CL || !CL->residue_index)return CL;
 	entry=(int*)vcalloc ( CL->entry_len+1, sizeof (int));
 	fp=vfopen (file, "r");
@@ -2147,25 +2148,29 @@ Constraint_list* fork_read_n_constraint_
 		int pid;
 		ns++;
 		pid=vvfork (NULL);
+fprintf (stderr, "\nDEBUG %s(%i):  ns = %i, pid = %i, a = %i, n_list = %i", __FILE__, __LINE__, ns, pid, a, n_list);
 		if ( pid==0)
 		{
 			int in;
 			initiate_vtmpnam (NULL);
 			CL->local_stderr=vfopen("/dev/null", "w");
 			in=CL->ne;
+fprintf (stderr, "\nDEBUG %s(%i):  in = %i, fname[a] = %s, in_mode = %s, mem_mode = %s, weight_mode = %s", __FILE__, __LINE__, in, fname[a], in_mode, mem_mode, weight_mode);
 			CL=read_constraint_list (CL, fname[a], in_mode, mem_mode,weight_mode);
 			if (CL->ne>in)dump_constraint_list(CL,tmp_list[a], "w");
+fprintf (stderr, "\nDEBUG %s(%i): before exit  in = %i", __FILE__, __LINE__, in);
 			myexit (EXIT_SUCCESS);
 		}
 		else
 		{
 			//set_pid (pid);
-			fprintf ( local_stderr, "\n\t--- Process Method/Library/Aln %s", fname[a], ns);
+			fprintf ( local_stderr, "\n\t--- Process Method/Library/Aln %s (ns=%i)", fname[a], ns);
 			proclist[pid]=a;
 			if (ns>=nproc)
 			{
 				b=proclist[vwait(NULL)];
 				fprintf (local_stderr, "\n\txxx Retrieved %s",fname[a]);
+fprintf (stderr, "\nDEBUG %s(%i): ns = %i, nproc = %i, tmp_list_b_%i_ = %s", __FILE__, __LINE__, ns, nproc, b, tmp_list[b]);
 				if (tmp_list[b] && check_file_exists (tmp_list[b]))
 				{
 					CL=undump_constraint_list(CL,tmp_list[b]);
@@ -2178,14 +2183,18 @@ Constraint_list* fork_read_n_constraint_
 	while (ns)
 	{
 		int pid2;
+fprintf (stderr, "\nDEBUG %s(%i): before vwait(): pid2 = %i", __FILE__, __LINE__, pid2);
 		pid2=vwait(NULL);
+fprintf (stderr, "\nDEBUG %s(%i): after vwait()", __FILE__, __LINE__);
 		a=proclist[pid2];
 		fprintf (local_stderr, "\n\txxx Retrieved %s",fname[a]);
+fprintf (stderr, "\nDEBUG %s(%i): n_list = %i, nproc = %i, tmp_list_a_%i_ = %s", __FILE__, __LINE__, ns, n_list, a, tmp_list[a]);
 		if (tmp_list[a] && check_file_exists (tmp_list[a]))
 		{
 			CL=undump_constraint_list (CL,tmp_list[a]);
 		}
 		ns--;
+fprintf (stderr, "\nDEBUG %s(%i):  ns = %i", __FILE__, __LINE__, ns);
 	}
 	fprintf ( local_stderr, "\n\n\tAll Methods Retrieved\n");
 
@@ -2216,11 +2225,20 @@ Constraint_list* read_constraint_list(Co
 	Sequence *SL=NULL, *TS=NULL;
 	int a;
 	Constraint_list *SUBCL=NULL;
-	static char *read_mode;
+	/*static char *read_mode;*/
+	static char read_mode[STRING];
 	char *fname;
 
+fprintf (stderr, "\nDEBUG %s(%i):  in_fname = %s, in_mode = %s, mem_mode = %s, weight_mode = %s", __FILE__, __LINE__, in_fname, in_mode, mem_mode, weight_mode);
 	fname=in_fname;
-	if ( !read_mode)read_mode=(char*)vcalloc ( STRING, sizeof (char));
+	/*if ( !read_mode)read_mode=(char*)vcalloc ( STRING, sizeof (char));*/
+
+if (read_mode)
+fprintf (stderr, "\nDEBUG %s(%i):  read_mode = %s, STRING = %i", __FILE__, __LINE__, read_mode, STRING);
+else
+fprintf (stderr, "\nDEBUG %s(%i):  STRING = %s, fname = %s", __FILE__, __LINE__, STRING, fname);
+sprintf ( read_mode, "structure");
+fprintf (stderr, "\nDEBUG %s(%i):  read_mode = %s, fname[0] = %c", __FILE__, __LINE__, STRING, fname[0]);
 
 	if ( is_lib_list (in_fname))sprintf ( read_mode, "lib_list");
 	else if ( in_mode)sprintf (read_mode, "%s", in_mode);
--- a/t_coffee_source/util_lib/util.c
+++ b/t_coffee_source/util_lib/util.c
@@ -4348,7 +4348,9 @@ pid_t vwait (pid_t *p)
 
 
   p2=wait(&rv); 
+fprintf (stderr, "\nDEBUG %s(%i): before check_process() p2 = %i", __FILE__, __LINE__, p2);
   if (p2!=-1)rv=check_process("forked::T-Coffee", p2, rv,handle_failure);
+fprintf (stderr, "\nDEBUG %s(%i): after check_process() p2 = %i", __FILE__, __LINE__, p2);
   if ( p) p[0]=rv;
 
   return p2;
@@ -4957,7 +4959,9 @@ int  set_unique_dir_4_tcoffee (char *dir
 void myexit (int signal)
 {
 
+fprintf (stderr, "\nDEBUG %s(%i): in myexit() signal = %i", __FILE__, __LINE__, signal);
   if (clean_exit_started==1)return; //protects processes while they are doing a clean exit
+fprintf (stderr, "\nDEBUG %s(%i): in myexit() signal = %i", __FILE__, __LINE__, signal);
   global_exit_signal=signal;
   exit (global_exit_signal); //ONLY BARE EXIT!!!!!!!!!!!!!!
 }
@@ -5589,6 +5593,7 @@ void dump_tcoffee(char *target, char *na
   char *out_list;
 
   
+fprintf (stderr, "\nDEBUG %s(%i): dump_tcoffee() target = %s, nature = %s, pid = %i, ppid = %i", __FILE__, __LINE__, target, nature, getpid(), getppid());
 
   if ((fp=fopen (target, "w")))
     {
@@ -5663,6 +5668,8 @@ void dump_error_file()
   FILE *fp;
 
 
+fprintf (stderr, "\nDEBUG %s(%i): dump_error_file() pid = %i, ppid = %i", __FILE__, __LINE__, getpid(), getppid());
+
   sprintf ( target, "%s",getenv("ERRORFILE_4_TCOFFEE"));
   if (strstr (target, "NO"));
   else
@@ -8962,6 +8969,9 @@ void clean_exit ()
   Tmpname *start;
   int debug;
 
+fprintf (stderr, "\nDEBUG %s(%i): clean_exit() pid = %i, ppid = %i", __FILE__, __LINE__, getpid(), getppid());
+/* https://stackoverflow.com/questions/26256996/who-called-atexit */
+/* abort(); */
   clean_exit_started=1;//prevent new locks
   start=tmpname;
   //1-start killing all the children
@@ -8979,6 +8989,7 @@ void clean_exit ()
 
   if (is_rootpid())
     {
+fprintf (stderr, "\nDEBUG %s(%i): clean_exit() / is_rootpid()=true: pid = %i, ppid = %i", __FILE__, __LINE__, getpid(), getppid());
 
       kill_child_pid(getpid());
       if (has_error_lock())
@@ -8988,6 +8999,7 @@ void clean_exit ()
 	  warning_msg (stderr);
 	  e=lock (getpid(), LERROR, LREAD, NULL);
 
+fprintf (stderr, "\nDEBUG %s(%i): clean_exit() / has_error_lock()=true: e = '%s'\n", __FILE__, __LINE__, e);
 
 
 	  //explicit the most common error messages
--- a/t_coffee_source/t_coffee_lib/t_coffee.c
+++ b/t_coffee_source/t_coffee_lib/t_coffee.c
@@ -4762,7 +4762,9 @@ get_cl_param(\
 		     }
 		   else
 		     {
+fprintf (stderr, "\nDEBUG %s(%i): before read_n_constraint_list(): infile = %s", __FILE__, __LINE__, infile);
 		     CL=read_n_constraint_list (list_file,n_list,NULL, mem_mode,weight,type, le, CL, seq_source);
+fprintf (stderr, "\nDEBUG %s(%i): after read_n_constraint_list(): infile = %s", __FILE__, __LINE__, infile);
 		     }
 		 }
 	       if ( CL->M)clean_aln=0;
+1 −0
Original line number Diff line number Diff line
@@ -7,3 +7,4 @@ mayhem.patch
stable-linking-inputs.patch
clustalw2.patch
gcc-7.patch
# debug.patch