Help needed GDB

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Help needed GDB

Amardeep Singh
Hi All,

I am trying to debug c code of numpy via gdb.Can someone help me with this?
i am getting " Python scripting is not supported in this copy of GDB". How to install python supported gdb on win10?



I am following the steps in the docs. machine is windows 10.

Debugging

Another frequently asked question is “How do I debug C code inside NumPy?”. First, ensure that you have gdb installed on your system with the Python extensions (often the default on Linux). You can see which version of Python is running inside gdb to verify your setup:

(gdb) python
>import sys
>print(sys.version_info)
>end
sys.version_info(major=3, minor=7, micro=0, releaselevel='final', serial=0)



$ gdb -v
GNU gdb (GDB) 7.6.1
This GDB was configured as "mingw32".

$ gdb
(gdb) python
>import sys
>print(sys.version_info)
>end
(gdb) Python scripting is not supported in this copy of GDB.

_______________________________________________
NumPy-Discussion mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: Help needed GDB

Amardeep Singh
Hi All,

I was able to fix it but one thing i am not getting.
it is building with python 2.

I need python 3  enabled gdb.

./configure --with-python.  --> how to make it to use python 3 installed on my machine?

thx




On Tue, Dec 29, 2020 at 1:55 PM Amardeep Singh <[hidden email]> wrote:
Hi All,

I am trying to debug c code of numpy via gdb.Can someone help me with this?
i am getting " Python scripting is not supported in this copy of GDB". How to install python supported gdb on win10?



I am following the steps in the docs. machine is windows 10.

Debugging

Another frequently asked question is “How do I debug C code inside NumPy?”. First, ensure that you have gdb installed on your system with the Python extensions (often the default on Linux). You can see which version of Python is running inside gdb to verify your setup:

(gdb) python
>import sys
>print(sys.version_info)
>end
sys.version_info(major=3, minor=7, micro=0, releaselevel='final', serial=0)



$ gdb -v
GNU gdb (GDB) 7.6.1
This GDB was configured as "mingw32".

$ gdb
(gdb) python
>import sys
>print(sys.version_info)
>end
(gdb) Python scripting is not supported in this copy of GDB.

_______________________________________________
NumPy-Discussion mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: Help needed GDB

Amardeep Singh
Hi All

when i. try to use python3 installed on my macbook i get this.

checking for libmpfr... no

configure: WARNING: MPFR is missing or unusable; some features may be unavailable.

checking whether to use python... /usr/local/bin/python3

checking for python... no

configure: error: no usable python found at /usr/local/bin/python3



These are the commands i ran 


1) /Users/amardeepsingh/Downloads/gdb-9.2/configure --with-python=/usr/local/bin/python3


2) make




my mac


 % which python3                                                                        

/Library/Frameworks/Python.framework/Versions/3.9/bin/python3

% ls -lrt /usr/local/bin/python3

lrwxr-xr-x  1 root  wheel  69 Dec 29 14:37 /usr/local/bin/python3 -> ../../../Library/Frameworks/Python.framework/Versions/3.9/bin/python3

 






On Tue, Dec 29, 2020 at 4:04 PM Amardeep Singh <[hidden email]> wrote:
Hi All,

I was able to fix it but one thing i am not getting.
it is building with python 2.

I need python 3  enabled gdb.

./configure --with-python.  --> how to make it to use python 3 installed on my machine?

thx




On Tue, Dec 29, 2020 at 1:55 PM Amardeep Singh <[hidden email]> wrote:
Hi All,

I am trying to debug c code of numpy via gdb.Can someone help me with this?
i am getting " Python scripting is not supported in this copy of GDB". How to install python supported gdb on win10?



I am following the steps in the docs. machine is windows 10.

Debugging

Another frequently asked question is “How do I debug C code inside NumPy?”. First, ensure that you have gdb installed on your system with the Python extensions (often the default on Linux). You can see which version of Python is running inside gdb to verify your setup:

(gdb) python
>import sys
>print(sys.version_info)
>end
sys.version_info(major=3, minor=7, micro=0, releaselevel='final', serial=0)



$ gdb -v
GNU gdb (GDB) 7.6.1
This GDB was configured as "mingw32".

$ gdb
(gdb) python
>import sys
>print(sys.version_info)
>end
(gdb) Python scripting is not supported in this copy of GDB.

_______________________________________________
NumPy-Discussion mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: Help needed GDB

Amardeep Singh
Hi All

I was able to fix.

>import sys

>print(sys.version_info)

>end

sys.version_info(major=3, minor=9, micro=1, releaselevel='final', serial=0)

(gdb) quit




https://github.com/crosstool-ng/crosstool-ng/issues/1308


 this was the issue.


The solution is to open /gdb/python/python-config.py and comment out these two lines:

 if getvar('LINKFORSHARED') is not None:
  libs.extend(getvar('LINKFORSHARED').split())









On Tue, Dec 29, 2020 at 4:27 PM Amardeep Singh <[hidden email]> wrote:
Hi All

when i. try to use python3 installed on my macbook i get this.

checking for libmpfr... no

configure: WARNING: MPFR is missing or unusable; some features may be unavailable.

checking whether to use python... /usr/local/bin/python3

checking for python... no

configure: error: no usable python found at /usr/local/bin/python3



These are the commands i ran 


