]>
git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.dap/stack-format.py
1 # Copyright (C) 2023-2024 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 from gdb
.FrameDecorator
import DAPFrameDecorator
23 class ElidingFrameDecorator(DAPFrameDecorator
):
24 def __init__(self
, frame
, elided_frames
):
25 super(ElidingFrameDecorator
, self
).__init
__(frame
)
26 self
.elided_frames
= elided_frames
29 return iter(self
.elided_frames
)
32 class ElidingIterator
:
33 def __init__(self
, ii
):
34 self
.input_iterator
= ii
40 frame
= next(self
.input_iterator
)
41 if str(frame
.function()) != "function":
44 # Elide the next three frames.
46 elided
.append(next(self
.input_iterator
))
47 elided
.append(next(self
.input_iterator
))
48 elided
.append(next(self
.input_iterator
))
50 return ElidingFrameDecorator(frame
, elided
)
58 gdb
.frame_filters
[self
.name
] = self
60 def filter(self
, frame_iter
):
61 return ElidingIterator(frame_iter
)