Re: Debugging embedded python



Thank's a lot miki for your response!

It seems that this problem is now solved, yet a new one now occured.
And the name of my new problem is...

"<Stack is not available: Cannot access memory at address 0x1.>"

Let me rewrite the code a little bit more clearly...

//*******************************************************************
// C O D E
//*******************************************************************
01
//___________________________________________________________________
02 // Includes mpla, mpla mpla...
03 #include <Python.h>
04 #include <iostream>
05 #include <cmath>
06 using namespace std;
07
08
//___________________________________________________________________
09 // My function
10 /* Return the sqrt of a double */
11 static PyObject* Fotis_root(PyObject *self, PyObject *args)
12 {
13 double d=0;
14 if(!PyArg_ParseTuple(args,"d",&d)) return NULL;
15 return Py_BuildValue("d", sqrt(d));
16 }
17
18
//___________________________________________________________________
19 // Some python module stuff
20 static PyMethodDef FotisMethods[] = {
21 {"root",Fotis_root, METH_VARARGS,
22 "Return the root of a double."},
23 {NULL, NULL, 0, NULL}
23 };
24
25
//___________________________________________________________________
26 // Main program
27 int main(int argc,char** argv)
28 {
29 Py_Initialize();
30 Py_InitModule("fotis", FotisMethods);
31 PyRun_SimpleString("from fotis import root");
32 FILE* fp=stdin;
33 char *filename="Solver";
34 PyRun_InteractiveLoop(fp,filename); 35 Py_Finalize();
36 return 0;
37 }

Now lets say i set two breakpoints: line 29, and line 13. This is what
happens:
1. Breakpoint at line 29: There is a strange combination of next, step,
and other stuff that can move me from line 29 to line 34. No matter how
deeply I digged everywhere I cannot realy understand what really
happens there, but what the hack this is not what I'm really interested
in. by the way if i try too many steps then there is no way back...
2. Breakpoint at line 13: When I finally reach the much awaited line
34, the python interpreter is there and running and waiting for my
commands, which here is the fotis.root(double) command. when I give
though this command control is totally lost: i get the message
described above and after that everything seems to be dead. I really do
not know where I am, why am I there, and what exactly I am doing at the
point that I am.

What is really happening?

Any help will be very appreciated.
fotis._

.



Relevant Pages

  • Re: What language are assemblers written in?
    ... The Microsoft Macro Assembler Package v 3.01 is a technical update to the Micro- ... SYMDEB and MAPSYM, the interactive symbolic debug utility for Microsoft langua- ... Help command has been added to display the command syntax. ... breakpoint - to speed debugging and avoid repetitive typing. ...
    (comp.lang.asm.x86)
  • Re: VBA execution
    ... There is no autoexec macro but, as I said, there is a startup form. ... question now is where in this form do I put the Stop command. ... cannot set a breakpoint in an application that isn't running yet. ...
    (microsoft.public.access.gettingstarted)
  • Re: Quad Error
    ... Set a breakpoint on that line of code and run the function. ... If it shows you that QUAD is a subfunction in this file, ... I "clear" and "clc" in the command window to ensure nothing is interfering. ... Also look at the topmost displayed line in the output of DBSTACK and open up that file to the line. ...
    (comp.soft-sys.matlab)
  • Re: [Help] Printing problem in Mac OSX Leopard
    ... I can print the figure using command "print" in the command ... Matlab 2007a Student version. ... lpr: The printer or class was not found. ... If you're adventurous you can set a breakpoint in MATLAB's print command ...
    (comp.soft-sys.matlab)