From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 852083858006; Mon, 13 Sep 2021 10:32:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 852083858006 From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug gdb/27891] maintenance selftest fail when an executable is loaded Date: Mon, 13 Sep 2021 10:32:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 10:32:12 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D27891 Tom de Vries changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |alahay01 at gcc dot gnu.or= g, | |luis.machado at linaro dot= org, | |vries at gcc dot gnu.org --- Comment #1 from Tom de Vries --- (In reply to Andrew Burgess from comment #0) > Self test failed: arch armv8.1-m.main: self-test failed at > ../../src/gdb/disasm-selftests.c:165 The first error I run into is this one, and I've debugged it. 1. With exec. In gdb_print_insn_arm, we run into this and set info->flags |=3D USER_SPECIFIED_MACHINE_TYPE: ... /* GDB is able to get bfd_mach from the exe_bfd, info->mach is=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 accurate, so mark USER_SPECIFIED_MACHINE_TYPE bit. Otherwise,=20=20= =20=20=20=20=20=20=20=20=20=20=20 opcodes/arm-dis.c:print_insn reset info->mach, and it will trigger=20= =20=20=20=20=20=20=20=20 the assert on the mismatch of info->mach and=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 bfd_get_mach (current_program_space->exec_bfd ()) in=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 default_print_insn. */ if (current_program_space->exec_bfd () !=3D NULL) info->flags |=3D USER_SPECIFIED_MACHINE_TYPE; ... and consequently we don't do this in print_insn: ... if ((info->flags & USER_SPECIFIED_MACHINE_TYPE) =3D=3D 0) info->mach =3D bfd_mach_arm_unknown; ... so we end up doing this in select_arm_features: ... case bfd_mach_arm_8_1M_MAIN: ARM_SET_FEATURES (ARM_ARCH_V8_1M_MAIN); arm_feature_set mve_all =3D ARM_FEATURE_CORE_HIGH (ARM_EXT2_MVE | ARM_EXT2_MVE_FP); ARM_MERGE_FEATURE_SETS (arch_fset, arch_fset, mve_all); force_thumb =3D 1; break; ... With force_thumb set, we disassemble only two bytes, and the selftest fails. 2. Without exec. - in gdb_print_insn_arm, we don't set info->flags |=3D USER_SPECIFIED_MACHINE_TYPE. - in print_insn, we do bfd_mach_arm_unknown - in select_arm_features, we don't set force_thumb Without force_thumb set, we disassemble four bytes, and the selftest passes. --=20 You are receiving this mail because: You are on the CC list for the bug.=