Skip to content

Commit 5eb5aea

Browse files
committed
More to 1-origin columns conversion
1 parent 564663a commit 5eb5aea

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

test/data/highlight-310.right

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(gcd.py:1:0): <module>
1+
(gcd.py:1:1): <module>
22
-> 1 #!/usr/bin/env python3
33
Set basename is on.
44
Set event is on.

test/data/step-311.right

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
(gcd.py:1:0): <module>
1+
(gcd.py:1:1): <module>
22
-> 1 #!/usr/bin/env python3
33
Set basename is on.
44
Set event is on.
55
Set stopping is off.
66
Set confirmation is off.
77
line - gcd.py:2
8-
(gcd.py:2:0): <module>
8+
(gcd.py:2:1): <module>
99
-- 2 """Greatest Common Divisor
1010
2 -> """Greatest Common Divisor
1111
Set stopping is on.
1212
line - gcd.py:11
13-
(gcd.py:11:0): <module>
13+
(gcd.py:11:1): <module>
1414
-- 11 import sys
1515
11 -> import sys
1616
Set stopping is off.
1717
line - gcd.py:14
1818
line - gcd.py:29
1919
line - gcd.py:44
20-
(gcd.py:44:3): <module>
20+
(gcd.py:44:4): <module>
2121
-- 44 if __name__ == "__main__":
2222
44 -> if __name__ == "__main__":
2323
trepan3k: That's all, folks...

trepan/lib/breakpoint.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,17 @@ def __init__(
8686
if column_range:
8787
assert isinstance(column_range, tuple)
8888
start_line, self.column = column_range[0]
89+
# Python stores columns starting 0 in a line.
90+
# For realgud and lldb compatibility (among others),
91+
# we use columns starting at 1.
92+
self.column += 1
8993
assert start_line == line_number
9094
pass
9195
pass
9296
else:
9397
self.column = position
98+
# TODO: Figure out code offset.
9499
self.offset = None
95-
# Figure out code offset.
96-
if (code_info := code_position_cache.get(code)) is not None:
97-
self.column = code_info.lineno_and_start_column.get(
98-
(line_number, self.offset)
99-
)
100-
pass
101100

102101
self.condition = condition
103102
self.enabled = True

trepan/lib/stack.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ def get_column_start_from_code(code: CodeType, code_offset: int) -> int:
102102
position_tuple = position_list[instruction_number]
103103
if position_tuple is not None:
104104
if position_tuple[2] is not None:
105-
return position_tuple[2]
105+
# Python stores columns starting 0 in a line.
106+
# For realgud and lldb compatibility (among others),
107+
# we use columns starting at 1.
108+
return position_tuple[2] + 1
106109
return -1
107110

108111

0 commit comments

Comments
 (0)