Wednesday, October 18, 2017

Paradise ponders: geekly gloating success!

Paradise ponders: geekly gloating success!  It took me damn near all day to do it, but I finally got remote debugging working with the toolchain I'm using.  All the difficulties turned out to be silly little things (as usual).  It's in the nature of things like this that you have total, epic failure until you nail the last problem ... and then suddenly everything works!  The main reason this was so challenging for me is that darn near everything I was working with (the parts of the toolchain) are brand new to me – so I wasn't just fighting actual problems, I was also fighting my ignorance.  I'm ever-so-slightly less ignorant now.  Here's what I had to do to make all this work:
  • I had to find the sources for a particular older version of the GNU debugger (gdb).  That turned out to be far more challenging than I expected, and led me down a blind alley learning how to clone git repositories.  Turns out GNU has a tarball of exactly the version I needed up on their anonymous FTP server.
  • I had to configure and compile that special version of gdb.  The configuration would allow gdb to execute on my Mac, but debug programs compiled for the Version 7 ARM computer that powers the Raspberry Pi 3.  This was way harder than I expected, but only because I had so much trouble locating the magic word (“armv7-unknown-linux-gnueabihf-gdb”) to use as the argument for the “—target” parameter to ./configure.  I read approximately 17 billion web pages to find that magic word.
  • I had to figure out what “symbol file” meant in the CLion run configuration screen.  I ran with the assumption that I had to tell the compiler to produce a symbol file ('cause that's how things worked in the dark ages when I last did things like this).  Turns out that's wrong.  What I had to do was to compile my source code on the target machine, then copy that object file back to my Mac – and point to that as the symbol file.  That took another 12 billion web pages skimmed to figure that one out.  I also found a way to produce a separate symbol file, though I'm not sure I actually care – the first method is easy and fast.
  • The easiest challenge turned out to be configuring CLion to automate all of the above things.  I only had to read about 5 web pages to get that! :)
The most important thing, though, is: Hooray!  I've got it working!

No comments:

Post a Comment