From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13080 invoked by alias); 17 Jan 2006 15:35:02 -0000 Received: (qmail 13010 invoked by uid 22791); 17 Jan 2006 15:35:00 -0000 X-Spam-Check-By: sourceware.org Received: from svr68.ehostpros.com (HELO svr68.ehostpros.com) (67.15.48.48) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 17 Jan 2006 15:34:58 +0000 Received: from [59.95.58.2] (helo=titan.linsyssoft.com) by svr68.ehostpros.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.52) id 1EysrD-0002vo-SG for gdb-patches@sources.redhat.com; Tue, 17 Jan 2006 07:34:52 -0800 Received: from krypton (krypton [192.168.1.13] (may be forged)) by titan.linsyssoft.com (8.13.1/8.13.1) with ESMTP id k0HFLSJT018720; Tue, 17 Jan 2006 20:51:28 +0530 Subject: [Patch] Mark the thread_event breakpoint as "not inserted" before calling thread_mourn_inferior From: Girish Shilamkar To: gdb-patches@sources.redhat.com Cc: girish@linsyssoft.com Content-Type: multipart/mixed; boundary="=-39vipNpf1gnY+ha/iDp8" Date: Tue, 17 Jan 2006 15:35:00 -0000 Message-Id: <1137512294.3217.29.camel@krypton> Mime-Version: 1.0 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-01/txt/msg00216.txt.bz2 --=-39vipNpf1gnY+ha/iDp8 Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 1662 Hi, While running gdb-6.4 on Fedora Core 3 for multithread application we encountered following problem: ----------------------------------------------------------------------- GNU gdb 6.4 Copyright 2005 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1". (gdb) r Starting program: /home/girish/gdbl/build-6.4/multithread [Thread debugging using libthread_db enabled] [New Thread -151132480 (LWP 10793)] Thread 0 [New Thread -151135312 (LWP 10796)] Thread 1 Starting thread 1 [New Thread -161625168 (LWP 10797)] Starting thread 0 Finishing thread [Thread -151135312 (LWP 10796) exited] Finishing thread [Thread -161625168 (LWP 10797) exited] Program exited normally. Couldn't get registers: No such process. (gdb) q The program is running. Exit anyway? (y or n) y ------------------------------------------------------------ This problem was also seen on powerpc board. This problem occurs since gdb tries to remove thread_event breakpoint after the thread has exited and tries to read the address space since the breakpoint is still marked as updated. In the attached patch we mark the thread_event breakpoint as "not inserted" before calling thread_mourn_inferior. Is this the right way? If yes do we also need to do the same thing when target has been terminated by a signal? -Girish --=-39vipNpf1gnY+ha/iDp8 Content-Disposition: attachment; filename=mark_bpt_clean.patch Content-Type: text/x-patch; name=mark_bpt_clean.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 1566 Index: gdb-6.4/gdb/infrun.c =================================================================== --- gdb-6.4.orig/gdb/infrun.c 2005-11-14 21:05:16.000000000 +0530 +++ gdb-6.4/gdb/infrun.c 2006-01-17 20:57:44.431069776 +0530 @@ -1367,6 +1367,7 @@ value_from_longest (builtin_type_int, (LONGEST) ecs->ws.value.integer)); gdb_flush (gdb_stdout); + mark_thrd_event_bpt_clean(); target_mourn_inferior (); singlestep_breakpoints_inserted_p = 0; /*SOFTWARE_SINGLE_STEP_P() */ stop_print_frame = 0; Index: gdb-6.4/gdb/breakpoint.c =================================================================== --- gdb-6.4.orig/gdb/breakpoint.c 2005-05-29 08:43:17.000000000 +0530 +++ gdb-6.4/gdb/breakpoint.c 2006-01-17 21:00:00.899323448 +0530 @@ -4289,6 +4289,17 @@ delete_breakpoint (b); } +void +mark_thrd_event_bpt_clean (void) +{ + + struct breakpoint *b, *temp; + + ALL_BREAKPOINTS_SAFE (b, temp) + if (b->type == bp_thread_event) + b->loc->inserted = 0; +} + struct captured_parse_breakpoint_args { char **arg_p; Index: gdb-6.4/gdb/breakpoint.h =================================================================== --- gdb-6.4.orig/gdb/breakpoint.h 2005-05-27 02:18:57.000000000 +0530 +++ gdb-6.4/gdb/breakpoint.h 2006-01-17 21:01:07.244237488 +0530 @@ -763,6 +763,8 @@ extern void remove_thread_event_breakpoints (void); +extern void mark_thrd_event_bpt_clean (void); + extern void disable_breakpoints_in_shlibs (int silent); extern void re_enable_breakpoints_in_shlibs (void); --=-39vipNpf1gnY+ha/iDp8--