Fixup the dwfl_end () cleanup.
authorlace <>
Wed, 16 May 2007 17:17:32 +0000 (17:17 +0000)
committerlace <>
Wed, 16 May 2007 17:17:32 +0000 (17:17 +0000)
Makefile
debugger.c
threadtest.c

index 8065c65..09d6610 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,8 @@ testsuite: testsuite.c debugger.c debugger.h
 
 threadtest: threadtest.c
        $(CC) -o $@ $< $(LIBS)
+       ./$@ single
+       ./$@ multi 
 
 .PHONY: check
 check: testsuite
@@ -30,5 +32,5 @@ still:
 
 .PHONY: clean
 clean:
-       $(RM) debugger testsuite
+       $(RM) debugger testsuite threadtest
 
index add07f9..ec5b60c 100644 (file)
@@ -335,8 +335,6 @@ static Dwfl *get_dwfl (struct ps_prochandle *proc_handle)
         || dwfl_report_end (proc_handle->dwfl, NULL, NULL) != 0)
        {
          fprintf (stderr, "dwfl reporting: %m\n");
-         dwfl_end (proc_handle->dwfl);
-         proc_handle->dwfl = NULL;
          abort ();
        }
     }
index 63ea31c..971e940 100644 (file)
@@ -300,14 +300,16 @@ static void attach (pid_t pid)
   err = td_ta_new (&proc_handle_local, &thread_agent);
   assert (err == TD_OK || err == TD_NOLIBTHREAD);
   if (err == TD_NOLIBTHREAD)
+    puts ("singlethreaded");
+  else
     {
-      puts ("singlethreaded");
-      return;
+      puts ("multithreaded");
+      thread_test (thread_agent);
+      err = td_ta_delete (thread_agent);
+      assert (err == TD_OK);
     }
-  puts ("multithreaded");
-  thread_test (thread_agent);
-  err = td_ta_delete (thread_agent);
-  assert (err == TD_OK);
+  if (proc_handle_local.dwfl != NULL);
+    dwfl_end (proc_handle_local.dwfl);
 }
 
 static void *start (void *arg)