Skip to content
This repository was archived by the owner on Aug 28, 2020. It is now read-only.

Commit 7262e07

Browse files
committed
Merge pull request #151 from robertbasic/fix/issue122
Fix/issue122. Fixes #122
2 parents e688097 + 1e5ebaf commit 7262e07

File tree

3 files changed

+20
-40
lines changed

3 files changed

+20
-40
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- Do not jump to top of the file every time a debugging session starts
1313
- Updating settings now updates current project's settings as well
1414
- Deleting current project doesn't break pugdebug any more
15+
- Breakpoints do not dissapear any more when debugging multiple requests
1516

1617
### Removed
1718

pugdebug/pugdebug.py

Lines changed: 16 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
class Pugdebug(QObject):
2929

30-
init_breakpoints = []
3130
breakpoints = []
3231

3332
def __init__(self):
@@ -472,7 +471,7 @@ def start_listening(self):
472471

473472
start_debugging = True
474473

475-
if break_at_first_line == 0 and len(self.init_breakpoints) == 0:
474+
if break_at_first_line == 0 and len(self.breakpoints) == 0:
476475
messageBox = QMessageBox()
477476
messageBox.setText("There are no breakpoints set and the break at"
478477
" first line setting is turned off.")
@@ -525,7 +524,7 @@ def handle_debugging_started(self):
525524
return
526525

527526
post_start_data = {
528-
'init_breakpoints': self.init_breakpoints
527+
'breakpoints': self.breakpoints
529528
}
530529
self.debugger.post_start_command(post_start_data)
531530

@@ -563,12 +562,6 @@ def handle_debugging_stopped(self):
563562
This handler should be called when the connection to
564563
xdebug is terminated.
565564
"""
566-
# Only set breakpoints as init_breakpoints
567-
# if there are any breakpoints set
568-
if len(self.breakpoints) > 0:
569-
self.init_breakpoints = self.breakpoints
570-
self.breakpoints = []
571-
572565
self.main_window.toggle_actions(False)
573566

574567
self.main_window.set_debugging_status(2)
@@ -664,22 +657,22 @@ def set_breakpoint(self, breakpoint):
664657
"""Set a breakpoint
665658
666659
If there is no active debugging session, add the breakpoint data to
667-
the initial breakpoints, highlight the init breakpoints on the line
660+
the breakpoints, highlight the breakpoints on the line
668661
numbers of the documents, and show them in the breakpoint viewer.
669662
670663
If there is an active debugging session, tell the debugger to set the
671664
breakpoint.
672665
"""
673666
if not self.debugger.is_connected():
674-
self.init_breakpoints.append(breakpoint)
667+
self.breakpoints.append(breakpoint)
675668

676669
path = breakpoint['filename']
677670
path = self.__get_path_mapped_to_local(path)
678671

679672
document_widget = self.document_viewer.get_document_by_path(path)
680673
document_widget.rehighlight_breakpoint_lines()
681674

682-
self.breakpoint_viewer.set_breakpoints(self.init_breakpoints)
675+
self.breakpoint_viewer.set_breakpoints(self.breakpoints)
683676

684677
return
685678

@@ -689,7 +682,7 @@ def remove_breakpoint(self, breakpoint):
689682
"""Remove a breakpoint
690683
691684
If there is no active debugging session, just remove the breakpoint
692-
from the initial breakpoints, rehighlight the line numbers for
685+
from the breakpoints, rehighlight the line numbers for
693686
breakpoint markers and update the breakpoint viewer.
694687
695688
If there is an active debugging session, tell the debugger to remove
@@ -699,17 +692,17 @@ def remove_breakpoint(self, breakpoint):
699692
path = breakpoint['filename']
700693
line_number = breakpoint['lineno']
701694

702-
for init_breakpoint in self.init_breakpoints:
703-
if (init_breakpoint['filename'] == path and
704-
init_breakpoint['lineno'] == line_number):
705-
self.init_breakpoints.remove(init_breakpoint)
695+
for breakpoint in self.breakpoints:
696+
if (breakpoint['filename'] == path and
697+
breakpoint['lineno'] == line_number):
698+
self.breakpoints.remove(breakpoint)
706699

707700
path = self.__get_path_mapped_to_local(path)
708701

709702
document_widget = self.document_viewer.get_document_by_path(path)
710703
document_widget.rehighlight_breakpoint_lines()
711704

712-
self.breakpoint_viewer.set_breakpoints(self.init_breakpoints)
705+
self.breakpoint_viewer.set_breakpoints(self.breakpoints)
713706

714707
return
715708

@@ -727,20 +720,11 @@ def remove_stale_breakpoints(self, path):
727720
"""
728721
remote_path = self.__get_path_mapped_to_remote(path)
729722

730-
breakpoints = []
731-
732-
if self.debugger.is_connected():
733-
breakpoints = list(filter(
734-
lambda breakpoint: breakpoint['filename'] != remote_path,
735-
self.breakpoints
736-
))
737-
self.breakpoints = breakpoints
738-
else:
739-
breakpoints = list(filter(
740-
lambda breakpoint: breakpoint['filename'] != remote_path,
741-
self.init_breakpoints
742-
))
743-
self.init_breakpoints = breakpoints
723+
breakpoints = list(filter(
724+
lambda breakpoint: breakpoint['filename'] != remote_path,
725+
self.breakpoints
726+
))
727+
self.breakpoints = breakpoints
744728

745729
self.breakpoint_viewer.set_breakpoints(breakpoints)
746730

@@ -783,11 +767,6 @@ def get_breakpoint(self, path, line_number):
783767
int(breakpoint['lineno']) == line_number):
784768
return breakpoint
785769

786-
for breakpoint in self.init_breakpoints:
787-
if (breakpoint['filename'] == path and
788-
int(breakpoint['lineno']) == line_number):
789-
return breakpoint
790-
791770
return None
792771

793772
def handle_breakpoints_listed(self, breakpoints):

pugdebug/server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ def set_debugger_features(self):
295295
def __post_start(self, data):
296296
post_start_response = {
297297
'debugger_features': self.__set_debugger_features(),
298-
'init_breakpoints': self.__set_init_breakpoints(
299-
data['init_breakpoints']
298+
'breakpoints': self.__set_breakpoints(
299+
data['breakpoints']
300300
),
301301
'breakpoints': self.__list_breakpoints()
302302
}
@@ -376,7 +376,7 @@ def __get_stacktraces(self):
376376

377377
return stacktraces
378378

379-
def __set_init_breakpoints(self, breakpoints):
379+
def __set_breakpoints(self, breakpoints):
380380
all_successful = True
381381

382382
for breakpoint in breakpoints:

0 commit comments

Comments
 (0)