Debug Netlinx
adys
Junior Member
Hi all
I have problems with netlinx debugger
The debuger stops all the time in this code, not matter what I do...
DATA_EVENT[vdvDEVICE]
{
COMMAND:
{
STACK_VAR CHAR datum[30]
STACK_VAR CHAR cCOMMAND[20][20]
IF (nDEBUG > 2)
Its code of a DVD module
I can't debug nothing unless I remarke this code.
Any ideas?
Another thing if I am here...
I know that in Netlinx all the vars behave as in reference in C++
what is the way to pass vars "by value"?
thanks
Adys
I have problems with netlinx debugger
The debuger stops all the time in this code, not matter what I do...
DATA_EVENT[vdvDEVICE]
{
COMMAND:
{
STACK_VAR CHAR datum[30]
STACK_VAR CHAR cCOMMAND[20][20]
IF (nDEBUG > 2)
Its code of a DVD module
I can't debug nothing unless I remarke this code.
Any ideas?
Another thing if I am here...
I know that in Netlinx all the vars behave as in reference in C++
what is the way to pass vars "by value"?
thanks
Adys
Comments
-
There is nothing wrong with that code snippet. It's more likely what comes directly after, or something with the nDEBUG value.
Unfortunately, you can't pass a variable to a function by value. The best you can do is duplicate it inside the function by making a variable of the same type, then assigning the parameter value to that, and working with that one instead of the actual parameter. -
DHawthorne wrote:There is nothing wrong with that code snippet. It's more likely what comes directly after, or something with the nDEBUG value.
Unfortunately, you can't pass a variable to a function by value. The best you can do is duplicate it inside the function by making a variable of the same type, then assigning the parameter value to that, and working with that one instead of the actual parameter.
The debugger keep on stoping all the time even that there is no breakpoint.... -
Yes, but being as this is the last line of code that passes without the debugger stopping, it stands to reason that this code is OK ... it what comes next that stalls it, and it stalls it badly enough that it never acknowledges it was even running.adys wrote:The debugger keep on stoping all the time even that there is no breakpoint....
This is a common issue, by the way, with how NetLinx Studio inserts debug tokens. Even on compile errors, you often get a bad line reported as being a line, or several lines, in front of the actual problem. -
DHawthorne wrote:Yes, but being as this is the last line of code that passes without the debugger stopping, it stands to reason that this code is OK ... it what comes next that stalls it, and it stalls it badly enough that it never acknowledges it was even running.
This is a common issue, by the way, with how NetLinx Studio inserts debug tokens. Even on compile errors, you often get a bad line reported as being a line, or several lines, in front of the actual problem.
Ok
here is the full code
DATA_EVENT[vdvDEVICE]
{
COMMAND:
{
STACK_VAR CHAR datum[30]
STACK_VAR CHAR cCOMMAND[20][20]
IF (nDEBUG > 2)
SEND_STRING dvdDebug, "'UI/Virtual Device 1 received from Comm: ',data.text"
datum = remove_string(data.text, '-', 1)
SWITCH(datum) {
CASE 'TITLECOUNTER-':
{
m_DVDMode = 1
//SEND_COMMAND dvTPList, "'@TXT',nTXT_BTN[1],DATA.TEXT"
SEND_STRING dvdDebug,"'dvd CMD TITLECOUNTER'"
SEND_STRING dvdDebug,DATA.TEXT
m_TITLECOUNTER = DATA.TEXT
}
CASE 'TITLEINFO-':
{
fnPARSE(',',DATA.TEXT,cCOMMAND)
IF(cCOMMAND[1] == '-2147483648')
{
//SEND_COMMAND dvTPList, "'@TXT',nTXT_BTN[2],'TITLE: --'"//TITLE
m_TITLEINFO = "'TITLE: --'"
}
ELSE
{
//SEND_COMMAND dvTPList, "'@TXT',nTXT_BTN[2],'TITLE: ',cCOMMAND[1]"//TITLE
m_TITLEINFO = "'TITLE: ',cCOMMAND[1]"
}
SEND_STRING dvdDebug,"'dvd CMD TITLEINFO'"
SEND_STRING dvdDebug,cCOMMAND[1]
SEND_STRING dvdDebug,m_TITLEINFO
}
CASE 'TRACKCOUNTER-':
{
m_DVDMode = 0
SEND_COMMAND dvTPList, "'@TXT',nTXT_BTN[1],DATA.TEXT"
SEND_STRING dvdDebug,"'dvd CMD TRACKCOUNTER'"
SEND_STRING dvdDebug,DATA.TEXT
m_TRACKCOUNTER = DATA.TEXT
}
CASE 'TRACKINFO-':
{
SEND_COMMAND dvTPList, "'@TXT',nTXT_BTN[3],DATA.TEXT"
fnPARSE(',',DATA.TEXT, cCOMMAND)
IF(cCOMMAND[1] == '-2147483648')
{
//SEND_COMMAND dvTPList, "'@TXT',nTXT_BTN[3],'CHP/TRK: -- '"//CHAPTER
m_TRACKINFO = "'CHP/TRK: -- '"
}
ELSE
{
//SEND_COMMAND dvTPList, "'@TXT',nTXT_BTN[3],'CHP/TRK: ',cCOMMAND[1]"//CHAPTER
m_TRACKINFO = "'CHP/TRK: ',cCOMMAND[1]"
}
SEND_STRING dvdDebug,"'dvd CMD TRACKINFO'"
SEND_STRING dvdDebug,cCOMMAND[1]
SEND_STRING dvdDebug,m_TRACKINFO
}
CASE 'VERSION-':
{
sVERSION = DATA.TEXT
}
CASE 'DEBUG-': {
nDebug = atoi(data.text)
IF (nDebug)
SEND_STRING 0, "'Debug messages are now on.'"
ELSE
SEND_STRING 0, "'Debug messages are now off.'"
BREAK
}
}
}
STRING:
{
SEND_STRING dvdDebug,"'dvd STRING'"
SEND_STRING dvdDebug, DATA.TEXT
}
ONLINE:
{
SEND_COMMAND vdvDEVICE, "'TRACKCOUNTERNOTIFY-1'"
SEND_COMMAND vdvDEVICE, "'TITLECOUNTERNOTIFY-1'"
}
}
I don't understand why it stops here without me putting any break point, and without any code that generate "code break point"
If I want to debug any code in my system, I must remark this code.
its very annoying... -
There doesn't look to be anything wrong with that code either
.
Two things I would try though:
1) Make datum a LOCAL_VAR instead of a STACK_VAR. I've seen some strange things happen with SWITCH...CASE and stack variables.
2) Replace the entire SWITCH...CASE with SELECT...ACTIVE.
There are some definite strange, undocumented weirdness about SWITCH...CASE that only appear at run time. I never use it anymore with any value that isn't a simple CHAR or INTEGER. I don't know if it's your problem, but that is where I would start. -
Thanks Dave!
The local_var solved it.
Thanks a lot
Ady -
Great

I would really like to see better documentation on the limits of SWITCH...CASE statements. -
Debugger and STACK_VAR
I'm sitting in Programmer II and have encountered a similiar debugging problem as described earlier in this thread.
Here's the code:
DATA_EVENT[dvTP_Main]
{
STRING:
{
LOCAL_VAR iTest;
STACK_VAR INTEGER iIpNode;
aTPBuff = "aTPBuff,DATA.TEXT";
IF (FIND_STRING(aTPBuff, 'KEYP-', 1))
{
REMOVE_STRING(aTPBuff, 'KEYP-', 1);
iIpNode = ATOI(aTPBuff);
IF (iIpNode >= 1 && iIpNode <= 254)
{
aUserClientIpAddress = "CLIENT_IP_SUB, ITOA(iIpNode)";
SEND_COMMAND dvTP_Main, "'^TXT-154,0,', aUserClientIpAddress";
ON[dvTP_Main, 151];
}
ELSE
{
SEND_COMMAND dvTP_Main, "'^TXT-154,0,INVALID IP'";
OFF[dvTP_Main, 151];
}
}
ELSE IF (FIND_STRING(aTPBuff, 'KEYB-', 1))
{
REMOVE_STRING(aTPBuff, 'KEYB-', 1);
IF (!FIND_STRING(UPPER_STRING(aTPBuff), 'ABORT', 1))
{
SEND_COMMAND dvTP_Main, "'^TXT-155,0,',aTPBuff";
SEND_STRING dvClient, "aTPBuff,':'";
}
}
WAIT 20
{
CLEAR_BUFFER aTPBuff;
}
}
}
I can't see the variable TPBuff (which is a VOLATILE global) in the DEBUG window when STACK_VAR INTEGER iIpNode is the first line in that code block. If I change iIpNode to LOCAL_VAR or add another bogus variable that is LOCAL_VAR above it, then everything is fine.
If you look at how the Adys problem was fixed by changing the first line from a STACK to LOCAL then things are working. I think there is something fishy going on with the debugger.... -
One more thing...
I failed to mention that I get the error message
"The compiled TKN file on the master controller doesn't match the source code file on that you have selected to debug with."
I've stripped my code down to about 7-8 lines and it is still happening. -
You get that error when you have not downloaded the code and rebooted the master. You also can get that error when you do not have a single non_volatile variable. Do you have compile with debug info checked under Preferences/NetLinx Compiler?
-
The only time I see "The compiled TKN file on the master controller doesn't match the source code file on that you have selected to debug with." is if I have failed, for some reason, to get the code loaded properly to the master. One little feature of Studio that has tripped me up a couple times is the fact that the path in the send file dialog doesn't necessarily match the "Master Communication Settings." A while back I was working on a two master system and was sending code to one machine while trying to debug on the other.
The other thing that I have done is to have multiple versions of a master AXS file and keep sending a prior version's code to the master. For example, I changed from version 2 to version 3 and then edit for a while, and compile. Send the code but forget to change the file in the file transfer dialog. When I send code to the master, I try to watch the send dialog and make sure that the size of the files sent is not exactly the same as the last time I sent code.
You can telnet into your master and see what code is loaded with the "program info" command. If the return from the master matches what you are trying to debug with, I sure don't know what would be causing the "does not match" warning. -
More infoAMXJeff wrote:You get that error when you have not downloaded the code and rebooted the master. You also can get that error when you do not have a single non_volatile variable. Do you have compile with debug info checked under Preferences/NetLinx Compiler?
What do you mean by not having a single non-volatile variable? Is there a requirement to have at least one?
The code is definitely downloading every time. I've made changes and confirmed that the changes have occurred. -
That's correct. You need at least one non-volatile varialbe for watch variables to work.mkipe wrote:What do you mean by not having a single non-volatile variable? Is there a requirement to have at least one?
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums