From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20828 invoked by alias); 27 Oct 2009 22:16:27 -0000 Received: (qmail 20819 invoked by uid 22791); 27 Oct 2009 22:16:27 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Oct 2009 22:16:23 +0000 Received: from wpaz33.hot.corp.google.com (wpaz33.hot.corp.google.com [172.24.198.97]) by smtp-out.google.com with ESMTP id n9RMGKP1027320 for ; Tue, 27 Oct 2009 22:16:20 GMT Received: from ppluzhnikov.mtv.corp.google.com (ppluzhnikov.mtv.corp.google.com [172.18.118.92]) by wpaz33.hot.corp.google.com with ESMTP id n9RMGE1G026555; Tue, 27 Oct 2009 15:16:14 -0700 Received: by ppluzhnikov.mtv.corp.google.com (Postfix, from userid 74925) id 3050076B2D; Tue, 27 Oct 2009 15:16:14 -0700 (PDT) To: gdb-patches@sourceware.org Cc: ppluzhnikov@google.com Subject: [patch][ob] Fix possible crash in disable_thread_event_reporting Message-Id: <20091027221614.3050076B2D@ppluzhnikov.mtv.corp.google.com> Date: Tue, 27 Oct 2009 22:16:00 -0000 From: ppluzhnikov@google.com (Paul Pluzhnikov) 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: 2009-10/txt/msg00666.txt.bz2 Greetings, Apparently we don't have many systems which don't have td_ta_set_event. AFAICT, this has been broken since rev. 1.1 Still, it's a trivial patch, and we might as well handle this correctly. I also deleted remove_thread_event_breakpoints() call, since the caller already does it on it's own. Thanks, -- Paul Pluzhnikov 2009-10-27 Paul Pluzhnikov * linux-thread-db.c (disable_thread_event_reporting): Adjust. Index: linux-thread-db.c =================================================================== RCS file: /cvs/src/src/gdb/linux-thread-db.c,v retrieving revision 1.66 diff -u -p -u -r1.66 linux-thread-db.c --- linux-thread-db.c 27 Oct 2009 21:32:49 -0000 1.66 +++ linux-thread-db.c 27 Oct 2009 22:14:40 -0000 @@ -905,20 +905,18 @@ thread_db_load (void) } static void -disable_thread_event_reporting (void) +disable_thread_event_reporting (struct thread_db_info *info) { - td_thr_events_t events; - struct thread_db_info *info; - - info = get_thread_db_info (GET_PID (inferior_ptid)); + if (info->td_ta_set_event_p != NULL) + { + td_thr_events_t events; - /* Set the process wide mask saying we aren't interested in any - events anymore. */ - td_event_emptyset (&events); - info->td_ta_set_event_p (info->thread_agent, &events); + /* Set the process wide mask saying we aren't interested in any + events anymore. */ + td_event_emptyset (&events); + info->td_ta_set_event_p (info->thread_agent, &events); + } - /* Delete thread event breakpoints, if any. */ - remove_thread_event_breakpoints (); info->td_create_bp_addr = 0; info->td_death_bp_addr = 0; } @@ -1088,7 +1086,7 @@ thread_db_detach (struct target_ops *ops if (info) { - disable_thread_event_reporting (); + disable_thread_event_reporting (info); /* Delete the old thread event breakpoints. Note that unlike when mourning, we can remove them here because there's still