Announcement

Collapse
No announcement yet.

Debugging a pluging

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Debugging a pluging

    Can anyone tell me how to debug a plugin.

    I have tried the usual steps of first running VB then starting HV but it doesnt appear to see the plugin.

    Any help welcome.

    #2
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by johnf:
    Can anyone tell me how to debug a plugin.

    I have tried the usual steps of first running VB then starting HV but it doesnt appear to see the plugin.

    Any help welcome.<HR></BLOCKQUOTE>I assume the 'HV' you refer to is HS? Plugins are loaded by HS at initialize time. Running the plugin will only execute the class initialize and that's all.

    I use hs.writelog to debug a plugin. This will only work after the callback has been registered with HS.

    Bryan
    (Config is in my profile)
    Bryan
    (Config is in my profile)

    Comment


      #3
      If you have a win98 system you can simply have VB start HS and put in breakpoints and debug as usual. This only works on win98 and not Win2K or XP. I wish I knew why but I don't.

      -Rupp
      💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

      Comment


        #4
        Is it possible to redirect VB's stderr/stdout to a file? I do this in Perl to debug the plugins that I write. Once the redirection is in affect you can then simply sprinkle 'print' (or the VB equivalent) statements throughout the methods.

        -Nitrox

        Comment


          #5
          Thanks Rupp

          That would explain t on a XP machine, might try and see about creating a 98 dev machine.

          Comment


            #6
            Debugging with XP is impossible. (At least I have not found a way to make it possible, but I believe some have been successful.

            What I do is a poor mans alternative. For each subrouting or function I do this:
            <pre class="ip-ubbcode-code-pre">function aFunction() as integer
            dim l as integer
            On Error goto fName_Error
            l=1
            a command
            l=2
            another command
            ...
            ..

            on error goto 0
            aFunction = -1
            exit function

            :fName_Error:
            hs.Writelog "fName_Error", err.num & " in line " & l & " - " & err.Desc
            resume next

            end function
            </pre>

            This helps to pin down the problem by tagging line numbers. I don't necessarily tag each line though because some don't need to be tagged, but it helps narrow down errors when you develop code. When problems happen you do have the ability to quickly find the problem. Sometimes I use MsgBox instead. This is especially good when you need to have the notice brought to your attention.

            By relpacing the hs.Writelog with a write to file function, which can be developed as a seperate function, you can easily write errors to a text file. This is good for reveiwing later and it doesn't pollute the AH.log file with lots of entries.

            Another trick to think about is to put in several levels of debug driven printouts for dumping variables to a log file. I have four or five of them which are toggled in real time through check boxes on a form/window. As an example:
            <pre class="ip-ubbcode-code-pre">
            Debug1 = False
            Debug2 = True
            etc...
            If Debug2 then
            hs.writelog "a_variable", a_variable
            etc..
            end if
            </pre>
            As I watch my program run I can toggle various levels of debug to see what is happening.

            All this just because I can't get it to run in debug mode.

            regards,

            GenevaDude

            Comment

            Working...
            X