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

Vermeulen Jan
2003-04-10T06:02:55Z

Peter,

> >> 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.
>
> I can't stepi from the start, I have to run it. How(actually,
> *where*) can I set a breakpoint at the *first* instruction so I can
> *then* stepi?

If your only function is 'foo', why not try "break foo" at the gdb command?

I just tried it out (same example as you) and it works. I can stepi in the
program and see that it jumps to 0x0 after the 'blr' instruction at the end
of 'foo' where it segfaults.

HTH,
Jan