Debugging a threads executable under Redhat Linux

From: Bob Carragher (dancebob_at_mindspring.com)
Date: Fri May 24 2002 - 05:36:14 BST

  • Next message: callum.gibson_at_db.com: "Re: Debugging a threads executable under Redhat Linux"
    Hello,
    
    I believe I have finally found a working solution for using UPS to
    debug a program that uses threads (pthread.h) under Linux.  (I'll
    fully describe the setup below.)  The solution is based on what
    was suggested previously for following a forked child process.
    Under Linux, each thread is given its own process, with a process
    ID.  Since my program is command-driven, I simply started it up so
    that it would wait at the command prompt, and then attached the
    debugger to the appropriate process.
    
    There were 3 processes that were generated, although that is
    probably due to the fact that my program generates 2 threads from
    the main thread.  In trying to attach to 2 of these 3 threads,
    the debugger would display the message,
    
         Wait returned -1: Success
    
    and become munged.  Attaching to the lowest-numbered process is
    what seems to work.
    
    I hope this helps anyone else out there who might be experiencing
    this problem!
    
    				Bob Carragher
    
    P.S.  For those interested, I am running Redhat Linux 6.2, which
    uses kernel 2.2.14.  My compiler is g++ (version 2.95.3).  I have
    been trying this with every version of UPS since 3.34, but I
    applied the workaround using 3.37-beta5.  My hardware is a Dell
    Inspiron 3800 laptop, which uses a 600 MHz Pentium III.
    


    This archive was generated by hypermail 2.1.4 : Mon May 27 2002 - 11:55:23 BST