Cruisers Forum
 

Go Back   Cruisers & Sailing Forums > Seamanship, Navigation & Boat Handling > OpenCPN
Cruiser Wiki Click Here to Login
Register Vendors FAQ Community Calendar Today's Posts Log in

Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 14-02-2022, 14:58   #1
pmx
Registered User

Join Date: Jun 2019
Location: France (Mediterranean Sea)
Boat: Shipman 28 (1973)
Posts: 69
How to debug OPCN plugins ? (RPI 4)

Hi,

I would like to work on the dashboard_tactics plugin.

As it is curenly not in the main OpenCPN source tree, how can I run/debug it locally (from within an IDE ) ?

I already have an OpenCPN source tree working (launchs in the "portable" mode).

Am I supposed to install it into the OPCN source tree and alter the CMake source list ?

Thanks in advance !

pmx
pmx is offline   Reply With Quote
Old 14-02-2022, 20:03   #2
Registered User

Join Date: Mar 2011
Posts: 732
Re: How to debug OPCN plugins ? (RPI 4)

Welcome to the world of plugin development.

Start with the OpenCPN Developer manual on opencpn.org

All of the external plugins (those that are not included in OpenCPN) are developed and built outside of the OpenCPN source tree.

For working on existing plugins, the process can essentially be broken down into these steps.
1. Create your own github.com account if you haven't already done so.
2. Fork the original dashboard_tactics repository to your own github.com repository.
3. Clone your github.com fork to your local pc.
4. Develop & test your changes.
5. Push your local changes to your github.com repository
6. Create a Pull Request (PR) so that the original developer can incorporate your changes.

Good luck.
stevead is offline   Reply With Quote
Old 14-02-2022, 20:04   #3
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,501
Re: How to debug OPCN plugins ? (RPI 4)

pmx...
What OS/IDE are you using?


Dave
bdbcat is offline   Reply With Quote
Old 15-02-2022, 06:42   #4
pmx
Registered User

Join Date: Jun 2019
Location: France (Mediterranean Sea)
Boat: Shipman 28 (1973)
Posts: 69
Re: How to debug OPCN plugins ? (RPI 4)

Thanks for the reply.

My question was rather : how to run a debugger on a running plugin ?
Obviously, the plugin has to be hosted by a running OpenCPN instance.
Also, I want to test it without installation.

@Dave :
I used Codeblocks on the RPI 4, as it is small and a 32 bits version is available.
Setup was super easy, as cmake can produce a perfectly working Codeblocks project file.
Codeblocks has some nice features, but other are really missing, and it is (currently) quite buggy... especially the communication with gdb.
But workable.
(HINT : always pause the debugger before any modification of the breakpoints : add, remove, enable, disable breakpoints. Otherwise, codeblocks freezes.)

I'm used to Eclipse (professionally, as it is a kind of standard for embedded systems development). But it is is huge and resources hungry.

I may try VSCode (have previously installed it successfully on another RPI 4, can't remember if it was 32 or 64 bits ).

I just made a 64 bits Raspbian SD card, in order to try to install Eclipse and the Oracle JDK.
Wonder what performances I may get.

What IDE do you suggest on the RPI ? (dont tell me Vi or Emacs ).
BTW, during the Covid-19 lockdown, I tried (again...) very hard to use Emacs with all its great extension / distributions available now.
Even used it as a X11 desktop manager on a very old laptop (This was Covid-19 lockdown, right ?)
After much fingers gymnastics, specially using a french keyboard, I gave up (again...).
My pinky still hurts !

Pierre
pmx is offline   Reply With Quote
Old 15-02-2022, 07:34   #5
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,501
Re: How to debug OPCN plugins ? (RPI 4)

pierre...
I use kdevelop on x86 linux for code development for linux targets. Have not tried it on rPI, though. I read that it works OK.
https://forums.raspberrypi.com/viewtopic.php?t=275793


With kdevelop, I do this:


0. Create a project for the plugin in kdevelop by "importing" from the plugin source directory.

1. Build the plugin in kdevelop.

2. copy the resulting .so file to ~/.local/lib/opencpn
3. Open OCPN in kdevelop.
4. Set breakpoints wherever you want, in OCPN, or in the plugin source files.
5. Start OCPN in ("Debug"). The IDE will break and stop on any breakpoints you have set, either in OCPN, or in the plugin.


Very efficient workflow, for me. Everything except (2) happens in the IDE.


Good Luck
Dave
bdbcat is offline   Reply With Quote
Old 15-02-2022, 10:46   #6
pmx
Registered User

Join Date: Jun 2019
Location: France (Mediterranean Sea)
Boat: Shipman 28 (1973)
Posts: 69
Re: How to debug OPCN plugins ? (RPI 4)

Hi Dave,

OK, this requires the opencpn source tree (which I already have), as expected.
The ~/.local/lib/opencpn means that OpenCPN is installed locally, and the plugin's data/resources are also installed locally (via an initial "make install" ?

I used a slightly different method, using the -p (portable) flag.
It was very easy to work on the dashboard plugin", which belongs to the opencpn source tree.
I fear that the cmake generated "make install" target strips the executable from all debug symbols, have to check this.

Anyways, thanks for the info .

Pierre.
pmx is offline   Reply With Quote
Reply

Tags
plug, plugin


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Plugins not installing on RPi set up SCarns OpenCPN 1 17-03-2021 09:45
Opcn Draw 1.4 not showing in OpenCPN 4.84 plugins doiroda OpenCPN 0 12-05-2020 12:59
Recomendation for NMEA AIS Mutiplexer to OPCN Trim50 OpenCPN 18 15-07-2015 21:29
opcn on android ienc trouble rwsaxon OpenCPN 20 03-10-2013 18:30
Installateur de plugins, Install software for plugins. Gilletarom OpenCPN 3 30-04-2013 05:57

Advertise Here


All times are GMT -7. The time now is 17:27.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.