Debugging tips?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, LCMark

Locked
Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Location: Aalst, Belgium
Contact:

Debugging tips?

Post by Janschenkel » Wed Jun 05, 2013 10:59 am

Hi guys,

While working on the filter enhancements, I ran into problems where the IDE decided to not start completely - I guess because it uses the 'filter' command extensively and I screwed the pooch :-(
So I decided to test my work by adding a 'tinker' command and putting the code into it. I followed the recipe for the 'map' command and the script editor does recognize the 'tinker' command as a built-in thing, but fails to parse things. So obviously I made a mistake in my code.
Now I'd like to debug to see where I went wrong.

I'm using the latest Xcode on OS X Mountain Lion.
I set a breakpoint on the line where I want to start debugging, but it never seems to get there.

Can anyone give me hints as to how I can debug?

TIA,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Debugging tips?

Post by mwieder » Wed Jun 05, 2013 6:36 pm

<not at an OSX machine at the moment> Does OSX support strace? gdb?
Any hints in the console log?

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1209
Joined: Thu Apr 11, 2013 11:27 am

Re: Debugging tips?

Post by LCMark » Wed Jun 05, 2013 8:40 pm

The script editor syntax highlighting is derived from the keyword tables - so if it's highlighting but not parsing it might be that you've missed adding the tinker command's constructor to the MCN_new_statement in newobj.cpp.

An alternative option is to debug your filter changes in the standalone engine with a stack that just has your script for testing it out. You can do this by running the standalone target in debug mode and setting a TEST_STACK environment variable to point to the stack to load on startup.

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Location: Aalst, Belgium
Contact:

Re: Debugging tips?

Post by Janschenkel » Wed Jun 05, 2013 9:18 pm

Looks like I have gdb and it's running as soon as I launch LiveCode from within Xcode.
Here's the beginning of the Xcode console output:

Code: Select all

GNU gdb 6.3.50-20050815 (Apple version gdb-1824) (Wed Feb  6 22:51:23 UTC 2013)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys000
sharedlibrary apply-load-rules all
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Location: Aalst, Belgium
Contact:

Re: Debugging tips?

Post by Janschenkel » Wed Jun 05, 2013 9:30 pm

@runrevmark
I did extend the switch structure in newobj.cpp - as a copy+paste+adapt artist I slavishly followed your example ;-)
Anyway, I pushed it to an experiment branch here https://github.com/quartamsoftware/live ... er_command
Just in case anybody wants to take a look and point out my silly mistake.

Cheers,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1209
Joined: Thu Apr 11, 2013 11:27 am

Re: Debugging tips?

Post by LCMark » Wed Jun 05, 2013 9:41 pm

@Janschenkel: You've done what I have done many times... Put the entry in the command_table in the wrong place - the engine does a binary-search on the table and so things need to be in alphabetically order - tinker has to go after throw :)

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Location: Aalst, Belgium
Contact:

Re: Debugging tips?

Post by Janschenkel » Wed Jun 05, 2013 10:17 pm

Well that was embarrassing - and now the debug breakpoint kicks in where I want it to.
Turns out I had a few more mistakes to fix, but your post put the train back on the rails.
Thanks, Mark! Going to add a big red note that all table entries must be in alphabetical order...

Cheers,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Locked

Return to “Engine Contributors”