MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / remove_breakpoint

Method remove_breakpoint

_pydevd_bundle/pydevd_api.py:693–757  ·  view source on GitHub ↗

:param str received_filename: Note: must be sent as it was received in the protocol. It may be translated in this function. :param str breakpoint_type: One of: 'python-line', 'django-line', 'jinja2-line'. :param int breakpoint_id:

(self, py_db, received_filename, breakpoint_type, breakpoint_id)

Source from the content-addressed store, hash-verified

691 py_db.on_breakpoints_changed(removed=True)
692
693 def remove_breakpoint(self, py_db, received_filename, breakpoint_type, breakpoint_id):
694 """
695 :param str received_filename:
696 Note: must be sent as it was received in the protocol. It may be translated in this
697 function.
698
699 :param str breakpoint_type:
700 One of: 'python-line', 'django-line', 'jinja2-line'.
701
702 :param int breakpoint_id:
703 """
704 received_filename_normalized = pydevd_file_utils.normcase_from_client(received_filename)
705 for key, val in list(py_db.api_received_breakpoints.items()):
706 original_filename_normalized, existing_breakpoint_id = key
707 _new_filename, _api_add_breakpoint_params = val
708 if received_filename_normalized == original_filename_normalized and existing_breakpoint_id == breakpoint_id:
709 del py_db.api_received_breakpoints[key]
710 break
711 else:
712 pydev_log.info("Did not find breakpoint to remove: %s (breakpoint id: %s)", received_filename, breakpoint_id)
713
714 file_to_id_to_breakpoint = None
715 received_filename = self.filename_to_server(received_filename)
716 canonical_normalized_filename = pydevd_file_utils.canonical_normalized_path(received_filename)
717
718 if breakpoint_type == "python-line":
719 file_to_line_to_breakpoints = py_db.breakpoints
720 file_to_id_to_breakpoint = py_db.file_to_id_to_line_breakpoint
721
722 elif py_db.plugin is not None:
723 result = py_db.plugin.get_breakpoints(py_db, breakpoint_type)
724 if result is not None:
725 file_to_id_to_breakpoint = py_db.file_to_id_to_plugin_breakpoint
726 file_to_line_to_breakpoints = result
727
728 if file_to_id_to_breakpoint is None:
729 pydev_log.critical("Error removing breakpoint. Cannot handle breakpoint of type %s", breakpoint_type)
730
731 else:
732 try:
733 id_to_pybreakpoint = file_to_id_to_breakpoint.get(canonical_normalized_filename, {})
734 if DebugInfoHolder.DEBUG_TRACE_LEVEL >= 1:
735 existing = id_to_pybreakpoint[breakpoint_id]
736 pydev_log.info(
737 "Removed breakpoint:%s - line:%s - func_name:%s (id: %s)\n"
738 % (canonical_normalized_filename, existing.line, existing.func_name, breakpoint_id)
739 )
740
741 del id_to_pybreakpoint[breakpoint_id]
742 py_db.consolidate_breakpoints(canonical_normalized_filename, id_to_pybreakpoint, file_to_line_to_breakpoints)
743 if py_db.plugin is not None:
744 py_db.has_plugin_line_breaks = py_db.plugin.has_line_breaks(py_db)
745 py_db.plugin.after_breakpoints_consolidated(
746 py_db, canonical_normalized_filename, id_to_pybreakpoint, file_to_line_to_breakpoints
747 )
748
749 except KeyError:
750 pydev_log.info(

Callers 1

cmd_remove_breakMethod · 0.80

Calls 9

filename_to_serverMethod · 0.95
itemsMethod · 0.80
infoMethod · 0.80
get_breakpointsMethod · 0.80
has_line_breaksMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected