tags:

views:

540

answers:

2

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.

+2  A: 

What have saved me much time is to use both the logs that are created by NSIS, both the log while compiling the scripts, and the installation log. Both 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.

daramarak
+1  A: 

You can download one of the special builds of NSIS from the official site that has advanced logging. This will give you very detailed logging information that makes debugging easier.

AaronLS