0

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.

2
  • Use pexpect to write a script that controls an interactive application. Commented Jul 30, 2022 at 17:44
  • @Barmar seems to be a good idea but I have to exchange binary strings to send commands and receive responses. Commented Jul 30, 2022 at 17:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.