Debugging

Ive spent days trying to debug, Forgot how painful this is with no interactive debugger.

If I insert a row into a tableview with this code:

   fileView:insertRow(

        {

            isCategory = isCategory,

            rowHeight = rowHeight,

            rowColor = rowColor,

            lineColor = lineColor,

            params = {thewords = file, selected = false},

        }

Then I should be able to access the params in onTouch using this code?

 print (event.target.thewords)

event.target.index   works.

Nope: ‘thewords’ is a field in ‘params’ which is passed to the row builder.  I doubt it is getting attached to the touch object.

If you want to know what fields attached to ‘event.target’, just do this:

for key,value in pairs(event.target) do print(key,value) -- key is field name, value is... well value end

Tip: ZeroBrane works perfectly fine for interactive debugging of Corona apps.

Thank you.

Thats very interesting: I looked Zerobrane last week and am sure I read that it specifically mentioned it couldn’t do live debugging with Corona.

At the moment I still have Jay’s CPM installed. I’ll give Zerobrane another looking at.

What do you mean by live debugging? Do you mean debugging an app ON the device or IN the simulator?

ZeroBrane can definitely do it in the simulator (I have used it).

http://notebook.kulchenko.com/zerobrane/debugging-and-live-coding-with-corona-sdk-applications-and-zerobrane-studio

If you mean on device… that is a very interesting idea. At the very least, you’d need to ensure the debug libraries get built in or there would definitely not be any way to talk to the app debugger. Debug libraries are normally stripped when you build for devices.

build.settings

settings = { build = { neverStripDebugInfo = true, }, }

Just basic debugging in the simulator.

Breakpoints… inspect variable contents… single stepping…

Instead of

 – write some text, 

– run it,

– watch it go bink,

– add 70 print statements to try and work out what is wrong. 

Lua not being strongly typed and the widespread use of variants leads to lots of unexpected nils.

Just typing  variableName instead of variablename is enough to cause a tricky to spot issue.

So Im hoping Zerobrane can help.

As far as the tableView goes, you will need to store the passed in params in the row’s group object when you render the row so it will be available in the touch handler.

Rob

you will need to store the passed in params in the row’s group object when you render the row so it will be available in the touch handler.

After some trial and error, I found that I needed to stick the word ‘row’ into the mix to get at this in the Touch handler

event.row.params.thewords

instead of 

event.target.thewords

> I looked Zerobrane last week and am sure I read that it specifically mentioned it couldn’t do live debugging with Corona.

@sales3, I think it depends on what you mean by “live debugging”, as @roaminggamer said. It can definitely debug Corona applications in the simulator and on the device, but I’ve seen a report that when the user “builds an app with live build enabled”, the app halts on the device. I’m not sure what “live build enabled” means or how to reproduce it. I’m not aware of any other issues with the debugger in ZeroBrane Studio and it supports stepping, breakpoints, stack/watch windows, console execution, tooltips, and other features.

> If you mean on device… that is a very interesting idea.

@roaminggamer, yes, it should be possible as well. I have posted details and the steps on it here (http://notebook.kulchenko.com/zerobrane/corona-on-device-debugging-with-zerobrane-studio), although I haven’t tested with the most recent Corona version. Paul.

@paulclinger,

Re: “Create Live Build”

When you build for Android or iOS, you have a check box option:  “Create Live Build”.

Checking this, allows to make changes to your game on your local machine and have those changed reflected on an actual device running the app/game. 

Basically, Corona starts a server on your machine, then after you install and start the app on your device, any changes to files in that game/app are sent across your local WiFi network to the device.  It then relaunches the app and Violla!  your changes are applied.

If the OP wants to do this + add the ability to debug the ‘running app’ on the device they are probably out of luck.  i.e. Choose one or the other, but not both.  I could be wrong, but I am guessing there may be hidden conflicts here.

> When you build for Android or iOS, you have a check box option:  “Create Live Build”.

> Checking this, allows to make changes to your game on your local machine and have those changed reflected on an actual device running the app/game.

@roaminggamer, thank you for the explanation. This makes sense, although when the app is restarted, the debugging connection should be re-established, but maybe it runs into a conflict with the connection waiting on a port to be freed, which effectively “hangs” it.

Nope: ‘thewords’ is a field in ‘params’ which is passed to the row builder.  I doubt it is getting attached to the touch object.

If you want to know what fields attached to ‘event.target’, just do this:

for key,value in pairs(event.target) do print(key,value) -- key is field name, value is... well value end

Tip: ZeroBrane works perfectly fine for interactive debugging of Corona apps.

Thank you.

Thats very interesting: I looked Zerobrane last week and am sure I read that it specifically mentioned it couldn’t do live debugging with Corona.

At the moment I still have Jay’s CPM installed. I’ll give Zerobrane another looking at.

What do you mean by live debugging? Do you mean debugging an app ON the device or IN the simulator?

ZeroBrane can definitely do it in the simulator (I have used it).

http://notebook.kulchenko.com/zerobrane/debugging-and-live-coding-with-corona-sdk-applications-and-zerobrane-studio

If you mean on device… that is a very interesting idea. At the very least, you’d need to ensure the debug libraries get built in or there would definitely not be any way to talk to the app debugger. Debug libraries are normally stripped when you build for devices.

build.settings

settings = { build = { neverStripDebugInfo = true, }, }

Just basic debugging in the simulator.

Breakpoints… inspect variable contents… single stepping…

Instead of

 – write some text, 

– run it,

– watch it go bink,

– add 70 print statements to try and work out what is wrong. 

Lua not being strongly typed and the widespread use of variants leads to lots of unexpected nils.

Just typing  variableName instead of variablename is enough to cause a tricky to spot issue.

So Im hoping Zerobrane can help.

As far as the tableView goes, you will need to store the passed in params in the row’s group object when you render the row so it will be available in the touch handler.

Rob

you will need to store the passed in params in the row’s group object when you render the row so it will be available in the touch handler.

After some trial and error, I found that I needed to stick the word ‘row’ into the mix to get at this in the Touch handler

event.row.params.thewords

instead of 

event.target.thewords

> I looked Zerobrane last week and am sure I read that it specifically mentioned it couldn’t do live debugging with Corona.

@sales3, I think it depends on what you mean by “live debugging”, as @roaminggamer said. It can definitely debug Corona applications in the simulator and on the device, but I’ve seen a report that when the user “builds an app with live build enabled”, the app halts on the device. I’m not sure what “live build enabled” means or how to reproduce it. I’m not aware of any other issues with the debugger in ZeroBrane Studio and it supports stepping, breakpoints, stack/watch windows, console execution, tooltips, and other features.

> If you mean on device… that is a very interesting idea.

@roaminggamer, yes, it should be possible as well. I have posted details and the steps on it here (http://notebook.kulchenko.com/zerobrane/corona-on-device-debugging-with-zerobrane-studio), although I haven’t tested with the most recent Corona version. Paul.

@paulclinger,

Re: “Create Live Build”

When you build for Android or iOS, you have a check box option:  “Create Live Build”.

Checking this, allows to make changes to your game on your local machine and have those changed reflected on an actual device running the app/game. 

Basically, Corona starts a server on your machine, then after you install and start the app on your device, any changes to files in that game/app are sent across your local WiFi network to the device.  It then relaunches the app and Violla!  your changes are applied.

If the OP wants to do this + add the ability to debug the ‘running app’ on the device they are probably out of luck.  i.e. Choose one or the other, but not both.  I could be wrong, but I am guessing there may be hidden conflicts here.

> When you build for Android or iOS, you have a check box option:  “Create Live Build”.

> Checking this, allows to make changes to your game on your local machine and have those changed reflected on an actual device running the app/game.

@roaminggamer, thank you for the explanation. This makes sense, although when the app is restarted, the debugging connection should be re-established, but maybe it runs into a conflict with the connection waiting on a port to be freed, which effectively “hangs” it.