From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5701 invoked by alias); 28 Mar 2011 20:45:06 -0000 Received: (qmail 5686 invoked by uid 22791); 28 Mar 2011 20:45:04 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-yx0-f169.google.com (HELO mail-yx0-f169.google.com) (209.85.213.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 28 Mar 2011 20:44:59 +0000 Received: by yxt33 with SMTP id 33so1664879yxt.0 for ; Mon, 28 Mar 2011 13:44:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.43.49.67 with SMTP id uz3mr6645825icb.526.1301345098376; Mon, 28 Mar 2011 13:44:58 -0700 (PDT) Received: by 10.43.133.2 with HTTP; Mon, 28 Mar 2011 13:44:58 -0700 (PDT) Date: Mon, 28 Mar 2011 20:45:00 -0000 Message-ID: Subject: How to switch threads in gdb while a thread is being blocked From: Alexandru Sutii To: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00171.txt.bz2 Hello! I am developing a GUI application that uses gdb. The purpose of the application is to give the user the chance to graphically see what happens when processes communicate using IPC, or when a process blocks when taking a mutex, and so on. I have a problem with processes that block waiting for another process to take an action. For instance, say I have the following situation: A process P creates a child process C. The child and the parent communicate through a pipe. After fork() the parent waits for the child to write something in the pipe. If debugging this in gdb the parent blocks when waiting for the child to write in the pipe. As a result gdb freezes and I cannot switch to the child process in order to make it write in the pipe, so the parent could continue. I mention that I set detach-on-fork off. Is there a way to switch threads in gdb after the current thread/process blocks? I have also thought of setting detach-on-fork on and try to attache to the newly created process with another gdb instance, but I didn't manage to accomplish this. Any advices are welcome. Thanks in advance. --Alex.