[gem5-users] Re: How to redirect the fopen to open a different file instead of specifed filename in the program binary given as input to gem5 simulator in SE mode

2021-07-22 Thread Gabriel Busnot via gem5-users
Hi Gogineni, If you REALLY CAN'T modify the app, I would then replace the file(s) your app opens with a symlink to the file you want to open. And if you feel in a hacky mood, you can dive in src/sim/syscall_emul.hh and hardcode path override in openatFunc. Needless to say this is a terrible

[gem5-users] Re: How to redirect the fopen to open a different file instead of specifed filename in the program binary given as input to gem5 simulator in SE mode

2021-07-21 Thread gogineni kailashnath via gem5-users
Hello mohit, But my problem is we shouldn't modify the program binary, instead when the simulator process the binary, when it triggers fopen syscall, it should should open a different file instead of already specified one. Here, as this is in the hardware level, I guess we can't see the filename

[gem5-users] Re: How to redirect the fopen to open a different file instead of specifed filename in the program binary given as input to gem5 simulator in SE mode

2021-07-21 Thread mohit.gambhir84--- via gem5-users
Hi gogineni, You will have to modify the hello world program to take in a command line argument and use that instead of hard coded file name. Something like this fp = fopen( argv[1] , "w" ); In gem5, if your se.py equivalent system is using the default set of command line parameters defined

[gem5-users] Re: How to redirect the fopen to open a different file instead of specifed filename in the program binary given as input to gem5 simulator in SE mode

2021-07-21 Thread gogineni kailashnath via gem5-users
On Wed, Jul 21, 2021, 11:48 AM gogineni kailashnath < gkailashnath1...@gmail.com> wrote: > Hello, > > I have a C code, which creates a file *file.txt* and prints the hello > world content in the file. > > #include > > int main () { >FILE *fp; >char str[] = "Hello world"; > >