From c82f680a94399a0f1c9fdc53ed79a8cf333213a6 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Tue, 19 Oct 2021 23:50:50 +0200 Subject: [gdb/testsuite] Reimplement gdb.gdb/python-interrupts.exp as unittest The test-case gdb.gdb/python-interrupts.exp: - runs to captured_command_loop - sets a breakpoint at set_active_ext_lang - calls a python command - verifies the command triggers the breakpoint - sends a signal and verifies the result The test-case is fragile, because (f.i. with -flto) it cannot be guaranteed that captured_command_loop and set_active_ext_lang are available for setting breakpoints. Reimplement the test-case as unittest, using: - execute_command_to_string to capture the output - try/catch to catch the "Error while executing Python code" exception - a new hook selftests::hook_set_active_ext_lang to raise the signal Tested on x86_64-linux. --- gdb/extension.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gdb/extension.h') diff --git a/gdb/extension.h b/gdb/extension.h index 56f5756..2f2ca3e 100644 --- a/gdb/extension.h +++ b/gdb/extension.h @@ -319,4 +319,10 @@ extern void get_matching_xmethod_workers extern gdb::optional ext_lang_colorize (const std::string &filename, const std::string &contents); +#if GDB_SELF_TEST +namespace selftests { +extern void (*hook_set_active_ext_lang) (); +} +#endif + #endif /* EXTENSION_H */ -- cgit v1.1