From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14609 invoked by alias); 20 Jun 2013 17:50:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 14588 invoked by uid 89); 20 Jun 2013 17:50:31 -0000 X-Spam-SWARE-Status: No, score=-9.7 required=5.0 tests=AWL,BAYES_00,KHOP_PGP_SIGNED,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.1 Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 20 Jun 2013 17:50:30 +0000 Received: from vapier.localnet (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 1D63833E5EB; Thu, 20 Jun 2013 17:50:29 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org, lgustavo@codesourcery.com Subject: Re: [PATCH, gdbsim] Avoid silly crash when no binary is loaded Date: Thu, 20 Jun 2013 17:50:00 -0000 User-Agent: KMail/1.13.7 (Linux/3.8.3; KDE/4.6.5; x86_64; ; ) Cc: Pedro Alves References: <51C0C7E3.1030603@codesourcery.com> <51C193AE.7010608@redhat.com> <51C19FF0.8000005@codesourcery.com> In-Reply-To: <51C19FF0.8000005@codesourcery.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart13880986.liKi4GxqxK"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201306201350.31839.vapier@gentoo.org> X-Virus-Found: No X-SW-Source: 2013-06/txt/msg00553.txt.bz2 --nextPart13880986.liKi4GxqxK Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-length: 2894 On Wednesday 19 June 2013 08:11:28 Luis Machado wrote: > On 06/19/2013 08:19 AM, Pedro Alves wrote: > > SIM_RC > > sim_create_inferior (SIM_DESC sd, struct bfd *abfd, > > char **argv, char **env) > > { > > SIM_CPU *cpu =3D STATE_CPU (sd, 0); > > SIM_ADDR addr; > >=20=20=20=20 > > /* Set the PC. */ > > if (abfd !=3D NULL) > > addr =3D bfd_get_start_address (abfd); > > else > > addr =3D 0; > > sim_pc_set (cpu, addr); >=20 > Is there a good reason why bfin would allow things to proceed without > any image? It doesn't even run past that point really. because it'd segfault otherwise ;) $ ./gdb/gdb -q (gdb) target sim Connected to the simulator. (gdb) run Starting program:=20=20 warning: No executable file specified. warning: No program loaded. Segmentation fault (core dumped) > If running, and by that i mean issuing run/start/continue/step commands, > the simulators with no image is a valid use case, then sounds like > steering the arm simulator to just do more or less what the other > simulators do is the right thing. well, there's a bit more nuance than that. consider the operating environm= ent=20 (literally, --environment operating). when you connect to that, it's like = you=20 took jtag and connected it to a cpu fresh out of reset. sure, there's no=20 "program" loaded in its memory, but there's still plenty you can do to the= =20 device like poke memory and see how it reacts -- whether it be external SDR= AM,=20 or a parallel flash, or on-chip L1/L2, or memory mapped registers for the=20 peripherals, or an async memory bus, or an on-chip boot/ROM (which has both= =20 code & data). maybe i'm an odd ball, but i find this scenario great for bo= th=20 testing, development (like writing new sim device models), and one-off chec= ks.=20=20 the fact that i need to compile & link a dummy program just to load it into= =20 the sim so i can start poking around is obnoxious. similarly, when i have= =20 just a .bin of raw code/data (e.g. `objcopy -O binary foo.elf foo.bin` whic= h=20 is common in the embedded world), how am i going to get that into the=20 simulator ? when i'm connected to jtag, i could use "load" & friends to co= py=20 it to memory, set the pc, and let it run. with the sim, i need to create a= =20 dummy .s that does .incbin "foo.bin" and compile+link that. now, when you talk about the other environments (like the virtual or user),= =20 what you want makes a bit more sense as there's not a whole lot you could=20 reasonably do. but i don't think we should head in a direction that moves= =20 even farther away from what i desire above for the operating environment.= =20=20 maybe there's some middle ground ? > Then again, these simulators are old and not used that often. that depends on the specific sim. i take umbrage to the idea that the bfin= sim=20 is old and not used that often ;). -mike --nextPart13880986.liKi4GxqxK Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. Content-length: 836 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) iQIcBAABAgAGBQJRw0DnAAoJEEFjO5/oN/WBjPcQAKVdWA3pgqGWhmRiprXgU3nf 2PTkXdiw1I+0wDW1KSPeyvqwrtmnDXYEHO5+J4gAZdh32ZSrxnqh34teN9q6sCJg JeLDqP3eOqdURh3qMK/R6wvCPIjmEtDwDPNLSNsNmWEBBTRooIZt+tH4EWbye1fm 2kdowpKQZ7tBCC5OCR6C0gO013ColBgO0CKv00HJRnM22dRaAZDybjeTLfGlcm78 VqLPmHKQs0sxLfkL58NqZgtK/9ob0880T8piZ/SdR3Q5IhetAwt2aLvw23Bvu+qK Byfn7VFeXB5pge7XWpoYBAzePmovkje9TcMKLqWowQJHW/99GNv26VGt1JrNM9Yl liHt0Nl0ginSIQoLBpzhf2wgQ6XrjNaI5u5I+GYugcl+2QJU/uZ3tvIBq21CSOM2 /hrQcP/QF2tDjx4qhJXSIDEhOu8KGsEOhPbROGS6F60qh+emWRUJV6sR9J1oK03W 89KnqUflv70OEzK3qwOCUF7ppznjwcbbzVmrVJgRBc3ZphQldUKGYGBRNaUmr6ce 6rAtl9q7Bfthk5T38wx+RTgXN0IKN9lj9W4j2giA/rriMn59zgz8CrOnqSTgVFMl jQDRBlgTsJwGpPHevjgb6FHL+wMYp0oNhSthprZW9OyfxWZyN6gLn2a2mf/7oPCl iSPq5EnZHDnR2E8/qW1l =RuJ8 -----END PGP SIGNATURE----- --nextPart13880986.liKi4GxqxK--