Author Topic: Python Debugger  (Read 80628 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Python Debugger
« Reply #15 on: July 31, 2012, 04:04:17 pm »
a) sounds like the way to go.
b) is not possible, because typedefs can't be forward declared, too.
c) won't be discussed at all, because it will make the code harder to maintain and will probably cause lots of memory leaks.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Python Debugger
« Reply #16 on: July 31, 2012, 05:30:55 pm »
a) sounds like the way to go.
b) is not possible, because typedefs can't be forward declared, too.

I had no problems with (b):

Code
#include <cbplugin.h>

typedef cb::shared_ptr<cbWatch> cbWatchPtr; // <-- This compiles fine
typedef cbWatch::Pointer cbWatchPtr2; // <--- This is an error

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Python Debugger
« Reply #17 on: July 31, 2012, 05:49:25 pm »
The thing is that if we want to put typedef at the correct place (debuggermanager.h), we can't because forwarding typedefs doesn't work.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Python Debugger
« Reply #18 on: July 31, 2012, 06:14:06 pm »
The thing is that if we want to put typedef at the correct place (debuggermanager.h), we can't because forwarding typedefs doesn't work.

Well you could do this

Code
//debugger_pointers.h
class cbWatch;
typedef cb::shared_ptr<cbWatch> cbWatchPtr;
class cbBreakpoint;
typedef cb::shared_ptr<cbBreakpoint> cbBreakpointPtr;
...

//debuggermanager.h
#include "debugger_pointers.h"

//cbplugin.h
#include "debugger_pointers.h"

 ;)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Python Debugger
« Reply #19 on: July 31, 2012, 07:06:18 pm »
Yes, of course, if you have time and desire you can do it, too :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Python Debugger
« Reply #20 on: August 08, 2012, 08:59:07 pm »
Added a couple of small updates to the svn which fixed performance when expanding a watch item to show object members. It turns out that Regex can have really poor performance on seemingly simple searches.

Yes, of course, if you have time and desire you can do it, too :)

I played around with this:

Code
class cbWatch;
typedef cb::shared_ptr<cbWatch> cbWatchPtr;

and (and as I suspect you already knew) it doesn't really help all that much, because at times you want cb::shared_ptr<Derived Class> instead, and so each plugin would need to define those typedefs as well.

Things I don't like about the current implementation stand:
1/ It is confusing to refer to shared_ptr in some places and someclass::pointer in other places
2/ typedef shared_ptr<cbWatch> Pointer doesn't correctly inherit for derived classes (i.e. derived class still needs to define its own Pointer)
3/ someclass::pointer obscures that fact that this is a shared_ptr not a "*". (The implementation details matters when it comes time to clean up.)

Wouldn't the need for the plugin writers to use shared_ptr go away if the framework instead of the plugin provided the containers for the various lists of items. (Perhaps using a class template?)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Python Debugger
« Reply #21 on: August 08, 2012, 09:13:24 pm »
Wouldn't the need for the plugin writers to use shared_ptr go away if the framework instead of the plugin provided the containers for the various lists of items. (Perhaps using a class template?)
I'm not sure what are you talking exactly.

For the typedef you can try to remove it, I have no problem with it. And if it is confusing for you it will be for other, so removing the typedef is the only way forward.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Falldog

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: Python Debugger
« Reply #22 on: August 18, 2012, 03:08:23 am »
How can I build it in Windows?

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Python Debugger
« Reply #23 on: August 18, 2012, 04:04:21 pm »
How can I build it in Windows?

What have you tried?

There is a windows project file (cbp) but it may not be completely up to date (some tweaks required).

The most straightforward way is to start by compiling and running cb itslef from svn sources (see the wiki). Then copy the debugger code to src/plugins/contrib and try to build it from the provided project file. If you have problems let me know.

