Cruisers Forum
 


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 13-02-2013, 12:58   #1
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,633
Images: 2
How to Test Plugins?

Development Environment - Plugins

After:
1. Used git clone to create the plugin repository in the opencpn-git/plugin directory.
2. Follow README document and cmake --build . -successful result.
3. Start MS VC++ 2010 Express Opencpn.sln project.
4. In dropdown "Release" and "Win32", Then select Debug > Build -successful result.
5. Then what? Do I look for a weatherfax_pi.dll for example and copy that to the plugin directory of a version 3.1.1405 for example?
rgleason is offline   Reply With Quote
Old 28-11-2013, 12:02   #2
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,150
Re: How to Test Plugins?

I do have nearly the same question or more specific:
How can I debug a plugin and run it debug mode to able to use a breakpoint to see what's happening?
If I debug OCPN it runs without plugins. Can force it to load a plugin also in debug mode?
Hakan is offline   Reply With Quote
Old 28-11-2013, 14:10   #3
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,211
Re: How to Test Plugins?

Yes, you can. The easiest is to edit https://github.com/OpenCPN/OpenCPN/b...nager.cpp#L184
to read something like
Code:
m_plugin_location = _T("C:\\a\\directory\\where\\my\\debug\\plugin\\dll\\is\\built\\");
Note that the double backslashes are obligatory.
For example on my Windows machine, for the GE plugin, this path is "C:\work\OpenCPN\build\plugins\gecomapi_pi\DEB UG\"

Like this you can debug just one plugin at a time. If you need more, you have to copy them to the same directory.

Pavel
nohal is offline   Reply With Quote
Old 28-11-2013, 23:40   #4
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,150
Re: How to Test Plugins?

Pavel.. Great! Many thanks. Works like a charm.

If you've the time to share knowledge: How is this evaluated?
Code:
if((now - m_LastAlarmTime).GetSeconds() < m_iRepeatSeconds  || !m_iRepeatSeconds)
If the m_iRepeatSeconds reads 10 I think the comparison is made since the second part of OR is then not evaluated. But if it reads 0 how is !0 compared?
This is Seans code in Watchman_pi and sometimes far beyond my basic skills. but it's fun to try learning.
Håkan
Hakan is offline   Reply With Quote
Old 29-11-2013, 01:55   #5
bcn
Registered User

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 4,740
Re: How to Test Plugins?

Would read it this way:

if (time since last alarm < repeat_seconds) OR (repeat seconds = 0) then
do something......

|| !m_iRepeatSeconds
OR NOT (repeatSeconds)

! (NOT Operator) = if the operand evaluates as NONZERO then ! returns "FALSE" --> 0 yields "TRUE"

Hubert

going to school as well....
bcn is online now   Reply With Quote
Old 29-11-2013, 02:38   #6
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,150
Re: How to Test Plugins?

bcn.. Yes of course, as simple as that... I was reading:
Code:
if lastalarmtime < (repeateseconds OR !repeatseconds)
That's mixing apples and pears and base for the Q.
It should of course be read:
Code:
if (lastalarmtime < repeateseconds) OR !repeatseconds
Time for a stand in the corner? Have to check there for some coffee and come back.
Thanks Håkan
Hakan is offline   Reply With Quote
Old 15-12-2013, 11:56   #7
Registered User

Join Date: Dec 2013
Boat: 36' Sail
Posts: 11
Re: How to Test Plugins?

Any hints on debugging a plugin in linux? I've read all pages in the Development Debugging Environment, as well as this thread. Right now the opencpn site is down so I can't double check the instructions. (edit) it's back online. too much use???)

It's been 10 years since I've used the debugger in unix so I'm a little unsure. I also have never run ddd

When I close opencpn I get a segfault.

When I disable my plugin and close opencpn I don't get a segfault.

gdb returns

Program received signal SIGSEGV, Segmentation fault.
0xb7c8cf6d in ?? () from /usr/lib/i386-linux-gnu/libwx_gtk2u_core-2.8.so.0

ddd returns

/home/ ....... engine_pi/src/d1-debug.c: No such file or directory

I'm thinking that I may need to compile my plugin with some debug info?

Also, when I looked at the troubleshooting page on the opencpn website, the

command line interface section describing the -p option, the link is broken


Anything to point me in a direction would be appreciated

Owen
tidefalling is offline   Reply With Quote
Old 15-12-2013, 12:15   #8
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,211
Re: How to Test Plugins?

Owen...
By far the easiest is to use the same approach as in Windows - Point OpenCPN to the plugin in your build directory (Modify PluginManager::LoadAllPlugins or the place where it is called in chart1.cpp to point to /yourtree/build/plugins/yourplugin_pi)
I use CodeBlocks to have it all easy and integrated, after
Code:
 cmake -G "CodeBlocks - Unix Makefiles" ..
I simply open the generated .cbp file in the IDE, do the forementioned change in the code and am happy... The same is possible with KDevelop and Eclipse if you for some reason prefer these.

Pavel
nohal is offline   Reply With Quote
Old 15-12-2013, 13:44   #9
Registered User

Join Date: Dec 2013
Boat: 36' Sail
Posts: 11
Re: How to Test Plugins?

OK thank you. I'm coding like I did years ago with a text editor or geany as an editor at best and then building from the command line.

I'll take your suggestion and get with the modern times. That will at least allow me to have the same environment as all of you guys and make some of my issues go away

thanks for the advice.

Owen
tidefalling is offline   Reply With Quote
Reply


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


Advertise Here


All times are GMT -7. The time now is 23:31.


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.