From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1175 invoked by alias); 9 Apr 2003 06:21:46 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 1166 invoked from network); 9 Apr 2003 06:21:43 -0000 Received: from unknown (HELO hrtades9.atea.be) (194.78.143.106) by sources.redhat.com with SMTP; 9 Apr 2003 06:21:43 -0000 Received: from hrtades10.atea.be (siemens.atea.be [139.10.143.141]) by hrtades9.atea.be with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id 1RFVNX52; Wed, 9 Apr 2003 08:21:42 +0200 Received: by siemens.atea.be with Internet Mail Service (5.5.2653.19) id ; Wed, 9 Apr 2003 08:21:42 +0200 Message-ID: <57FD2C3A246F76438CA6FDAD8FE9F19597E9D2@hrtades7.atea.be> From: Vermeulen Jan To: 'Peter Barada' , gdb@sources.redhat.com Cc: Peter.Barada@motorola.com Subject: RE: How to build application to run under the ppc simulator? Date: Wed, 09 Apr 2003 06:21:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-SW-Source: 2003-04/txt/msg00078.txt.bz2 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. 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, Jan