From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id WAmXEWA6HWCJHgAAWB0awg (envelope-from ) for ; Fri, 05 Feb 2021 07:30:24 -0500 Received: by simark.ca (Postfix, from userid 112) id 460601EFCB; Fri, 5 Feb 2021 07:30:24 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI,RDNS_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id EC1541E590 for ; Fri, 5 Feb 2021 07:30:23 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A135D397141B; Fri, 5 Feb 2021 12:30:23 +0000 (GMT) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 86C30397141B for ; Fri, 5 Feb 2021 12:30:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 86C30397141B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A1871AD24 for ; Fri, 5 Feb 2021 12:30:20 +0000 (UTC) Date: Fri, 5 Feb 2021 13:30:18 +0100 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH][gdb/breakpoints] Handle glibc with debuginfo in create_exception_master_breakpoint Message-ID: <20210205123017.GA19341@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Hi, The test-case nextoverthrow.exp is failing on targets with unstripped libc. This is a regression since commit 1940319c0ef "[gdb] Fix internal-error in process_event_stop_test". The problem is that this code in create_exception_master_breakpoint: ... for (objfile *sepdebug = obj->separate_debug_objfile; sepdebug != nullptr; sepdebug = sepdebug->separate_debug_objfile) if (create_exception_master_breakpoint_hook (sepdebug)) ... iterates over all the separate debug object files, but fails to handle the case that obj itself has the debug info we're looking for. Fix this by using the separate_debug_objfiles () range instead, which does iterate both over obj and the obj->separate_debug_objfile chain. Tested on x86_64-linux. Also needs to be backported to gdb-10-branch. Any comments? Thanks, - Tom [gdb/breakpoints] Handle glibc with debuginfo in create_exception_master_breakpoint gdb/ChangeLog: 2021-02-05 Tom de Vries PR breakpoints/27330 * breakpoint.c (create_exception_master_breakpoint): Handle case that glibc object file has debug info. --- gdb/breakpoint.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index f318a125319..c20c0d7d649 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -3625,11 +3625,10 @@ create_exception_master_breakpoint (void) if (create_exception_master_breakpoint_probe (obj)) continue; - /* Iterate over separate debug objects and try an _Unwind_DebugHook - kind breakpoint. */ - for (objfile *sepdebug = obj->separate_debug_objfile; - sepdebug != nullptr; sepdebug = sepdebug->separate_debug_objfile) - if (create_exception_master_breakpoint_hook (sepdebug)) + /* Iterate over main and separate debug objects and try an + _Unwind_DebugHook kind breakpoint. */ + for (objfile *debug_objfile : obj->separate_debug_objfiles ()) + if (create_exception_master_breakpoint_hook (debug_objfile)) break; } }