Skip to content

Commit

Permalink
wip - django templates
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed Nov 27, 2023
1 parent 435bbe3 commit 9431fea
Show file tree
Hide file tree
Showing 10 changed files with 263 additions and 87 deletions.
3 changes: 3 additions & 0 deletions _pydevd_bundle/pydevd_frame_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def __init__(self, name, filename):
self.co_firstlineno = 1
self.co_flags = 0

def co_lines(self):
return ()


def add_exception_to_frame(frame, exception_info):
frame.f_locals['__exception__'] = exception_info
Expand Down
10 changes: 5 additions & 5 deletions _pydevd_bundle/pydevd_net_command_factory_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def make_thread_suspend_str(
frames_list,
stop_reason=None,
message=None,
suspend_type="trace",
trace_suspend_type="trace",
):
"""
:return tuple(str,str):
Expand Down Expand Up @@ -273,19 +273,19 @@ def make_thread_suspend_str(
append(' stop_reason="%s"' % (stop_reason,))
if message is not None:
append(' message="%s"' % (message,))
if suspend_type is not None:
append(' suspend_type="%s"' % (suspend_type,))
if trace_suspend_type is not None:
append(' trace_suspend_type="%s"' % (trace_suspend_type,))
append('>')
thread_stack_str = self.make_thread_stack_str(py_db, frames_list)
append(thread_stack_str)
append("</thread></xml>")

return ''.join(cmd_text_list), thread_stack_str

def make_thread_suspend_message(self, py_db, thread_id, frames_list, stop_reason, message, suspend_type):
def make_thread_suspend_message(self, py_db, thread_id, frames_list, stop_reason, message, trace_suspend_type):
try:
thread_suspend_str, thread_stack_str = self.make_thread_suspend_str(
py_db, thread_id, frames_list, stop_reason, message, suspend_type)
py_db, thread_id, frames_list, stop_reason, message, trace_suspend_type)
cmd = NetCommand(CMD_THREAD_SUSPEND, 0, thread_suspend_str)
cmd.thread_stack_str = thread_stack_str
cmd.thread_suspend_str = thread_suspend_str
Expand Down
31 changes: 28 additions & 3 deletions _pydevd_bundle/pydevd_plugin_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import types

from _pydev_bundle import pydev_log
from typing import Tuple, Literal
try:
from pydevd_plugins import django_debug
except:
Expand Down Expand Up @@ -98,19 +99,43 @@ def can_skip(self, py_db, frame):
return False
return True

def has_exception_breaks(self, py_db):
def required_events_breakpoint(self) -> Tuple[Literal['line', 'call'], ...]:
ret = ()
for plugin in self.active_plugins:
new = plugin.required_events_breakpoint()
if new:
ret += new

return ret

def required_events_stepping(self) -> Tuple[Literal['line', 'call', 'return'], ...]:
ret = ()
for plugin in self.active_plugins:
new = plugin.required_events_stepping()
if new:
ret += new

return ret

def is_tracked_frame(self, frame) -> bool:
for plugin in self.active_plugins:
if plugin.is_tracked_frame(frame):
return True
return False

def has_exception_breaks(self, py_db) -> bool:
for plugin in self.active_plugins:
if plugin.has_exception_breaks(py_db):
return True
return False

def has_line_breaks(self, py_db):
def has_line_breaks(self, py_db) -> bool:
for plugin in self.active_plugins:
if plugin.has_line_breaks(py_db):
return True
return False

def cmd_step_into(self, py_db, frame, event, info, thread, stop_info, stop):
def cmd_step_into(self, py_db, frame, event, info, thread, stop_info, stop: bool):
'''
:param stop_info: in/out information. If it should stop then it'll be
filled by the plugin.
Expand Down
4 changes: 2 additions & 2 deletions _pydevd_bundle/pydevd_suspended_frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,13 +433,13 @@ def find_frame(self, thread_id, frame_id):
with self._lock:
return self._frame_id_to_frame.get(frame_id)

def create_thread_suspend_command(self, thread_id, stop_reason, message, suspend_type):
def create_thread_suspend_command(self, thread_id, stop_reason, message, trace_suspend_type):
with self._lock:
# First one is topmost frame suspended.
frames_list = self._thread_id_to_frames_list[thread_id]

cmd = self.py_db.cmd_factory.make_thread_suspend_message(
self.py_db, thread_id, frames_list, stop_reason, message, suspend_type)
self.py_db, thread_id, frames_list, stop_reason, message, trace_suspend_type)

frames_list = None
return cmd
Expand Down
Loading

0 comments on commit 9431fea

Please sign in to comment.