I compile a C program on my laptop and scp it to my M2K. I get a segmentation fault when I work with the iio buffers.
How can I debug the ARM compiled program with gdb?
Getting gdb onto the board can be challenging since it would require you to modify the firmware and get all of gdb's dependencies.
Have you verified that your application works from remote contexts on your local PC?
Sorry, could you rephrase what you mean with remote contexts?
libIIO applications can be run remotely (on a host PC) or on a target board. Simply changing how the context gets created will do this.
Easiest way to create a remote context is with a URI: https://codedocs.xyz/analogdevicesinc/libiio/group__Context.html#ga5cc6251fbf69e26befccb82d5f5a6625
This is "ip:192.168.2.1" by default on M2k/Pluto or use the USB URI from "iio_info -s"
Gotcha. I've switched context from local to URI. Once I install libIIO on my host machine should I try gdb on my host machine?
If you think it's necessary sure. You shouldn't have to go into the library calls though.
I can now debug the program. Thanks Travis! For other readers, after changing the URI to the M2k/Pluto I ran
gcc -Wall -g testprog.c -liio