1) /Users/amardeepsingh/Downloads/gdb-9.2/configure --with-python=/usr/local/bin/python3


2) make




my mac


 % which python3                                                                        

/Library/Frameworks/Python.framework/Versions/3.9/bin/python3

% ls -lrt /usr/local/bin/python3

lrwxr-xr-x  1 root  wheel  69 Dec 29 14:37 /usr/local/bin/python3 -> ../../../Library/Frameworks/Python.framework/Versions/3.9/bin/python3

 






On Tue, Dec 29, 2020 at 4:04 PM Amardeep Singh <[hidden email]> wrote:
Hi All,

I was able to fix it but one thing i am not getting.
it is building with python 2.

I need python 3  enabled gdb.

./configure --with-python.  --> how to make it to use python 3 installed on my machine?

thx




On Tue, Dec 29, 2020 at 1:55 PM Amardeep Singh <[hidden email]> wrote:
Hi All,

I am trying to debug c code of numpy via gdb.Can someone help me with this?
i am getting " Python scripting is not supported in this copy of GDB". How to install python supported gdb on win10?



I am following the steps in the docs. machine is windows 10.

Debugging

Another frequently asked question is “How do I debug C code inside NumPy?”. First, ensure that you have gdb installed on your system with the Python extensions (often the default on Linux). You can see which version of Python is running inside gdb to verify your setup:

(gdb) python
>import sys
>print(sys.version_info)
>end
sys.version_info(major=3, minor=7, micro=0, releaselevel='final', serial=0)



$ gdb -v
GNU gdb (GDB) 7.6.1
This GDB was configured as "mingw32".

$ gdb
(gdb) python
>import sys
>print(sys.version_info)
>end
(gdb) Python scripting is not supported in this copy of GDB.

_______________________________________________
NumPy-Discussion mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: Help needed GDB

Amardeep Singh
Hi Apologies

Once last issue is pending.Any pointers are helpful.

I am following the below docs.



Next you need to write a Python script that invokes the C code whose execution you want to debug. For instance mytest.py:

import numpy as np
x = np.arange(5)
np.empty_like(x)

Now, you can run:

$ gdb --args python runtests.py -g --python mytest.py

And then in the debugger:

(gdb) break array_empty_like
(gdb) run.  --> once i type run and enter nothing happens it just gets struck up there.

Make breakpoint pending on future shared library load? (y or [n]) y

Breakpoint 1 (array_empty_like) pending.

(gdb) run

Starting program: /usr/bin/python mytest.py

[New Thread 0x1e03 of process 16513]

[New Thread 0x2303 of process 16513]




thx



On Tue, Dec 29, 2020 at 9:38 PM Amardeep Singh <[hidden email]> wrote:
Hi All

I was able to fix.

>import sys

>print(sys.version_info)

>end

sys.version_info(major=3, minor=9, micro=1, releaselevel='final', serial=0)

(gdb) quit




https://github.com/crosstool-ng/crosstool-ng/issues/1308


 this was the issue.


The solution is to open /gdb/python/python-config.py and comment out these two lines:

 if getvar('LINKFORSHARED') is not None:
  libs.extend(getvar('LINKFORSHARED').split())









On Tue, Dec 29, 2020 at 4:27 PM Amardeep Singh <[hidden email]> wrote:
Hi All

when i. try to use python3 installed on my macbook i get this.

checking for libmpfr... no

configure: WARNING: MPFR is missing or unusable; some features may be unavailable.

checking whether to use python... /usr/local/bin/python3

checking for python... no

configure: error: no usable python found at /usr/local/bin/python3



These are the commands i ran 


1) /Users/amardeepsingh/Downloads/gdb-9.2/configure --with-python=/usr/local/bin/python3


2) make




my mac


 % which python3                                                                        

/Library/Frameworks/Python.framework/Versions/3.9/bin/python3

% ls -lrt /usr/local/bin/python3

lrwxr-xr-x  1 root  wheel  69 Dec 29 14:37 /usr/local/bin/python3 -> ../../../Library/Frameworks/Python.framework/Versions/3.9/bin/python3

 






On Tue, Dec 29, 2020 at 4:04 PM Amardeep Singh <[hidden email]> wrote:
Hi All,

I was able to fix it but one thing i am not getting.
it is building with python 2.

I need python 3  enabled gdb.

./configure --with-python.  --> how to make it to use python 3 installed on my machine?

thx




On Tue, Dec 29, 2020 at 1:55 PM Amardeep Singh <[hidden email]> wrote:
Hi All,

I am trying to debug c code of numpy via gdb.Can someone help me with this?
i am getting " Python scripting is not supported in this copy of GDB". How to install python supported gdb on win10?



I am following the steps in the docs. machine is windows 10.

Debugging

Another frequently asked question is “How do I debug C code inside NumPy?”. First, ensure that you have gdb installed on your system with the Python extensions (often the default on Linux). You can see which version of Python is running inside gdb to verify your setup:

(gdb) python
>import sys
>print(sys.version_info)
>end
sys.version_info(major=3, minor=7, micro=0, releaselevel='final', serial=0)



$ gdb -v
GNU gdb (GDB) 7.6.1
This GDB was configured as "mingw32".

$ gdb
(gdb) python
>import sys
>print(sys.version_info)
>end
(gdb) Python scripting is not supported in this copy of GDB.

_______________________________________________
NumPy-Discussion mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/numpy-discussion