mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Fix stack_trace_len
This commit is contained in:
parent
fcc292e736
commit
6ceee0a85f
2 changed files with 3 additions and 10 deletions
|
|
@ -290,7 +290,8 @@ class Adapter:
|
|||
if thread is None:
|
||||
raise request.isnt_valid(f'Unknown thread with "threadId":{thread_id}')
|
||||
|
||||
stop_frame = None if levels is None else start_frame + levels
|
||||
stop_frame = thread.stack_trace_len() if levels == () or levels == 0 else start_frame + levels
|
||||
log.info(f"stackTrace info {start_frame} {stop_frame}")
|
||||
frames = None
|
||||
try:
|
||||
frames = islice(thread.stack_trace(), start_frame, stop_frame)
|
||||
|
|
|
|||
|
|
@ -261,15 +261,7 @@ class Thread:
|
|||
"""
|
||||
Returns the total count of frames in this thread's stack.
|
||||
"""
|
||||
try:
|
||||
with _cvar:
|
||||
python_frame = self.current_frame
|
||||
except ValueError:
|
||||
raise ValueError(f"Can't get frames for inactive Thread({self.id})")
|
||||
try:
|
||||
return len(tuple(traceback.walk_stack(python_frame)))
|
||||
finally:
|
||||
del python_frame
|
||||
return len(list(self.stack_trace()))
|
||||
|
||||
def stack_trace(self) -> Iterable["StackFrame"]:
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue