Remote debugging on Raspberry (from Windows) lazarus / 12-Debugger ---------------------------------------------------------------------- DimTim · 2022-05-06 13:58 Trying to set up remote debugging on Raspberry Pi with gdbserver (from Windows in my case), I finally found out that gdb-multiarch.exe is required as debugger backend. One may install that (with a bunch of other stuff) with MSYS2.  Also one needs to set "Architecture: arm" in debugger options. "Standard" windows gdb.exe (and Linux gdb) is built without cross-targets support.  Maybe I should add this note to the wiki page? ---------------------------------------------------------------------- MarkMLl · 2022-05-06 16:39 If it's useful advice it's welcome :-) From my POV, the major gdbserver gotcha is that the commandline parameters specified in the IDE are ignored. I've used it quite a lot for debugging stuff using POSIX capabilities etc. MarkMLl ---------------------------------------------------------------------- DimTim · 2022-05-07 05:45 Quote from: MarkMLl on May 06, 2022, 06:39:50 pmIf it's useful advice it's welcome :-) I hope it is.   Lazarus is great programming tool for SBC's such as RasPi, but they are too slow to comfortably work natively. Edited the Wiki page... ---------------------------------------------------------------------- MarkMLl · 2022-05-07 06:21 Quote from: DimTim on May 07, 2022, 07:45:57 amI hope it is.   Lazarus is great programming tool for SBC's such as RasPi, but they are too slow to comfortably work natively. I've never had any problems, either running with a directly-connected screen etc., tunnelling X11 over SSH, or (in extremis) using VNC. And you've always got the option of keeping the source in Subversion, doing most of the development on a PC, and doing the final compilation/debug on the RPi. MarkMLl ---------------------------------------------------------------------- Thaddy · 2022-05-07 11:28 Quote from: DimTim on May 07, 2022, 07:45:57 amEdited the Wiki page... Then I will edit it back, because it is not correct. ---------------------------------------------------------------------- trev · 2022-05-07 22:43 Quote from: Thaddy on May 07, 2022, 01:28:12 pmThen I will edit it back, because it is not correct. As you haven't edited it back. do I take it that you misspoke? If you haven't got a round tuit, then perhaps you could elaborate on what exactly is not correct? ---------------------------------------------------------------------- MarkMLl · 2022-05-08 06:56 Quote from: trev on May 08, 2022, 12:43:10 amAs you haven't edited it back. do I take it that you misspoke? If you haven't got a round tuit, then perhaps you could elaborate on what exactly is not correct? Agreed. However I think OP should clarify which URL he was looking at, in case different people are looking at different things. MarkMLl ---------------------------------------------------------------------- trev · 2022-05-09 08:09 Wiki URL: https://wiki.lazarus.freepascal.org/Remote_Debugging ---------------------------------------------------------------------- MarkMLl · 2022-05-09 09:38 So I can see that OP (Dim-Tim) has edited that. Thaddy: I'm not trolling but what are you unhappy about? MarkMLl ---------------------------------------------------------------------- DimTim · 2022-05-15 04:59 Well, it works, and may be useful for someone.  If I omitted something important, anyone is free to edit and add missing parts. The thing is, I usually work with MCU's, and this way of debugging is most natural for me: cross-compiling on PC and debugging remotely from IDE with an ICE-tool. ---------------------------------------------------------------------- MarkMLl · 2022-05-15 07:09 Yes, that's been pretty standard since the 80s- thinking about some of the groundbreaking work Logitech did. But an RPi is entirely adequate for native development. MarkMLl ---------------------------------------------------------------------- DimTim · 2022-05-16 05:10 Quote from: MarkMLl on May 15, 2022, 09:09:41 amBut an RPi is entirely adequate for native development. Well, it's incomparable by speed and comfort with an average modern desktop system - Windows or Linux.  Besides, I couldn't install Lazarus with fpcupdeluxe at Bullseye.  Generally, for me RPi is just amazing MCU with true Linux but without real time capabilities and powerful peripherals, usually present in MCU-s. ---------------------------------------------------------------------- att2 · 2022-05-17 20:01 Hello, I have a somewhat similar question... My Setup is: A virtualbox VM with Linux Mint Tara 19 inside and Lazarus/FreePascal for compiling. I cross-compile to ARM, the target system is a Odroid C2 or an Odroid C4. Is it possible to configure the Lazarus environment in such a way that after compiling, the executable will be copied to the Odroid C2 or C4, and can I then single-step inside the Lazarus environment to cross- debug the running program on Odroid C2/C4 ? If this is possible, how do I have to setup the Lazarus/FPC inside the VM? Has anybody done this ... ? ---------------------------------------------------------------------- MarkMLl · 2022-05-17 20:54 Quote from: att2 on May 17, 2022, 10:01:08 pmHello, I have a somewhat similar question... My Setup is: A virtualbox VM with Linux Mint Tara 19 inside and Lazarus/FreePascal for compiling. I cross-compile to ARM, the target system is a Odroid C2 or an Odroid C4. Is it possible to configure the Lazarus environment in such a way that after compiling, the executable will be copied to the Odroid C2 or C4, and can I then single-step inside the Lazarus environment to cross- debug the running program on Odroid C2/C4 ? If this is possible, how do I have to setup the Lazarus/FPC inside the VM? Has anybody done this ... ? Yes. MarkMLl ---------------------------------------------------------------------- DimTim · 2022-05-18 03:04 Quote from: att2 on May 17, 2022, 10:01:08 pmIf this is possible, how do I have to setup the Lazarus/FPC inside the VM? Has anybody done this ... ? I think, your setup will be similar to mine.  Though you should install the Linux version of gdb-multiarch.  Copying executable by Lazarus didn't work for me (Windows to RasPi), so I uploaded it with a scp client; it should work in Linux also. ---------------------------------------------------------------------- MarkMLl · 2022-05-18 06:54 Quote from: DimTim on May 18, 2022, 05:04:27 amQuote from: att2 on May 17, 2022, 10:01:08 pmIf this is possible, how do I have to setup the Lazarus/FPC inside the VM? Has anybody done this ... ? I think, your setup will be similar to mine.  Though you should install the Linux version of gdb-multiarch.  Copying executable by Lazarus didn't work for me (Windows to RasPi), so I uploaded it with a scp client; it should work in Linux also. scp or sftp, but since I'm always very hesitant about setting up keys etc. I'd rather not get into detail there. I'm fairly confident that debugging using gdbserver will work over an exposed socket, but since my experience is that (as I've said) the RPi is adequate for native development- or at least for compilation and debugging after the bulk of development has been done on a PC with Subversion etc. as a common resource- that I've got little inclination to get into the cross-tools required. Hence my cryptic late-night comment. MarkMLl ---------------------------------------------------------------------- att2 · 2022-06-25 22:28 So, what, exactly, are the steps of installing software on the VM and on the Odroid C2/C4 that I have to do so I can * cross-debug the application on the VM and live single-step as in the normal debugger, etc. ? ---------------------------------------------------------------------- MarkMLl · 2022-06-26 07:28 The way I usually do it its to put Lazarus on the target system and run it over an SSH tunnel. That might assume that your desktop system is also running Linux. Another alternative with similar prerequisites is something like Xnest or Xephyr. On a number of occasions (in the distant past) I've seen those perform badly since some versions of Lazarus polled input devices excessively (as did e.g. Mozilla at the same time, suggesting it was a lower-level problem). In those cases VNC has been effective, although that's not my favoured solution since C&P etc. can be a problem. I presume that Odroids still run Linux, so none of the above should be a challenge and you'll be familiar with Linux configuration etc. MarkMLl