I am trying to make some automation testing with an embedded application running in an ARM Microcontroller. For the I/O exchange I have setup the Semihosting using arm-none-eabi-gdb as GDB client:
arm-none-eabi-gdb my_binary.axf -ex "target localhost::3333" -ex"load" -ex "continue"
After launching the GDB session I am able to use printf(), scanf() to interact with the user through the GDB console.
I am now desperately trying to make Python read and write to/from the gdb console in order to substitute the user, but the results so far have been poor.
This is the best solution I tried without any success:
- Create a new gdb console into a separate pseudo terminal with the following GDB command:
(gdb) new-ui console /dev/ptyp0
and let Python open/read/write the device /dev/ttyp0. The connections seems to be properly established but I am not able to neither read nor write any data from the GDB console.
(ref: https://sourceware.org/gdb/onlinedocs/gdb/Interpreters.html)
Which is the best way to solve this problem?
I am totally running out of solutions here and it would be great to know is someone has already tried to do the same thing.