Skip to content

Commit 2e762fd

Browse files
authored
Update location.rst
1 parent 1d26465 commit 2e762fd

1 file changed

Lines changed: 25 additions & 27 deletions

File tree

docs/syntax/location.rst

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
Syntax for Source-Code Locations
55
================================
66

7-
A number of commands like "break", and "list" have locations
7+
Several commands like "break" and "list" have locations
88
embedded in them.
99

10-
A location can be either a *linespec* an explicit function, or a *module linespec*
10+
A location can be either a *linespec*, an explicit function, or a *module linespec*
1111

1212

1313
Linespec
@@ -18,52 +18,50 @@ A linespec has a colon-separated pair of a source-location parameter
1818
and a line number. A source location is a file path or a module name.
1919

2020
In [*path*:] *linenum* , the line *linenum* in the source file *path*
21-
is indicated. When *path* is omitted, some default value is given,
22-
usually it is the *path* associated with the current frame. Or in
23-
list-like commands it is the *path* what was most-recently set; the
24-
most-recently set path starts out as the current frame's path.
21+
is indicated. When *path* is omitted, some default value is given; usually it is the *path* associated with the current frame. Or in
22+
list-like commands, it is the *path* that was most recently set; the
23+
most-recently set path starts as the current frame's path.
2524

2625
If *filename* is a relative file name, then Python's `sys.path` items
27-
(which are assumed to be a list of directories) is tried in the order
28-
given. Often the current working directory or `.` is in that
29-
list. Note that `.` can be set with `cd` debugger command.
26+
(which are assumed to be a list of directories) are tried in the order
27+
given. Often, the current working directory or `.` is in that
28+
list. Note that `.` can be set with the `cd` debugger command.
3029

3130
To specify a path containing non-alphanumeric characters, specifically
32-
blanks (" "), backslashes ("\"), or quotes, in there are a number of
31+
blanks (" "), backslashes ("\"), or quotes, there are several
3332
quoting mechanisms one can use. You can enclose the path in single
34-
quotes, double quotes or triple double as you would do in Python
33+
quotes, double quotes, or triple quotes as you would do in Python
3534

3635
Location Examples
3736
+++++++++++++++++
3837

3938
::
4039

4140
10 # line 10 of the most-recently used path
42-
myfile.py:2 # line 2 of myfile.py where the directory name is
41+
myfile.py:2 # line 2 of myfile.py, where the directory name is
4342
#resolved from `sys.path`
4443
./../myfile.py:3 # line 3 of the parent of some directory in `sys.path`
4544
/tmp/foo.py:4 # line 4 of absolute path /tmp/foo.py
4645
"foo's.py":1" # One way to specify a path with a quote
4746
'''foo's.py"''':2 # Another way to specify a path with a quote
4847
'c:\foo.bat':1" # One way to specify a Windows file name,
49-
'/My Docs/foo.py':1" # One way to specify path with blanks in it
48+
'/My Docs/foo.py':1" # One way to specify a path with blanks in it
5049

5150

5251

5352
function()
5453
----------
5554

56-
Specifies the line that function *function* starts on. This is the
55+
Specifies the line that the function *function* starts on. This is the
5756
line that contains `def`. We get this information from the Python code
5857
object, in particular the `co_firstlineno` field.
59-
60-
contrast to *gdb*, use parenthesis at the end of the function name
58+
In contrast to *gdb*, use parentheses at the end of the function name
6159
to indicate this is a function.
6260

63-
You can also specify functions though the values in Python program
61+
You can also specify functions through the values in a Python program
6462
variables or the function indicated in an instance method.
6563

66-
For example consider this program:
64+
For example, consider this program:
6765

6866
::
6967

@@ -90,21 +88,21 @@ means `b[i+1]()` would be invalid because it contains "+". So would
9088
`b["foo"]()`, assuming `b` were a dictionary, because of the quote
9189
symbol.
9290

93-
*Right now we don't allow line offsets from functions. If the need
94-
arises we may do so in the future.*
91+
*Right now, we don't allow line offsets from functions. If the need
92+
arises, we may do so in the future.*
9593

9694
module linespec
9795
---------------
9896

9997
While functions need a closing `()` to indicate their function-ness,
10098
Python module names don't. What we do here is first look up the name
101-
as a file path. If that's not found we look up the file as a Python
102-
module name. Modules have to have been imported before it accepted in
103-
the debugger. However you can run `eval` (or `autoeval`) to have
104-
Python import the module inside the debugger.
99+
as a file path. If that's not found, we look up the file as a Python
100+
module name. Modules have to have been imported before it is accepted in
101+
the debugger. However, you can run `eval` (or `autoeval`) to have
102+
Python ``1mport`` the module inside the debugger.
105103

106-
In sum file names are distinguished from method names purely by
107-
semantic means. However *gdb* and thus this debugger has no means to
104+
In sum, file names are distinguished from method names purely by
105+
semantic means. However, *gdb* and thus this debugger have no means to
108106
explicitly tag names as a file path or Python module name. We, but not
109107
*gdb*, make a distinction between functions versus modules and file
110108
paths.
@@ -119,6 +117,6 @@ Linespec Examples
119117
os # Invalid! (for now)
120118

121119
Note that the last line is invalid. In contrast to functions, you need
122-
to give a line numbers. Also it is assumed there is not a *file*
120+
to give line numbers. Also, it is assumed there is no *file*
123121
called `os` in the last example line. Nor a file called `os.path` in
124122
the first example.

0 commit comments

Comments
 (0)