diff options
author | Tom de Vries <tdevries@suse.de> | 2021-10-19 23:50:50 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2021-10-19 23:50:50 +0200 |
commit | c82f680a94399a0f1c9fdc53ed79a8cf333213a6 (patch) | |
tree | 2f8984a012c205b65b357f93be8f5b02a9977dd5 /gdb/extension.h | |
parent | 5a8edb756a56cdfb563006cbc39561994acf6d2d (diff) | |
download | binutils-gdb-c82f680a94399a0f1c9fdc53ed79a8cf333213a6.tar.gz |
[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.
Diffstat (limited to 'gdb/extension.h')
-rw-r--r-- | gdb/extension.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/extension.h b/gdb/extension.h index 56f57560de3..2f2ca3e7743 100644 --- a/gdb/extension.h +++ b/gdb/extension.h @@ -319,4 +319,10 @@ extern void get_matching_xmethod_workers extern gdb::optional<std::string> 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 */ |