Python debug libraries

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Robert Ferrell

    Python debug libraries

    I'm trying to do some debugging of python extensions on Windows2K. MS
    Visual Studio (.NET) says it can't find the debug version of the
    python libraries. (The message is "python.exe does not contain any
    debugging information".) I installed the binaries from the Windows
    installer. How should I get the debug libraries? Or is that even
    what I need? I'm kind of new to Windows, and Visual Studio in
    particular, so maybe I'm way off base.

    thanks,
    -robert
  • Trent Mick

    #2
    Re: Python debug libraries

    [Robert Ferrell wrote][color=blue]
    > I'm trying to do some debugging of python extensions on Windows2K. MS
    > Visual Studio (.NET) says it can't find the debug version of the
    > python libraries. (The message is "python.exe does not contain any
    > debugging information".) I installed the binaries from the Windows
    > installer. How should I get the debug libraries? Or is that even
    > what I need? I'm kind of new to Windows, and Visual Studio in
    > particular, so maybe I'm way off base.[/color]

    If you are using the ActivePython distribution the debug libraries are
    made available in a separate package here:
    ftp://ftp.activestate.com/ActivePython/etc/

    For example the debug libs for ActivePython 2.3.2 are:
    ActivePython-2.3.2-230-win32-ix86.debug.zip

    Cheers,
    Trent

    --
    Trent Mick
    TrentM@ActiveSt ate.com

    Comment

    • Mike C. Fletcher

      #3
      Re: Python debug libraries

      See my recent post...



      (all one line). You probably don't want to debug *everything*, just
      your particular extension, and this recipe allows that fairly readily
      w/out requiring getting every single dependency built against debug
      Python (which can be a royal PITA).

      HTH,
      Mike

      Robert Ferrell wrote:
      [color=blue]
      >I'm trying to do some debugging of python extensions on Windows2K. MS
      >Visual Studio (.NET) says it can't find the debug version of the
      >python libraries. (The message is "python.exe does not contain any
      >debugging information".) I installed the binaries from the Windows
      >installer. How should I get the debug libraries? Or is that even
      >what I need? I'm kind of new to Windows, and Visual Studio in
      >particular, so maybe I'm way off base.
      >
      >thanks,
      >-robert
      >
      >[/color]
      _______________ _______________ _________
      Mike C. Fletcher
      Designer, VR Plumber, Coder





      Comment

      • Bryan

        #4
        Re: Python debug libraries

        Mike C. Fletcher wrote:
        [color=blue]
        > See my recent post...
        >
        > http://groups.google.ca/groups?q=deb...hon.org&rnum=2
        >
        >
        > (all one line). You probably don't want to debug *everything*, just
        > your particular extension, and this recipe allows that fairly readily
        > w/out requiring getting every single dependency built against debug
        > Python (which can be a royal PITA).
        >
        > HTH,
        > Mike
        >
        > Robert Ferrell wrote:
        >[color=green]
        >> I'm trying to do some debugging of python extensions on Windows2K. MS
        >> Visual Studio (.NET) says it can't find the debug version of the
        >> python libraries. (The message is "python.exe does not contain any
        >> debugging information".) I installed the binaries from the Windows
        >> installer. How should I get the debug libraries? Or is that even
        >> what I need? I'm kind of new to Windows, and Visual Studio in
        >> particular, so maybe I'm way off base.
        >>
        >> thanks,
        >> -robert
        >>
        >>[/color]
        > _______________ _______________ _________
        > Mike C. Fletcher
        > Designer, VR Plumber, Coder
        > http://members.rogers.com/mcfletch/
        >
        >
        >
        >[/color]

        in our company, we do not link to debug third party libraries. i'm embedding python (using visual studio) and run into
        the same problem. we now resort to undef'ing _DEBUG before including the python header files and everything works
        correctly. if you look in the python header files, you will see that when _DEBUG is defined, there is a #pragma to link
        to pythonXX_d.lib. when _DEBUG is not defined it will link to pythonXX.lib. other's may disagree about this approach,
        but so far it works well and we don't have any memory problems at all.

        for extensions using distutils here's another option which i prefer, since you can do this on a case-by-case basis
        instead of modifiying msvccompiler.py :

        add this line to setup in your setup.py file:

        extra_compile_a rgs = ['/Od /Z7'],
        extra_link_args = ['/DEBUG'],

        since these options will be placed after the compile/link options that distutils uses, these options will be used,
        overriding the options in msvccompiler.py .

        bryan

        Comment

        • Bryan

          #5
          Re: Python debug libraries

          Mike C. Fletcher wrote:
          [color=blue]
          > See my recent post...
          >
          > http://groups.google.ca/groups?q=deb...hon.org&rnum=2
          >
          >
          > (all one line). You probably don't want to debug *everything*, just
          > your particular extension, and this recipe allows that fairly readily
          > w/out requiring getting every single dependency built against debug
          > Python (which can be a royal PITA).
          >
          > HTH,
          > Mike
          >
          > Robert Ferrell wrote:
          >[color=green]
          >> I'm trying to do some debugging of python extensions on Windows2K. MS
          >> Visual Studio (.NET) says it can't find the debug version of the
          >> python libraries. (The message is "python.exe does not contain any
          >> debugging information".) I installed the binaries from the Windows
          >> installer. How should I get the debug libraries? Or is that even
          >> what I need? I'm kind of new to Windows, and Visual Studio in
          >> particular, so maybe I'm way off base.
          >>
          >> thanks,
          >> -robert
          >>
          >>[/color]
          > _______________ _______________ _________
          > Mike C. Fletcher
          > Designer, VR Plumber, Coder
          > http://members.rogers.com/mcfletch/
          >
          >
          >
          >[/color]

          in our company, we do not link to debug third party libraries. i'm embedding python (using visual studio) and run into
          the same problem. we now resort to undef'ing _DEBUG before including the python header files and everything works
          correctly. if you look in the python header files, you will see that when _DEBUG is defined, there is a #pragma to link
          to pythonXX_d.lib. when _DEBUG is not defined it will link to pythonXX.lib. other's may disagree about this approach,
          but so far it works well and we don't have any memory problems at all.

          for extensions using distutils here's another option which i prefer, since you can do this on a case-by-case basis
          instead of modifiying msvccompiler.py :

          add this line to setup in your setup.py file:

          extra_compile_a rgs = ['/Od /Z7'],
          extra_link_args = ['/DEBUG'],

          since these options will be placed after the compile/link options that distutils uses, these options will be used,
          overriding the options in msvccompiler.py .

          bryan


          Comment

          • Robert Ferrell

            #6
            Re: Python debug libraries

            <quote who="Trent Mick">[color=blue]
            > [Robert Ferrell wrote][color=green]
            >> I'm trying to do some debugging of python extensions on Windows2K. MS
            >> Visual Studio (.NET) says it can't find the debug version of the
            >> python libraries. (The message is "python.exe does not contain any
            >> debugging information".) I installed the binaries from the Windows
            >> installer. How should I get the debug libraries? Or is that even
            >> what I need? I'm kind of new to Windows, and Visual Studio in
            >> particular, so maybe I'm way off base.[/color]
            >
            > If you are using the ActivePython distribution the debug libraries are
            > made available in a separate package here:
            > ftp://ftp.activestate.com/ActivePython/etc/
            >
            > For example the debug libs for ActivePython 2.3.2 are:
            > ActivePython-2.3.2-230-win32-ix86.debug.zip[/color]

            I haven't been using ActivePython because I've been using the Enthought
            distribution, which includes all the SciPy stuff. Is there any reason
            these should be mutally exclusive (they are the same Python version)? Can
            I just install ActivePython overtop of another Python distribution?

            thanks,
            -robert



            Comment

            • Trent Mick

              #7
              Re: Python debug libraries

              > I haven't been using ActivePython because I've been using the Enthought[color=blue]
              > distribution, which includes all the SciPy stuff. Is there any reason
              > these should be mutally exclusive (they are the same Python version)? Can
              > I just install ActivePython overtop of another Python distribution?[/color]

              You could _try_. :) No guarantees because we certainly don't test that.
              ActivePython is fully binary compatible with python.org's Python and I
              would presume with Enthought's distro as well, so it should basically
              work. You might run into trouble when you start trying to uninstall
              everything, though.

              Trent

              --
              Trent Mick
              TrentM@ActiveSt ate.com

              Comment

              • Robert Ferrell

                #8
                Re: Python debug libraries

                <quote who="Trent Mick">[color=blue]
                > [Robert Ferrell wrote][color=green]
                >> I'm trying to do some debugging of python extensions on Windows2K. MS
                >> Visual Studio (.NET) says it can't find the debug version of the
                >> python libraries. (The message is "python.exe does not contain any
                >> debugging information".) I installed the binaries from the Windows
                >> installer. How should I get the debug libraries? Or is that even
                >> what I need? I'm kind of new to Windows, and Visual Studio in
                >> particular, so maybe I'm way off base.[/color]
                >
                > If you are using the ActivePython distribution the debug libraries are
                > made available in a separate package here:
                > ftp://ftp.activestate.com/ActivePython/etc/
                >
                > For example the debug libs for ActivePython 2.3.2 are:
                > ActivePython-2.3.2-230-win32-ix86.debug.zip[/color]

                Okay, I installed ActivePython and the debug libraries. I'm also using
                ActiveState's Visual Python. I have a Python driver script which calls
                into my Python extension (written in C). How do I get the debugger to
                break in the Python script, and then later in my C code? I can get it to
                do one or the other by changing which is the "Startup Project". But when
                I'm debugging I really need both.

                Thanks,
                -robert



                Comment

                • Robert Ferrell

                  #9
                  Re: Python debug libraries

                  <quote who="Mike C. Fletcher">[color=blue]
                  > See my recent post...
                  >
                  > http://groups.google.ca/groups?q=deb...hon.org&rnum=2
                  >
                  > (all one line). You probably don't want to debug *everything*, just
                  > your particular extension, and this recipe allows that fairly readily
                  > w/out requiring getting every single dependency built against debug
                  > Python (which can be a royal PITA).
                  >[/color]

                  I read the post, thanks. Now I have a very novice question. When is
                  msvccompiler.py used? If I'm building my Python extensions in a MS Visual
                  Studio project, is that script used?

                  thanks,
                  -robert



                  Comment

                  • Trent Mick

                    #10
                    Re: Python debug libraries

                    [Robert Ferrell wrote][color=blue]
                    > I read the post, thanks. Now I have a very novice question. When is
                    > msvccompiler.py used? If I'm building my Python extensions in a MS Visual
                    > Studio project, is that script used?[/color]

                    I am no expert on distutils but that module is a part of the distutils
                    and is called by the distutils framework _iff you are using distuils to
                    build your Python extension_.



                    Trent

                    --
                    Trent Mick
                    TrentM@ActiveSt ate.com

                    Comment

                    Working...