Select the innermost frame with the given function name.
(self, func_name)
| 147 | return out.strip() |
| 148 | |
| 149 | def select_frame(self, func_name): |
| 150 | """ |
| 151 | Select the innermost frame with the given function name. |
| 152 | """ |
| 153 | # Ideally, we would use the "frame function" command, |
| 154 | # but it's not available on old GDB versions (such as 8.1.1), |
| 155 | # so instead parse the stack trace for a matching frame number. |
| 156 | out = self.run_command("info stack") |
| 157 | pat = r"(?mi)^#(\d+)\s+.* in " + re.escape(func_name) + r"\b" |
| 158 | m = re.search(pat, out) |
| 159 | if m is None: |
| 160 | pytest.fail(f"Could not select frame for function {func_name}") |
| 161 | |
| 162 | frame_num = int(m[1]) |
| 163 | out = self.run_command(f"frame {frame_num}") |
| 164 | assert f"in {func_name}" in out |
| 165 | |
| 166 | def join(self): |
| 167 | if self.proc is not None: |
no test coverage detected