From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8092 invoked by alias); 24 Jun 2011 22:21:44 -0000 Received: (qmail 8083 invoked by uid 22791); 24 Jun 2011 22:21:43 -0000 X-SWARE-Spam-Status: No, hits=1.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-ew0-f41.google.com (HELO mail-ew0-f41.google.com) (209.85.215.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 24 Jun 2011 22:21:27 +0000 Received: by ewy9 with SMTP id 9so1167658ewy.0 for ; Fri, 24 Jun 2011 15:21:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.14.95.200 with SMTP id p48mr2397039eef.51.1308954086710; Fri, 24 Jun 2011 15:21:26 -0700 (PDT) Received: by 10.14.29.11 with HTTP; Fri, 24 Jun 2011 15:21:26 -0700 (PDT) Date: Fri, 24 Jun 2011 22:21:00 -0000 Message-ID: Subject: [patch] failed to attach to the same process after detaching in gdbserver multiprocess mode From: Liang Cheng To: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-06/txt/msg00380.txt.bz2 Reproduce step: 1. compile and link the test app (which contains an infinite loop) 2. run the app 3. start gdbserver in multiprocess mode (e.g. gdbserver --multi :5040) 3. attach the running process in gdb (e.g. target extended-remote :5040; attach pid) 4. continue to run the app in gdb, pressing "c" 5. stop the execution of the app by pressing ctrl-c in gdb 4. detach 5. quit 7. attach the same process in gdb (e.g. target extended-remote :5040; attach pid) User would get something like below error in gdb (gdb) attach 19372 Ignoring packet error, continuing... Attached to process 19372 Ignoring packet error, continuing... Ignoring packet error, continuing... Ignoring packet error, continuing... warning: Invalid remote reply: timeout This issue does not happen in gdb-7.1.0.20100706.tar, but it happens sometime after wards. The fix would reset cont_thread at detach. Is the below patch OK? If it is, can anyone help to submit it as I don't have account with write-access to the cvs? Thanks, Liang licheng@licheng-linux:~/gdb-7.3/gdb-7.3.50.20110622/gdb/gdbserver$ diff -Naur linux-low.c.orig linux-low.c --- linux-low.c.orig 2011-05-04 15:20:12.000000000 -0500 +++ linux-low.c 2011-06-23 15:05:26.633193953 -0500 @@ -837,6 +837,9 @@ /* Since we presently can only stop all lwps of all processes, we need to unstop lwps of other processes. */ unstop_all_lwps (0, NULL); + + /* reset cont_thread */ + cont_thread = null_ptid; return 0; }