Offline Falldog

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: Python Debugger
« Reply #24 on: August 19, 2012, 04:09:08 pm »
What have you tried?
There is a windows project file (cbp) but it may not be completely up to date (some tweaks required).
The most straightforward way is to start by compiling and running cb itslef from svn sources (see the wiki). Then copy the debugger code to src/plugins/contrib and try to build it from the provided project file. If you have problems let me know.
Thanks,
I had build it success,
And run in CB from output/, try edit a .py file, set PythonDebugger as active debugger,
1. I try to setting PythonDebugger info from Settings|Debugger|PyDebugger, it display nothing to setup, how can I setup the python path or other setting?
2. I don't know how to debug and set break point on PythonDebugger.dll,
   I run CB by CB, and set break point on PythonDebugger source code, it doesn't break on any break points.
   I run a CB, and try to run another CB(fail to launch 2 CB?) for attach process to debug -> fail
   How to debug on PythonDebugger plugin?
 ???

Thanks

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Python Debugger
« Reply #25 on: August 19, 2012, 06:38:53 pm »
Thanks,
I had build it success,

Good news!

Quote
And run in CB from output/, try edit a .py file, set PythonDebugger as active debugger,
1. I try to setting PythonDebugger info from Settings|Debugger|PyDebugger, it display nothing to setup, how can I setup the python path or other setting?

Not available yet. By default it uses the path of the script. If you need something else, as a workaround use os.chdir in your script.  I plan to add support for running pdb on the current target (if the current target is a python script) which will allow you to set per target options like command line args and working directories.

Quote
2. I don't know how to debug and set break point on PythonDebugger.dll,
   I run CB by CB, and set break point on PythonDebugger source code, it doesn't break on any break points.

Are you trying to debug python sources or C++ sources? It will only work on python sources.

Quote
  I run a CB, and try to run another CB(fail to launch 2 CB?) for attach process to debug -> fail
   How to debug on PythonDebugger plugin?
 ???

Thanks

Not sure what you are trying to do here. It sounds like you are trying to debug the debugger?

Offline Falldog

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: Python Debugger
« Reply #26 on: August 20, 2012, 04:22:01 am »
Hi dmoore,
I am trying to modify PythonDebugger, so I want to debug the PythonDebugger source code(worte by you)
I had little experience on modify HAP Debuggerhttp://hapdebugger.sourceforge.net/, but it only work on Windows :'(

So I try to use CB as IDE to develop PythonPlugin, just like you do.
But I am a newer of CB, don't know how to debug for the PythonDebugger

Please help to share that how to debug the PythonDebugger plugin, I will try to trace how it work and try add some features
 :)
Thanks a lot

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Python Debugger
« Reply #27 on: August 20, 2012, 05:09:52 am »
Please help to share that how to debug the PythonDebugger plugin, I will try to trace how it work and try add some features

Sounds good. Quite a bit of work still needed :)

Re your debugging problem, it may be a bad setup in the PyDebugger project file. After you compile the plugin try switching back to CB project and debugging the default target.

Assume you were able to use the plugin to debug a python script.

Have you seen rpdb2? Eventually I want to use that (or something better) instead of pdb.

Offline Falldog

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: Python Debugger
« Reply #28 on: August 22, 2012, 02:37:00 am »
Sounds good. Quite a bit of work still needed :)
Re your debugging problem, it may be a bad setup in the PyDebugger project file. After you compile the plugin try switching back to CB project and debugging the default target.
Assume you were able to use the plugin to debug a python script.
Have you seen rpdb2? Eventually I want to use that (or something better) instead of pdb.

Thanks a lot, I can trace CB & PyDebugger now
It's so stupid issue I meet, I try to trace code by "Run" not "Debug&Continue" ...  :-[

I doesn't know what is rpdb2... @@
I just study, maybe rpdb2 and pydb is good choice

Offline Falldog

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: Python Debugger
« Reply #29 on: September 21, 2012, 05:43:44 am »
Please help to share that how to debug the PythonDebugger plugin, I will try to trace how it work and try add some features

Sounds good. Quite a bit of work still needed :)

Re your debugging problem, it may be a bad setup in the PyDebugger project file. After you compile the plugin try switching back to CB project and debugging the default target.

Assume you were able to use the plugin to debug a python script.

Have you seen rpdb2? Eventually I want to use that (or something better) instead of pdb.

hi dmoore,
I had modify some code to apply rpdb2
how can I provide it to you for review it?
I create the patch by Git, but it's size over the post maximum