Nsisdbg plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Using File:Exe.gif image.)
Line 3: Line 3:
== Links ==
== Links ==
[[File:Exe.gif]] [http://saivert.inthegray.com/download.php?get=Li91cGxvYWRzL25zaXMvbnNpcy1kZWJ1Z2dlci5leGU= nsis-debugger.exe] (275 KB)<br>
[[File:Exe.gif]] [http://saivert.inthegray.com/download.php?get=Li91cGxvYWRzL25zaXMvbnNpcy1kZWJ1Z2dlci5leGU= nsis-debugger.exe] (275 KB)<br>
[[Image:Zip.gif]] [http://www.darklogic.org/win32/nsis/plugins/others/nsis-debugger.exe nsis-debugger.exe] (275 KB) (Mirror #2)
[[File:Exe.gif]] [http://www.darklogic.org/win32/nsis/plugins/others/nsis-debugger.exe nsis-debugger.exe] (275 KB) (Mirror #2)


== Introduction ==
== Introduction ==

Revision as of 06:25, 4 July 2005

Author: saivert (talk, contrib)


Links

Exe.gif nsis-debugger.exe (275 KB)
Exe.gif nsis-debugger.exe (275 KB) (Mirror #2)

Introduction

I have created a new debug tool for NSIS. It's called NSIS Debugger and you can download it from my homepage (see above links section).

NSIS Debugger is a NSIS plugin which allows you to debug your NSIS installers. The plugin will create a dialog which will be displayed alongside the NSIS window. The first thing you will get familiar with is the tabbed pages. Use them to switch between variable list, stack view, debug log, config. and about page.

Description

Using the variable list which is on the first tab page you can change all the variables, clear them, keep (save for later use) and restore them (from a previous keep operation). To edit a variable simply use the in-place edit box by clicking a variable. The stack view gives you a list of the strings pushed on the stack. You can pop them off it, push more strings to it and clear the entire stack. You can edit a stack item simply by clicking it and use the in-place editbox. NSIS Debugger has a debug log which you can add entries to by calling a function in your installer script.

To install the plugin, simply copy it to the plugins folder under your NSIS folder.

This version of NSIS Debugger has only been tested with NSIS 2. It should work perfectly fine with older versions too.

How to use

Initialization The first thing you have to do to use the debugger is to set up a couple of lines in the .onGUIInit callback function in the script. You will also need to put a line in the .onGUIEnd callback function as well (this is covered below).

Function .onGUIInit
 
  InitPluginsDir
  ; Remember to include the "/NOUNLOAD" option.
  ; This is to keep the debugger running.
  nsisdbg::init /NOUNLOAD  
  ; To start the debugger hidden pass "hidded"
  ; to the stack like this:
  ;   nsisdbg::init /NOUNLOAD "hidden"
  ; You will be able to show it again by using the
  ; system menu of the installer. Read about this below.
 
  ; old fashion way (pre-2.0)
  ;   GetTempFileName $9 ; $9 will globally be used in the script
  ;   File /oname=$9 ${NSISDIR}\Plugins\nsisdbg.dll
  ;   CallInstDLL $9 /NOUNLOAD init
 
  ; optionally set a few option by calling setoption
  nsisdbg::setoption /NOUNLOAD "notifymsgs" "1"
  ; read more about the setoption function below
FunctionEnd

Use the debug log

Now as you have the debugger up and running, let's use the debug log feature. Call sendtolog like in this example

  nsisdbg::sendtolog /NOUNLOAD "Value of $$1 is $1"
  ; Only push one string. Subsequent strings will be left on the stack.
 
  ; old fashion way (pre-2.0)
  Push "Value of $$1 is $1"
  CallInstDLL $9 /NOUNLOAD sendtolog