HPCE / hpce-2014-cw4

3 stars 5 forks source link

Debugging with IDE #6

Closed kronocharia closed 9 years ago

kronocharia commented 9 years ago

Has anyone worked out how to run and debug the piped series of executables in an IDE? Perhaps it can be done by writing a wrapper main to test by calling all the function inside?

kronocharia commented 9 years ago

Ok so I forgot to post this, but I have a solution, for any xcode users, and probably a similar thing can be done with VS.

Xcode project generated using: https://github.com/HPCE/hpce-2014-cw4/issues/5 You can tell xcode (or whatever) to wait until the the executable launches, by doing something like screen shot 2015-02-14 at 02 02 21

If you then in the terminal execute ./make_world 10 0.1 | ./step_world 0.1 100, Xcode will see the executable step_world executable running and then latches the debugger onto it, assuming you have a breakpoint.

However you need raise(SIGSTOP); #include right inside main otherwise the process terminates before xcode gets a chance to hook in, screen shot 2015-02-14 at 02 07 21

Perhaps a single wrapper main target might be still a better solution, but in the meantime this seems to work, at least for running the examples, I dont know how well it will hold up when we actually start to changing things

m8pple commented 9 years ago

Looks like you have a good solution; my approach would have been to generate the input into a file, then redirect that into stdin for debugging. GDB supports it: https://sourceware.org/gdb/current/onlinedocs/gdb/Input_002fOutput.html#Input_002fOutput and VS as well: https://msdn.microsoft.com/en-us/library/kcw4dzyf(v=VS.110).aspx

But I'll link it back, as people may find it useful. Thanks.