diff --git a/tests/commands/got.py b/tests/commands/got.py index c6c5e8807..c5f629b19 100644 --- a/tests/commands/got.py +++ b/tests/commands/got.py @@ -37,7 +37,25 @@ def test_cmd_got(self): self.assertNotIn("strcpy", res) self.assertNotIn("/libc", res) + def checksyms(lines): + if not lines: + return + if "format-string-helper.out" in lines[0]: + res = ''.join(lines) + self.assertIn("printf", res) + self.assertNotIn("strcpy", res) + if "/libc" in lines[0]: + res = ''.join(lines) + self.assertNotIn("printf", res) + self.assertNotIn("strcpy", res) + res = gdb.execute("got --all printf", to_string=True) self.assertIn("/libc", res) - self.assertIn("printf", res) - self.assertNotIn("strcpy", res) + self.assertIn("format-string-helper.out", res) + lines = [] + for line in res.splitlines(): + if line.startswith("─"): + checksyms(lines) + lines = [] + lines.append(line) + checksyms(lines)