From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 6780D3857BAD for ; Tue, 5 Jul 2022 20:42:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6780D3857BAD Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 7079B20590; Tue, 5 Jul 2022 20:42:06 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5C45E1339A; Tue, 5 Jul 2022 20:42:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cgEpFR6ixGLmCgAAMHmgww (envelope-from ); Tue, 05 Jul 2022 20:42:06 +0000 Message-ID: <1dce1ba8-6f29-1ddc-ca83-720722a7c3ca@suse.de> Date: Tue, 5 Jul 2022 22:42:06 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH][gdb/exp] Fix internal error when printing C++ pointer-to-member Content-Language: en-US To: Tom Tromey , Tom de Vries via Gdb-patches References: <20220630145930.GA20127@delia.home> <87fsjfv1l4.fsf@tromey.com> From: Tom de Vries In-Reply-To: <87fsjfv1l4.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jul 2022 20:42:08 -0000 On 7/5/22 20:47, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries via Gdb-patches writes: > > Tom> (gdb) print ptm^M > Tom> $1 = gdb/gdbtypes.h:695: internal-error: loc_bitpos: \ > Tom> Assertion `m_loc_kind == FIELD_LOC_KIND_BITPOS' failed.^M > Tom> ... > Tom> while printing a c++ pointer-to-member. > > Is this crashing due to the static field? > Yes. > Tom> Fix this by skipping fields with m_loc_kind != FIELD_LOC_KIND_BITPOS in > Tom> cp_find_class_member, such that we have: > Tom> ... > Tom> (gdb) print ptm^M > Tom> $1 = &A::i^M > Tom> ... > > If so then I think it's better to skip when the field is static, not > based on the loc_kind. Ack, committed using field_is_static instead. Thanks, - Tom