From: Subhasis R. <ray...@gm...> - 2012-12-19 04:06:43
|
Dear Saeed, Development tools are very much a matter of personal taste. But I think gdb is the standard debugging tool on Linux. And most likely Linux version of eclipse is also using the same as a back end. As far as front-end is concerned, you have plenty of choices on Linux: ddd, eclipse, emacs, vi(m). You can search the internet for the specifics of each interface. For debugging moose you do not require "make install", which is for copying the libraries to system-wide location. What you need to do is: 1. Build moose in debug mode make BUILD=debug This will build moose with debug symbols incorporated into the binaries. 2. Start gdb and set PYTHONPATH Below I provide sample commands for gdb command line version. This should be available in all front ends. After this you want to set the environment variable PYTHONPATH to {moose_source_directory}/python. Read the GDB documentation on how to do that: (gdb) help set environment will give you a brief description. 3. Enable future breakpoints. Then you want to read the documentation on "future" breakpoints. To turn that on: (gdb) set breakpoint pending on 4. Set breakpoints After this you can put a breakpoint anywhere in MOOSE C++ code in the usual way. Remember that the entry point to MOOSE C++ module from Python is the module initialization function: {moose}/pymoose/moosemodule.cpp: init_moose. There is a bit of trick here: the function name is generated using a preprocessor directive, so it looks like: PyMODINIT_FUNC MODINIT(_moose) in the code. 5. Start debugging Python After this you start Python in gdb (either starting gdb with /usr/bin/python as the argument or by using "file" command inside gdb. If you want some particular Python script to be executed, you set that using "set args" command in gdb. Now start running Python: (gdb) r If you assigned a script above, Python will run that script and stop at the breakpoint on reaching it. Otherwise Python interpreter will run interactively and you can do the usual import moose in the interpreter prompt and execute statements you want to debug. There is a lot to gdb and reading the documentation will help you not only with moose but programming and debugging in general. Hope this helps, Subha On Wed, Dec 19, 2012 at 1:10 AM, Saeed Shariati <sd....@gm...>wrote: > Dear All, > > In developing code at Moose. Processing parts of code are in C++ and start > point is in Python. I can compile and debug processing part in EClipse. > Creating another Python project beside of the code and debugging via > EClipse can be an interesting for development. But, I have some problem to > config EClipse for this situation. > Are moose python module applicable after "moose install"? or I can use it > directly via one EClipse python project? > > All in all, would you please counsel me about suggested development tools > and method for developing and testing moose code? > > I am looking forward to hear from you. > > Best Regards, > Saeed Shariati > > ------------------------------------------------------------------------------ > LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial > Remotely access PCs and mobile devices and provide instant support > Improve your efficiency, and focus on delivering more value-add services > Discover what IT Professionals Know. Rescue delivers > http://p.sf.net/sfu/logmein_12329d2d > _______________________________________________ > moose-devel mailing list > moo...@li... > https://lists.sourceforge.net/lists/listinfo/moose-devel > |