I found my way of interacting with GDB using tcpip, although it requires a bit of setup.
As I already said, gdb has a python interface. The way to proceed is to create tcpip tunnel to the (gdb) command line and then everything else is easy. So I wrote a small script that does that job (first attachment)
Instruction:
- Download the following python script as save it somewhere (replace extension form .m to py)
- create .gdbinit file in the folder of debug, where the following line is required: source path_to_the_script/py_dbg.py
- start debugging and at the breakpoint execute the loaded function: python py_dbg(34555). Instead of that number can be any port you with to use. From that moment on, it is possible to access the gdb throug telnet.
From the Matlab side I wrote a function that explicitly extracts the matrix using this inteface. As I currently work with Armadillo objects, the second attached function is capable of correctly determining the size of the matrix and directly exporting it from gdb to Matlab.
for example, if the variable of interest is called temp, the following command would do the job:
port_no = 34555;
cpp_matrix = get_arma_val_gdb('temp',port_no)
I hope that can help someone. Of course, if someone finds a more straightforward way of doing that, I am interested.
Regards
Mikhail