Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org, lgustavo@codesourcery.com
Cc: Pedro Alves <palves@redhat.com>
Subject: Re: [PATCH, gdbsim] Avoid silly crash when no binary is loaded
Date: Thu, 20 Jun 2013 17:50:00 -0000	[thread overview]
Message-ID: <201306201350.31839.vapier@gentoo.org> (raw)
In-Reply-To: <51C19FF0.8000005@codesourcery.com>

[-- Attachment #1: Type: Text/Plain, Size: 2858 bytes --]

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 = STATE_CPU (sd, 0);
> >    SIM_ADDR addr;
> >    
> >    /* Set the PC.  */
> >    if (abfd != NULL)
> >      addr = bfd_get_start_address (abfd);
> >    else
> >      addr = 0;
> >    sim_pc_set (cpu, addr);
> 
> 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:  
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 environment 
(literally, --environment operating).  when you connect to that, it's like you 
took jtag and connected it to a cpu fresh out of reset.  sure, there's no 
"program" loaded in its memory, but there's still plenty you can do to the 
device like poke memory and see how it reacts -- whether it be external SDRAM, 
or a parallel flash, or on-chip L1/L2, or memory mapped registers for the 
peripherals, or an async memory bus, or an on-chip boot/ROM (which has both 
code & data).  maybe i'm an odd ball, but i find this scenario great for both 
testing, development (like writing new sim device models), and one-off checks.  
the fact that i need to compile & link a dummy program just to load it into 
the sim so i can start poking around is obnoxious.  similarly, when i have 
just a .bin of raw code/data (e.g. `objcopy -O binary foo.elf foo.bin` which 
is common in the embedded world), how am i going to get that into the 
simulator ?  when i'm connected to jtag, i could use "load" & friends to copy 
it to memory, set the pc, and let it run.  with the sim, i need to create a 
dummy .s that does .incbin "foo.bin" and compile+link that.

now, when you talk about the other environments (like the virtual or user), 
what you want makes a bit more sense as there's not a whole lot you could 
reasonably do.  but i don't think we should head in a direction that moves 
even farther away from what i desire above for the operating environment.  
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 
is old and not used that often ;).
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2013-06-20 17:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-18 21:09 Luis Machado
2013-06-19 11:43 ` Pedro Alves
2013-06-19 12:20   ` Luis Machado
2013-06-19 14:53     ` Pedro Alves
2013-06-19 15:20       ` Luis Machado
2013-06-20 13:39         ` Luis Machado
2013-06-20 17:50     ` Mike Frysinger [this message]
2013-06-20 18:34       ` Pedro Alves
2013-06-20 21:33       ` Stan Shebs
2013-06-20 22:00         ` Mike Frysinger
2013-06-21 10:58           ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201306201350.31839.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=gdb-patches@sourceware.org \
    --cc=lgustavo@codesourcery.com \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox