Fisheries and Oceans Canada / Pêches et Océans Canada - Government of Canada / Gouvernement du Canada Fisheries and Oceans Canada / Pêches et Océans Canada - Government of Canada / Gouvernement du Canada
 
Français Contact Us Help Search Canada Site
Home What's New DFO National Site Map Media

Fisheries & Oceans
 
 
Maritimes Region
Fishing Industry
General Public
Marine & Oceans Industry
Media
Students and Teachers
Scientists and Researchers
 
AconIcon ACON       Home/Topics   |   Commands

Debugging


The debugging commands include: Address, Dissassemble, Debug, Break Point, Remove All Break Points, Local_Variables, Memory Allocations, Memory Show, Stack Show, and Stack Size.


Address

This command requires a single argument, the name of another function. The address of the compiled function is listed. It returns no result.

There is 1 parameter:
function name - the name of any exisiting user-defined function.

address("function name");

address("marker");

Disassemble

This command requires a single argument, the name of another function. The virtual byte code of the compiled function is listed. It returns no result.

There is 1 parameter:
function name - the name of any exisiting user-defined function.

disassemble("function name");\

Function showtime() { print("The time now is ",ctime(time())); }; disassemble("showtime")
0000 06 PUSH
0001 16 02 00 VAR 0002 @16038e: OBJECT @11b172: ´PRINT´ @11b180: C CODE
0004 06 PUSH
0005 15 03 00 LIT 0003 @16039c: ´The time now is ´
0008 06 PUSH
0009 16 04 00 VAR 0004 @1603aa: OBJECT @11bec2: ´CTIME´ @11bed0: C CODE
000c 06 PUSH
000d 16 05 00 VAR 0005 @1603b8: OBJECT @11be7e: ´TIME´ @11be8c: C CODE
0010 20 00 CALL 00
0012 20 01 CALL 01
0014 20 02 CALL 02
0016 1f RETURN

...beauty is in the eye of the beholder...


Debug

This command requires a single argument, the debug flag. When the debug flag is "on" various debugging aids are invokded as they are executed. This command returns no result.

There is 1 parameter:
debug flag - the flag to set the type of debugging. These values may be added together.

0 = no debugging,
1 = disassemble statements as they are executed.
2 = watch memory malloc and free calls for mistakes
4 = print memory malloc and free calls as they are made (auto-enables 2)
8 = tag each malloc block with a check tag word
1024 = assert() invokes machine debugger
debug(debug flag);

debug(1);

initial program state - no debugging


Break Point

This command allows the user to set a break point within a user defined function that has been loaded into memory. This command requires two arguments, the function name and the line number.

This command returns no result.

There are 2 parameters:
function name - string representing the name of the function the user wants to set the breakpoint to.
line number - integer representing the line of the function to set the breakpoint at.

break_point("function_name",line_number);

break_point("TEST1",1);

Note:
see the Acon GUI documentation for more information about the break point editor.


Remove All Break Points

This command removes all the active break points.
This command returns no result.

This command needs no arguments.
remove_all_break_points();

Local_Variables

Local variables simplify variable naming, but are harder to debug when they are not available for inspection. This command requires a single argument, the local variable flag. When the local variable flag is "on" (1), local variables (identified with a leading ´$´) are created and destroyed within the scope of the function in which they occur. When is the local variable flag is "off" (0), local variables have their function name prepended to them, are persistent for the duration of the ACON session, and are globally available for use/inspection. In this fashion they are likely uniquely named, but are not guarenteed to be so. This command affects local variable creation only for functions which are compiled after this command is issued. This command returns no result.

There is 1 parameter:
local variable flag - the flag to set the type of status of local variables.
0 = variables beginning with a ´$´ are prepended with the function name, and are included in the global variable pool,
1 = variables beginning with a ´$´ are local.

Local_Variables(local variable flag);

local_variables(1); /* normal local variables */
Function test() {
$x = 1 * 5;
};
test();
List_Variables();
# of objects = 10
@HOST
...
PI
local_variables(0); /* function ID´d local variables */
Function test2() {
$x = 2 * 5;
};
test2();
List_Variables();
# of objects = 11
@HOST
...
PI
TEST2$X
print(test2$x)
10

initial program state - local variables exist within the scope of the function only.


Memory Allocations

The number of objects currently allocated in memory is returned

n = memory_allocations();

Memory Show

If memory allocation tracking is enabled, then the current memory allocations are listed.

Memory_Show();

Stack Show

The contents of the current execution stack are listed. There are always at least 5 items on the stack. It returns no result.

stack_show();

Stack Size

The size of the current execution stack is returned. There are always at least 5 items on the stack.

stack_size();


AconIcon ACON       Home/Topics   |   Commands



Last Modified : 2003-11-19