summaryrefslogtreecommitdiff
path: root/doc/source/dev
diff options
context:
space:
mode:
authorChunlin <fangchunlin@huawei.com>2020-05-13 13:54:33 +0800
committerGitHub <noreply@github.com>2020-05-13 08:54:33 +0300
commit5294c82afa7d5f20152ee5b0d1406a909b735307 (patch)
tree6f52a3df8c773f8c86b702c5af51559be4227d45 /doc/source/dev
parent0a222b87ab733955f34719a79c0dcb44a830a31f (diff)
downloadnumpy-5294c82afa7d5f20152ee5b0d1406a909b735307.tar.gz
DOC: improve development debugging doc (#16083)
* improve development debugging doc Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Diffstat (limited to 'doc/source/dev')
-rw-r--r--doc/source/dev/development_environment.rst26
-rw-r--r--doc/source/dev/development_workflow.rst2
2 files changed, 21 insertions, 7 deletions
diff --git a/doc/source/dev/development_environment.rst b/doc/source/dev/development_environment.rst
index 1f404d6e0..ff78cecc5 100644
--- a/doc/source/dev/development_environment.rst
+++ b/doc/source/dev/development_environment.rst
@@ -211,10 +211,20 @@ Debugging
---------
Another frequently asked question is "How do I debug C code inside NumPy?".
-The easiest way to do this is to first write a Python script that invokes the C
-code whose execution you want to debug. For instance ``mytest.py``::
+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::
- from numpy import linspace
+ (gdb) python
+ >import sys
+ >print(sys.version_info)
+ >end
+ sys.version_info(major=3, minor=7, micro=0, releaselevel='final', serial=0)
+
+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)
@@ -228,10 +238,14 @@ And then in the debugger::
(gdb) run
The execution will now stop at the corresponding C function and you can step
-through it as usual. With the Python extensions for gdb installed (often the
-default on Linux), a number of useful Python-specific commands are available.
+through it as usual. A number of useful Python-specific commands are available.
For example to see where in the Python code you are, use ``py-list``. For more
-details, see `DebuggingWithGdb`_.
+details, see `DebuggingWithGdb`_. Here are some commonly used commands:
+
+ - ``list``: List specified function or line.
+ - ``next``: Step program, proceeding through subroutine calls.
+ - ``step``: Continue program being debugged, after signal or breakpoint.
+ - ``print``: Print value of expression EXP.
Instead of plain ``gdb`` you can of course use your favourite
alternative debugger; run it on the python binary with arguments
diff --git a/doc/source/dev/development_workflow.rst b/doc/source/dev/development_workflow.rst
index 9f2ecede6..2ad764a78 100644
--- a/doc/source/dev/development_workflow.rst
+++ b/doc/source/dev/development_workflow.rst
@@ -26,7 +26,7 @@ In short:
- *Contributors*: push your feature branch to your own Github repo, and
:ref:`create a pull request <asking-for-merging>`.
- - *Core developers* If you want to push changes without
+ - *Core developers*: If you want to push changes without
further review, see the notes :ref:`below <pushing-to-main>`.
This way of working helps to keep work well organized and the history