This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: How to build application to run under the ppc simulator?


> and it bombs with:
> >Program terminated with signal SIGSEGV, Segmentation fault.
> >The program no longer exists.
> >[Switching to process 0]
> >(gdb) 

This is quite normal, because your program is executed correctly and
executes an 'blr' instruction at the end of the main routine. This makes the
simulated CPU jump to what's currently in the link register, which can be
anything. There it will do crazy things untill it finally segfaults :)

If in doubt, just 'stepi' the program, watching the assembly be executed.

We use the ppc-sim for testing some algorithms to see if they spit out right
reference values.
At the end of our main routine, we always put a 'while(1);' so it never
returns out of there (because where would it return to?? (unless you are
also simulating an operating system under which your test program is running
:) ).

You could also write something to the simulated serial port to indicate that
your program is finished and then do the while(1).

This is what I know about the simulator. It works pretty good for us.

> I'm confused as to how I build/link a program to run under the
> simulator.  My real goal is to extract from the ppc simulator what I
> need to build a coldfire simulator.

The way you build the powerpc program might be ok. You should check what
linker script is that's used as default.
(do 'ppc-eabi-ld --verbose' to display the default linkerscript)

If in doubt, use one of the linkerscript of the
${PREFIX}/${TARGET}/lib/ldscripts/elf32ppcsim.* files.

I hope this helps you a bit further,
Best regards,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]