From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 5YU+AaIfqmaLZDcAWB0awg (envelope-from ) for ; Wed, 31 Jul 2024 07:27:30 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=y0d4Xd9B; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=j/baLan+; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=sS69yOk0; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=I3D0W5mo; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id EBFF61E0D0; Wed, 31 Jul 2024 07:27:29 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id D8C6D1E097 for ; Wed, 31 Jul 2024 07:27:27 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5D32C3858410 for ; Wed, 31 Jul 2024 11:27:27 +0000 (GMT) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id 65B253858C56 for ; Wed, 31 Jul 2024 11:27:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 65B253858C56 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 65B253858C56 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722425231; cv=none; b=drMz4tmWC0fq34Nm+dv02UfHaPrOpDH+E836EZbmwUPs9QGux4RJeVN+8KSPPJYXNPkbYBagbPE2MwZ27G6DmIFRmurEtNxl+WRCy5d5ULcWmTAQ9bI5BPCw+LaSboE5kTArgxVAxK7aJ4Tt46XlFZ2Gcdja1Ihh5oKtvJ1OZ5s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722425231; c=relaxed/simple; bh=n6kMe/3E8dVJO6H4RoZ2E99ek+SvcJD+jzpvicRMhNA=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:From:To; b=Hi5E+S94Rhk9m8ovJHRQBJoFw5KB8+71/VlRM6qotyy4RWZJS77CPqMzjO/yr3jfgIF/zBTgqjUn6yXs8IMl35rah8Q/XjkXe10vFcQOxR7MWrIfwxwtRngVU9DgKqBNnw0r5Z95pjqjsQv7dpNx5zkp8GLw7mkpuSPKKYbyHdU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 84B731F836 for ; Wed, 31 Jul 2024 11:27:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1722425222; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=14tzY1miwGyc6DRkNdup7EKGEfkSf1WEb34kFKN8SMU=; b=y0d4Xd9BJdWplXpESPuUD5WDQgg3oCKAMDWNRa3sRVW/24hWsMbwLBDLryFbYyFwxiR5TN /8o18hWuA232eeE1oDUbOLkqFkLD4wpJp6pNZAp++lSbSPdASbicUiJacogbtoG5sMMWZX isHJp2BIq87SkB5JqfWvttAkFBTJNz4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1722425222; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=14tzY1miwGyc6DRkNdup7EKGEfkSf1WEb34kFKN8SMU=; b=j/baLan+QtCGUJwtXXZ5HSIZSeybdF0dWO8LdGPl4L8fURo2GcgZ8jkyCmB44PArpaI9d5 /nyXsPMEQXxBTsDg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1722425221; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=14tzY1miwGyc6DRkNdup7EKGEfkSf1WEb34kFKN8SMU=; b=sS69yOk0u9Kmsjh7AJav8qrkSDKlxPtfbLN1hhl5V1U17hFU6GPMzI9GRRRPURU185TelO w2xmyA32NkZxhTyiiOOrv63hkA2Zel3Y85fBGqCkCB5ESwHd/LQ95C6eQ4Z6o8ovsGubUg m6s99Bf4TNVeryrfK8WfFln3s2hvjYs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1722425221; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=14tzY1miwGyc6DRkNdup7EKGEfkSf1WEb34kFKN8SMU=; b=I3D0W5moLo5u/LaTk8dGN6NglmIRhG1uvkDL99wUqAiRxnESkMhCcURxzIMxGjWejDTzgK KiruvuQAsJ8+0eDA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 6FC0E1368F for ; Wed, 31 Jul 2024 11:27:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id MJWAGYUfqmY6PQAAD6G6ig (envelope-from ) for ; Wed, 31 Jul 2024 11:27:01 +0000 Message-ID: <5188e7e4-5d7b-4d9a-b81b-9393d7b2ff77@suse.de> Date: Wed, 31 Jul 2024 13:26:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PING][PATCH] [gdb/tdep] Use cached breakpoint kind in breakpoint_kind From: Tom de Vries To: gdb-patches@sourceware.org References: <20240607143821.29797-1-tdevries@suse.de> Content-Language: en-US In-Reply-To: <20240607143821.29797-1-tdevries@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [-4.09 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; XM_UA_NO_VERSION(0.01)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[sourceware.org:url] X-Spam-Level: X-Spam-Score: -4.09 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 6/7/24 16:38, Tom de Vries wrote: > With test-case gdb.base/solib-probes-nosharedlibrary.exp on arm-linux, I get: > ... > (gdb) continue^M > Continuing.^M > ^M > Program received signal SIGILL, Illegal instruction.^M > 0xf7fd267a in ?? ()^M > (gdb) FAIL: $exp: continue to breakpoint: main > ... > > This happens as follows: > - the starti command is called, > - gdb loads symbols for ld.so, > - the "shlib events" breakpoint is inserted at the address of _dl_debug_state, > - execution stops at ld.so _start, and the inserted breakpoint is removed, > - the nosharedlibrary command is called, > - gdb forgets about all shared library symbols, > - the continue command is called, > - gdb re-inserts the "shlib events" breakpoint, but the call to > breakpoint_kind returns the wrong value: ARM_BP_KIND_ARM instead of > ARM_BP_KIND_THUMB, so the wrong type of breakpoint is inserted, and > - when execution hits the breakpoint, the SIGILL triggers. > > In order to correctly set a breakpoint on an address for arm, gdb needs to > known whether that address is in thumb or arm code, and the problem is that > that information is no longer available due to the nosharedlibrary command. > > However, the breakpoint kind is is available from the previous time the > breakpoint was inserted. > > Fix this in breakpoint_kind, by using the info cached in bl->target_info.kind, > if available. > Ping. Thanks, - Tom > Tested on arm-linux. > > PR tdep/31817 > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31817 > --- > gdb/breakpoint.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c > index a973518ac5f..0c99ccc9568 100644 > --- a/gdb/breakpoint.c > +++ b/gdb/breakpoint.c > @@ -2792,7 +2792,11 @@ breakpoint_kind (const struct bp_location *bl, CORE_ADDR *addr) > regcache, addr); > } > else > - return gdbarch_breakpoint_kind_from_pc (bl->gdbarch, addr); > + { > + if (bl->target_info.kind != 0) > + return bl->target_info.kind; > + return gdbarch_breakpoint_kind_from_pc (bl->gdbarch, addr); > + } > } > > /* Rethrow the currently handled exception, if it's a TARGET_CLOSE_ERROR. > > base-commit: 3a659c2a30f40c2a734fda5566098804b5ee38fc