Remote debugging on R-Pi can't reach debugger

I’m trying to use the remote debugger from macOS Sonoma to R-Pi, on a Pi 5 that I just installed with the latest Raspian today. I have followed the instructions to set up the debugger exactly. I have also given the Pi’s password in the remote machine dialog.

But, when I try to launch the remote session (via the Project>Run remotely menu item), after the compiling and assembling steps, I get 2 messages flash onto the screen (in the IDE, and truncated), and on the Pi a zero-size tar.gz file appears.

I had to use Slo-Mo on my iPhone to catch these messages. The first says “Creating the remote file”, and the second “The remote debugger stub could not be reached on the target computer. Incom” and at that point the message is truncated.

This is rather frustrating, since the app itself, if I just transfer it to the Pi, throws a Nil object exception on launch, so I do need the debugger.

By the way, I also tried it with the suggested sample app, Xojo Notes. It’s the same.

1 Like

Restart the ide fixes that for me

You are building for ARM, I suppose? Whether this is still required I don’t know, but even when using remote debugging to a Pi, I found it was necessary to choose ARM build in the IDE.

Thanks for the tip. I tried it and it didn’t help.

Yes. Arm-64 bit was chosen in the IDE already. I had previously built it, transferred it and found it crashed on the Pi.

Well, without remote debugging your only option is to include a lot of debugging statements until you pin down where the crash is. Write them to a file.

You can also add an UnhandledException event handler to you app and print out info about the eception - and, ultimately, dump the stack to see what you were doing at the time of the crash. All to the log file.

Yes, I’ve done that (debugging statements to localise a crash) before – I only learned about the remote debugging possibility today.

For the unhandled exception – I could do something with that. Where can I put one that’s valid for the whole app? This nil object exception kicks in during start-up

Add it as an event of the Application. Then with some code something like this, you get the info you need:

// Saves the runtime stack traceback to the logfile.

Var  msg, type as String

type = Introspection.GetType(error).Name
msg  = "Error - fatal exception '" + type + "', number " + error.ErrorNumber.ToString
writeLog (msg)

if  (error.Message<>"")  then
  msg = "  Message: " + error.Message
  writeLog (msg)
end if

writeLog ("Stack: --------------------")

for each msg in error.Stack
  if  (msg<>"")  then writeLog (msg)
next

writeLog ("Stack done ----------------")

And writelog(msg) might look like this:

Var  fh as FolderItem, op As TextOutputStream

fh = new FolderItem ("/Users/myusername/Desktop/logfile.txt", FolderItem.PathModes.Native)
op = TextOutputStream.Open (fh)
op.WriteLine (msg)
op.Close ()

Edit: this is a cut down version of what I have. You can embelish that more with timestamps etc, but initially simplest is quickest to get going and get a result. If you want to keep that for permanent use, then polish it to your needs.

Great! Thanks a lot. I can run with that :wink:

Remove that. The password field is to make it so the IDE needs to authenticate. It has nothing to do with the password of the machine.

3 Likes

You nailed it !

Now it works. Thanks !!!

1 Like