File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -531,6 +531,7 @@ def _index_functions(prog: drgn.Program) -> t.Dict[str, t.Set[int]]:
531531def _indexed_bt_has_any (
532532 prog : drgn .Program ,
533533 funcs : t .List [str ],
534+ one_per_task : bool = False ,
534535) -> t .List [t .Tuple [drgn .Object , drgn .StackFrame ]]:
535536 index = prog .cache .get ("drgn_tools.bt._index_functions" )
536537 if index is None :
@@ -547,13 +548,17 @@ def _indexed_bt_has_any(
547548 name = func_name (prog , frame )
548549 if name in funcs :
549550 result .append ((task , frame ))
551+ if one_per_task :
552+ # don't return any more results for this task
553+ break
550554 return result
551555
552556
553557def bt_has_any (
554558 prog : drgn .Program ,
555559 funcs : t .List [str ],
556560 task : t .Optional [drgn .Object ] = None ,
561+ one_per_task : bool = False ,
557562) -> t .List [t .Tuple [drgn .Object , drgn .StackFrame ]]:
558563 """
559564 Search for tasks whose stack contains the given functions
@@ -585,6 +590,8 @@ def bt_has_any(
585590 for frame in frames :
586591 if func_name (prog , frame ) in funcs :
587592 frame_list .append ((task , frame ))
593+ if one_per_task :
594+ break
588595 except (FaultError , ValueError ):
589596 # FaultError: catch unusual unwinding issues
590597 # ValueError: catch "cannot unwind stack of running task"
You can’t perform that action at this time.
0 commit comments