From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 4D4AB3858D1E for ; Sun, 25 Dec 2022 00:26:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4D4AB3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Received: by smtp.gentoo.org (Postfix, from userid 559) id B2B9C3408F9; Sun, 25 Dec 2022 00:26:20 +0000 (UTC) Date: Sat, 24 Dec 2022 19:26:18 -0500 From: Mike Frysinger To: Dragan Mladjenovic Cc: gdb-patches@sourceware.org, "Maciej W . Rozycki" , Chao-ying Fu , Faraz Shahbazker Subject: Re: [PATCH v5 4/4] sim: mips: Add simulator support for mips32r6/mips64r6 Message-ID: References: <20220202101725.23671-1-Dragan.Mladjenovic@syrmia.com> <20220202101725.23671-5-Dragan.Mladjenovic@syrmia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="wUFdHCzWXysqmIVe" Content-Disposition: inline In-Reply-To: <20220202101725.23671-5-Dragan.Mladjenovic@syrmia.com> X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,KAM_NUMSUBJECT,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --wUFdHCzWXysqmIVe Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 02 Feb 2022 11:17, Dragan Mladjenovic wrote: > --- a/sim/mips/configure.ac > +++ b/sim/mips/configure.ac > @@ -216,6 +227,7 @@ if test ${sim_gen} =3D MULTI; then > #include "sim-main.h" > #include "multi-include.h" > #include "elf-bfd.h" > +#include "elfxx-mips.h" > #include "elf/mips.h" > =20 > #define SD sd > @@ -235,7 +247,11 @@ sim_engine_run (SIM_DESC sd, > & EF_MIPS_ARCH_ASE_MICROMIPS) > mach =3D bfd_mach_mips_micromips; > else > - mach =3D STATE_ARCHITECTURE (SD)->mach; > + { > + mach =3D _bfd_elf_mips_mach (elf_elfheader (STATE_PROG_BFD (sd))->e= _flags); > + if (!mach) > + mach =3D STATE_ARCHITECTURE (SD)->mach; > + } why do you need this logic in the main engine run routine ? why isn't the STATE_ARCHITECTURE value already set to the correct value ? if it isn't set correctly all the time, this can lead to incorrect behavior elsewhere when code checks it. when the sim is opened, the bfd_mach is either explicitly passed in (which gdb does), or initialized with a call to the bfd library APIs. see the sim/common/sim-utils.c:sim_analyze_program code. -mike --wUFdHCzWXysqmIVe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmOnmKoACgkQQWM7n+g3 9YGF7hAAqU74Q7meLLYb+li3Mz9x/cWIXdM3m7o3l5CeuQgxydZ4+A7zvJd+Ck0T KXThVIO0X+p0RGKw2t2zOA2avPyivus+Qp1P3TgqF7regVdk635LUMuuvGKKJg5k KfP9v8ZEKfYndt7jamqvulJmECbqmGyXSEZSc19CmGmPXh/ZoGBeGQg+SwJIACxC UdAzERbkQ1bwRjpsPXAe5St2Am6MpQnDxppnw6cx9tg3de4s4Ia2ZBcj6HktYjIb vAmDhaY44AKqYac24Ocw6uku+8SiK9wrA4t/EJaPdqT88cpsASH2tIlNbDl7qJv+ BsyTTnyPAmrEK4jmCyKoom0fim5WSjby/BiVpaWJ+im6sLz04VckBta0wX2gMY1d qk4gHRu1YD7SljSBXO364Xh0DEJnNAtJfQ6qlwhQ6G/3wOZ3t9caIaCDos7isA8u DcO7ELug2uRgMeyc31nPiZz6aHn55uSutAfd9AdKrlbDrmAV7chR7Wq5HeJeiquG rKz1aRakhCJXO6J85sO55Mmm8araX9KCKXOT3iPjQq0Zz2RSiYklp+VNeme1HA4X 6QSyk8Nf0s2cepn0T3KA8JXN0LbJR4uhVAwoetdYmd8cW13U1nQ8DoKcvu4GfNDX z561iDwvAJF/1Dr2qYRjetu6P2y2cLlpsONIzTHGvvz7bWg1Rzg= =zG3I -----END PGP SIGNATURE----- --wUFdHCzWXysqmIVe--