From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122270 invoked by alias); 4 Aug 2015 18:54:55 -0000 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 Received: (qmail 122251 invoked by uid 89); 4 Aug 2015 18:54:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 04 Aug 2015 18:54:54 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 580F9367282; Tue, 4 Aug 2015 18:54:53 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t74IspIs008341; Tue, 4 Aug 2015 14:54:52 -0400 Message-ID: <55C10A7B.3050405@redhat.com> Date: Tue, 04 Aug 2015 18:54:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Joel Brobecker , gdb-patches@sourceware.org Subject: Re: sig != GDB_SIGNAL_0 failed assertion stepping program on GNU/Linux References: <20150804180745.GA13984@adacore.com> In-Reply-To: <20150804180745.GA13984@adacore.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-08/txt/msg00099.txt.bz2 On 08/04/2015 07:07 PM, Joel Brobecker wrote: > > Back to our program. At this point, we attempt a "next" (from thread 1), > and here is what happens: If the "next" is for thread 1, > That's when we get an event from a different thread (thread 3): > > infrun: target_wait (-1.0.0, status) = > infrun: 28370.28378.0 [Thread 0xb7c5aba0 (LWP 28378)], > infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP > infrun: TARGET_WAITKIND_STOPPED > infrun: stop_pc = 0x80782d0 > infrun: context switch > infrun: Switching context from Thread 0xb7ea18c0 (LWP 28370) to Thread 0xb7c5aba0 (LWP 28378) > > ... which we find to be at the address where we set a breakpoint > on "the unwinder debug hook" (namely "_Unwind_DebugHook"). That's > why GDB reports for this event that this is... > > infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME Why are we getting this? longjmp/exception/step-resume breakpoints are thread-specific. I'd guess that the bug is in bpstat_what: struct bpstat_what bpstat_what (bpstat bs_head) { ... case bp_longjmp: case bp_longjmp_call_dummy: case bp_exception: this_action = BPSTAT_WHAT_SET_LONGJMP_RESUME; retval.is_longjmp = bptype != bp_exception; break; ... This bit is not considering "if (bs->stop)" like e.g., the bp_step_resume case. I've seen something like this trigger before, and have a patch somewhere to rewrite bpstat_what differently which fixes that. I never managed to write a testcase for it so never submitted it. But, could you try the simpler approach? Try making that: if (bs->stop) { this_action = BPSTAT_WHAT_SET_LONGJMP_RESUME; retval.is_longjmp = bptype != bp_exception; } else this_action = BPSTAT_WHAT_SINGLE; break; Thanks, Pedro Alves