Thread [1] (Suspended: Breakpoint hit.) ... [message #148131] |
Mon, 04 July 2005 08:22 |
Eclipse User |
|
|
|
Originally posted by: fotis77k.fmail.co.uk
... <Stack is not available: Cannot access memory at address 0x1.>
That is what I get when trying to debug an embedded python project (it's a
small one so you may find attached the code within this msg.)
But this not the real problem. The real problems comes exactly after that
point, where i lose contact with variables, registers, memory and all the
other nice widgets that come along with the debugging perspective.
So this is how it works:
//********************************************************** *********
// 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 Step into,
Step over, and step return 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.
postscript: msvc 6.0 goes really really smooth at this point.
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 as given in the subject
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.
postscript: msvc 6.0 goes really really smooth at this point too.
and gdb (as line command) by itself has a descent behavior, so I was
thinking that maybe this is sth that has to do with the cdt.
(I forgot to mention that the above code to run needs the python
directories and static libraries to be taken care of).
Any help will be very appreciated.
fotis._
|
|
|
Powered by
FUDForum. Page generated in 0.02933 seconds