you could always implement the kill syscall to do exactly the same thing as exit() but instead print out the standard message for you.
All the syscalls are defined in : src/sim/syscall_emul.hh/cc And then you need to map the syscall in whatever architeture and OS you are using. I assumes Alpha-Linux so you would go to src/arch/alpha/linux/process.hh/cc and map the kill syscall to your defined function "killFunc". Do you know if the exitcode "8" means divide by zero? What you can do is find the actual implementation of the kill function in linux (google for like a linux lexer) and then find out what parameter/argument is the exit code. In your killFunc, you can just look up that argument and print out what you need. I think if you look at the example code in the files I specified you'll see what I'm talking about. On Fri, May 9, 2008 at 6:55 AM, David Robert White <[EMAIL PROTECTED]> wrote: > Thanks Nate, that's very useful information. > > I might need to explain a little more detail about what I'm trying to > achieve. > > I have a program that may cause a run-time error (e.g. divide by zero). If > I run this outside of the simulator, I can check the return code to > determine if an error occurred. > However, when the division by zero occurs, I get the following on the > simulator output: > > warn: ignoring syscall kill(100, 8, ...) > > So I guess it's ignoring the division by zero. > > I guess what I would need is to be able to prevent the simulator from > ignoring this. Any ideas? > > Thanks > > David > > ------------------------------ > > Message: 7 > Date: Fri, 9 May 2008 06:03:55 -0700 > From: "nathan binkert" <[EMAIL PROTECTED]> > Subject: Re: [m5-users] Return Code > To: "M5 users mailing list" <[email protected]> > Message-ID: > <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=ISO-8859-1 > > The exit system call is handled, so you can hack into the exitFunc() > function in src/sim/syscall_emul.cc if you want to do it in C++. In > python, the simulate function returns an ExitEvent object. Right now, > you can see that we generally call only getCause() on that object. > There is also a getCode() function that you can call to get the exit > code. If the cause is "target called exit()" then the code is the > exit code passed to exit. > > Nate > > On Fri, May 9, 2008 at 4:47 AM, David Robert White <[EMAIL PROTECTED]> > wrote: >> >> > Hi, >> > >> > Can anyone please tell me how to get the return code of a program in SE >> > mode? >> > When my program runs within the simulator, I would like to obtain the >> > resulting return code of the program that the simulator has run. >> > >> > Thanks >> > >> > David >> > >> > -- >> > David R White >> > >> > Research Student >> > Department of Computer Science >> > University of York >> > York YO10 5DD >> > United Kingdom >> > >> > >> > >> > _______________________________________________ >> > m5-users mailing list >> > [email protected] >> > http://m5sim.org/cgi-bin/mailman/listinfo/m5-users >> > >> > > > -- > David R White > > Research Student > Department of Computer Science > University of York > York YO10 5DD > United Kingdom > > Phone: +44 (0)1904 434756 > _______________________________________________ > m5-users mailing list > [email protected] > http://m5sim.org/cgi-bin/mailman/listinfo/m5-users > -- ---------- Korey L Sewell Graduate Student - PhD Candidate Computer Science & Engineering University of Michigan _______________________________________________ m5-users mailing list [email protected] http://m5sim.org/cgi-bin/mailman/listinfo/m5-users
