This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
gdb python: how to async stop and restart remote target
- From: Salvatore Lionetti <salvatorelionetti at gmail dot com>
- To: gdb at sourceware dot org
- Date: Tue, 10 Jan 2017 17:49:23 +0100
- Subject: gdb python: how to async stop and restart remote target
- Authentication-results: sourceware.org; auth=none
Hi,
I'm trying to define and automatize test for a C/RTEMS application,
using gdb 7.11.1 with the lovely python extension.
I need to asynchronously stop the target remotely connected via TCP,
ex. to inject a fault or an input packet, then restarting the remote
system.
What is the preferred way to do it?
This is what I'm trying:
(EXAMPLE1)
gdb.execute('target remote ...')
gdb.execute('continue&')
time.sleep(2)
gdb.execute('interrupt')
The execution of "gdb --command ... --batch" leads to:
...
Cannot execute this command while the target is running.
Use the 'interrupt' command to stop the target and try again.
That is related to the last line with the 'interrupt' command.
The remote target is stopped. After that reading from target memory
leads to the same error.
(EXAMPLE2)
gdb.execute('target remote ...')
gdb.execute('continue&')
time.sleep(2)
gdb.execute('interrupt')
time.sleep(2)
gdb.execute('continue')
The command reported above leads to:
...
gdb.error: Cannot execute this command while the selected thread is running.
Program received signal SIGINT, Interrupt
In the remote target is running at the end of the script execution.
But seems to be in an inconsistent state.
Have a good day