help: how to debug script interrupting? - page 11 - General Discussion and Assistance - CHDK Forum

help: how to debug script interrupting?

  • 224 Replies
  • 65882 Views
Re: help: how to debug script interrupting?
« Reply #100 on: 18 / November / 2012, 10:01:03 »
Advertisements
However, CHDK stores the presistent data, including script parameters, in config file (this one with .CFG extension in CHDK/ directory). This file is changed when you change script parameters. So when you set a parameters for some script, then turn off camera, change the script on computer and turn the camera once again the CHDK will load new script version, but the old script parameters.
I believe that only happens if you have the "Save Parameters" option in the "Script" menu selected.

You mean you remove the SD card with the power on? On my cameras, opening the door to get to the card cuts the power.
This old hack might still be of some interest to people :  http://chdk.setepontos.com/index.php?topic=5744.0.  Comes in really handy for not wearing out your battery door during porting so I've put it in almost all the ports I've worked on (other than those where opening the battery door disconnects the battery).
« Last Edit: 18 / November / 2012, 10:09:12 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline lapser

  • *****
  • 1093
Re: help: how to debug script interrupting?
« Reply #101 on: 18 / November / 2012, 13:17:06 »
Just tried with batteris and after about 15 min I encountered again the bug... so it seems not to be a power supply problem...
OK, that's good to know. Did you have anything connected to the camera through USB? Were you far away from any other active electronics or computers?

I understand that some of your cameras don't show the bug? Will you take the SD card out of a good camera and try it in a bad camera?

Were you using this script?
Code: (lua) [Select]
repeat until false
--©2012 Lapser / all rights reserved (:
Have you searched for firmware updates for this camera? I found this one:
http://web.canon.jp/imaging/dcp/firm-e/pssx130is/index.html
It looks like this is the "e" version of the firmware. CHDK has ports for "c", "d" and "f". So has anyone tested for this bug with an "f" version camera? Also, I guess we'll need a new port for this "e" firmware update.
« Last Edit: 18 / November / 2012, 13:57:06 by lapser »
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: help: how to debug script interrupting?
« Reply #102 on: 18 / November / 2012, 17:03:09 »
However, CHDK stores the presistent data, including script parameters, in config file (this one with .CFG extension in CHDK/ directory). This file is changed when you change script parameters. So when you set a parameters for some script, then turn off camera, change the script on computer and turn the camera once again the CHDK will load new script version, but the old script parameters.
I believe that only happens if you have the "Save Parameters" option in the "Script" menu selected.

True.

@lapser
I've got c firmware (upgraded from b by Cannon official updater) and  it is affected by the bug.
« Last Edit: 18 / November / 2012, 17:04:53 by outslider »
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

*

Offline lapser

  • *****
  • 1093
Re: help: how to debug script interrupting?
« Reply #103 on: 18 / November / 2012, 22:56:50 »
@lapser
I've got c firmware (upgraded from b by Cannon official updater) and  it is affected by the bug.
The link I referred to looks like it updates to firmware "e", so if you've got "c", it could be the cause of this elusive bug. What firmware revisions do those 60 cameras have? Can you find an "f" camera and test it? There's no "e" CHDK port yet.

Canon says the bug is in video/audio sync, so it's probably not causing this problem, but it's worth checking.

Assuming we've eliminated hardware problems, it sounds like something in CHDK could be storing a byte in the Lua part of memory. There might be an incorrect pointer in the camera specific code somewhere? If a single random byte of lua code was changed, it would give different strange errors like this. Of course, a bug in Lua could do this, but since it's only on this camera, a bug in CHDK seems more likely.

Has anyone gone through the camera specific code looking for pointer problems? It would be useful to know which firmware ports have the problem. We know the "c" version has it. @outslider, do you remember having the bug with your old "b" firmware too?

« Last Edit: 18 / November / 2012, 23:11:13 by lapser »
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: help: how to debug script interrupting?
« Reply #104 on: 19 / November / 2012, 02:48:43 »
There's no CHDK for b. Therefore I had to upgrade to c...
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

*

Offline lapser

  • *****
  • 1093
Re: help: how to debug script interrupting?
« Reply #105 on: 20 / November / 2012, 13:44:21 »
Quote
There's no CHDK for b. Therefore I had to upgrade to c...
Better not upgrade to e then. No CHDK for that either. There is an "f" version of CHDK, so someone must have it. I wonder if that camera shows the bug (probably does).

OK, so here's my next debugging idea. The Lua script is doing nothing, but CHDK is running in the background updating the screen and doing all sorts of things. Let's assume CHDK code, possibly camera specific, is storing a byte in the wrong location due to a pointer error or something. I.E. one of the camera specific pointers may be wrong, or CHDK has a bug that happens to zap Lua code with the pointers from this camera. It may be zapping free memory with other cameras.

Anyway, the first thing to do is to go through all the CHDK <alt> menus and turn off everything you can. If it still has the bug, then I wonder if you could modify the main CHDK loop somehow so it stopped doing background tasks, i.e. disabled everything but Lua.  You could add some kind of indicator that Lua was running. If the bug still happens, it's Lua or hardware.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: help: how to debug script interrupting?
« Reply #106 on: 20 / November / 2012, 14:03:25 »
or CHDK has a bug that happens to zap Lua code with the pointers from this camera. It may be zapping free memory with other cameras.
If it was "zapping" the Lua code in memory, then it would not be possible to restart the script (without power cycling the camera.)

Quote
If it still has the bug, then I wonder if you could modify the main CHDK loop somehow so it stopped doing background tasks, i.e. disabled everything but Lua.  You could add some kind of indicator that Lua was running.
Assuming you were willing to live with the infinite loop tests (which also exhibit the crash), that might be possible. 
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline lapser

  • *****
  • 1093
Re: help: how to debug script interrupting?
« Reply #107 on: 21 / November / 2012, 04:21:51 »
Here's an easy test that may show something useful. Try this script:
Code: (lua) [Select]
--[[
@title No Yield
--]]
set_yield(-1,-1)
repeat until false
I haven't tried set_yield, but Lua is supposed to completely hog the CPU this way, and CHDK should be effectively disabled. If that's true, it shouldn't crash if CHDK is "zapping" Lua code. By "zapping" I mean change 1 byte in the Lua address space.

Does anyone know if CHDK is using the latest version of Lua?
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline whim

  • ******
  • 2046
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Re: help: how to debug script interrupting?
« Reply #108 on: 21 / November / 2012, 05:16:53 »
Quote
Does anyone know if CHDK is using the latest version of Lua?

From CHDK sources (/include/lua.h) :
Quote
...
** $Id: lua.h,v 1.218.1.4 2008/01/03 15:41:15 roberto Exp $
...
#define LUA_RELEASE     "Lua 5.1.3"
while lua.org says:
Quote
Lua 5.2 was released on 16 Dec 2011. Its main new features are yieldable pcall and metamethods, new lexical scheme for globals, ephemeron tables, new library for bitwise operations, light C functions, emergency garbage collector, goto statement, and finalizers for tables.

The current release is Lua 5.2.1, released on 14 Jun 2012.

hth,
wim

Re: help: how to debug script interrupting?
« Reply #109 on: 21 / November / 2012, 10:01:42 »
I haven't tried set_yield, but Lua is supposed to completely hog the CPU this way, and CHDK should be effectively disabled.
The most it will do is completely hog the keyboard task where the script engine resides. DryOS is preemptive - other tasks will continue to run.
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal © 2008-2014, SimplePortal