The Breakpoint adventure (free scripts inside!)

MisterX b.xavier at internet.lu
Sun Apr 3 15:00:29 EDT 2005


Hello folks,

After a few crashes and additions to bugzilla 2483, I've come up with a safe
script to prevent the breakpoint bug crash boom bang that overjoyed my
second holliday sunday morning with regular bugzilla-bullying! Hope the
third is the charm ;)

http://support.runrev.com/bugdatabase/show_bug.cgi?id=2483

(I assume you are now 2483 aware, so read on ;)

The problem with this breakpoint bug is that a simple stack name change in
the finder or explorer (while the stack is closed naturally) doesn't update
long control names references in the debugobjects customprop mentioned in
bugzilla. (I'll add that this is the same exact bug as 2341 when you move
objects to or from groups after their revGM is set! Sorry, just an
observation.)

This fix-script will prevent you a lot of crashes until rev releases a fix
for 2483. Im trying to finish a simple plugin to make it available in stack
form but it might have to wait since im off to hollidaying far away from my
cyberdesk next week!

The bug is not that frequent but the lost work adds up (at least 5 a month
here!!!)! Also I seem to get it more and more frequently and getting quite
parano-save-yac after every gui or script change! It's sad but I have to! So
this should make the whole thing much better... NO, i dont care to try to
fix the broken relation, just avoid the potential crash, at first. 

The script

on preopencard
  CheckRevBreakpoints
  CheckRevDebugObjects
  pass preopencard
end preopencard

on CheckRevBreakpoints
  put the breakpoints into bp
  repeat with x = the number of lines in bp down to 2
    get item 1 of line x of bp
    if exists(it) then
      put the script of it into ds
      if the number of lines in ds < item 2 of line x of bp then
        delete line x of bp
      end if
    else
      delete line x of bp
    end if
  end repeat
  if bp is not the breakpoints then
    set the breakpoints to bp
  end if
end CheckRevBreakpoints

on CheckRevDebugObjects
  put the crevgeneral["debugobjects"] of the topstack into dbo
  repeat with x = the number of lines in dbo down to 1
    get line x of dbo
    if not exists(it) then
      delete line x of dbo
    end if
  end repeat
  if dbo is not the crevgeneral["debugobjects"] of the topstack then
    set the crevgeneral["debugobjects"] of the topstack to dbo
  end if
end CheckRevDebugObjects

-- Remarks --

- DO NOT delete line 1 of the breakpoints (which is why that loop starts at
2 and not 1. I dont know why but doing so caused systematic crashes each
time after execution - I had to rescript the whole thing 3 times to get it
right before I started over-saving! 

It seems to be a bug rather than a feature though. That first script listed
in the breakpoints doesn't have 500 lines where a breakpoint seems to be
inserted continualy. 

I requested info in the bugzilla and exempted that line from deletion. What
is funny is that if we set the breakpoints to empty we dont get the crash!
So the explanation is a bit dubious I agree... Maybe it was another
something else!

But it doesn't prevent the breakpoint crash. Hence the second routine for
the reference renaming problem. I not sooner than later found a stack with
some 60 wrongful debugging references! So there proof you should also be
watching your steps before the IDE gets the fix!

- I didn't add the save stack routine because that's simple enough for
anyone 
- You could also check the stacks at close, suspend, etc events

You can add overides if you want. Please send me your fixes or erorrs so I
can improve on it right away. I might not be able to do so after tomorow
until next weekend but I'll have a cool little stack to either delete or fix
the problems. Try to insert these scripts into a fronscript preopencard
handler plugin stack so that you can be assured they are not intercepted or
blocked from running. But backscript should work too. All that will be in
the stack.

These scripts are part of the TAOO library that checks stacks as they are
opened to reduce program farts and do other useful stuff like update
indexes, correct spelling, wrong dates, import data so you always have stuff
up to date! In this simple example the top stack is used and not checked
properly in this script btw, im just releasing the "main" script for you in
case you already have the problem, want to play with it or share
improvements.

Now you have less crashes, less lost breakpoints (which leaks as less max
breakpoints)! More uptime, and better behaved breakpoints!

All I can say is, have a better day so can have more time for your self and
your family and REAL adventures!!! 
cheers
Xavier
http://MonsieurX.com/runrev



More information about the use-livecode mailing list