Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Methods for debugging NSIS installers?

Tags:

debugging

nsis

Although NSIS allows you to build quite powerful installers, the "so low level language that it reminds me of assembly" that NSIS uses is quite prone to making mistakes and therefore, when you want your installer to do something more complex other than writing files, debugging is a must.

Until now I've used the following Dr Printf-like debugging technique:

  • In a .nsh file that I include everywhere, I define a NSIS_DEBUG_MSG macro according to the value of a DEBUG define
    • if DEBUG is on, the macro will trigger a MessageBox with the debug message
    • if DEBUG is off, the macro will do nothing

This method has served me well but it presents some disadvantages:

  • it requires me to fill the code that I feel it's the one failing with calls to NSIS_DEBUG_MSG and rebuild the installer several times until I get enough info to allow me to solve the problem
  • it will do me no good if my problem is that the installer itself fails (if the installer program dies)

So what I wanted to know is what debugging methods do you use for these installers so that hopefully I can improve mine.

like image 330
Miguel Ventura Avatar asked Oct 27 '09 13:10

Miguel Ventura


2 Answers

During my time using NSIS, there is these things noticeable:

I have found out that nothing is more powerful than parsing !verbose 3 level output with self-made tool ;)

I have found out that you can NOT depend on any NSIS-based debugging method. It may crash .. and your installer will crash along with it. No pretty, eh'? :(

I have found out that enabling/disabling debugging on-demand is also very powerful weapon against idsses as it allows to distinguish between unstable and failed NSIS build ( it is easier to use CI terminology though... :) ).

I have found out that verbose output w/o realtime automated NSIS testing is like driving Cadillac with bicycle engine :)


Hope it helps for those accidentally visiting this question :)

EDIT: It's always good idea to start with 3rd party tools. For example, no need to hassle around GUI as it is always easier to use tools like:

  • EclipseNSIS ( I do not like it though :P )
  • NSIS Dialog Designer (http://nsis.sourceforge.net/NSIS_Dialog_Designer)
  • Self-made static code analyzer. I have made one for myself :P

EDIT #2: I have found out that pretty effective method for debugging is to use direct documentation automatization. Currently I use the following components:

  • http://nsis.sourceforge.net/NsScreenshot_plug-in ( See IMPORTANT NOTES to have no unexpected surprises... )
  • http://www.dokuwiki.org/cli#dwpagephp ( See this link for more information: http://www.microsoft.com/web/platform/phponwindows.aspx )

The result is that I got screenshot after nsDialog:Show plus I got updated images in wiki :) .. only stuff left is to fetch info from svnlook :)


EDIT #3: And the need of svnlook is also worked-around by building a svn log --xml exporting DLL using NSIS v2.44 header for Delphi and Lazarus IDE 0.9.30.2 :) Kudos to Lazarus!

Woohoo! :)


EDIT #4: Hit this small discussion here: http://forums.winamp.com/showthread.php?t=325521

like image 149
HX_unbanned Avatar answered Sep 22 '22 16:09

HX_unbanned


What have saved me much time is to use the logs that are created by NSIS. Both the log while compiling the scripts, and the installation log. They allows me to check that the macros I have defined is in use, and that the installation actually run the scrips they should.

It might seem too little, but this is actually everything I need to keep my installation software of 50+ nsh files running, along with the divide an conquer principle.

like image 34
daramarak Avatar answered Sep 21 '22 16:09

daramarak