/media/bill/PROJECTS/Qnial/1_bug hunt summary.txt apos unbalanced search use : #] path_write_strLAposUnbalanced IS OP path - write lines of path with unbalanced apos # IF flag_break THEN BREAK ; ENDIF ; use "nextv" (change from "stepv" by typing "nextv") to skip over operator calls : ********************** Linux : launch leafpad from filemanager, using command : leafpad --tab-width=3 %f ****************** at [start,end] on .ndf files, use a specialised varName f_start_end_strings : f_start_end_strings := 'strings.ndf' ; loaddefs_start f_start_end_strings ; loaddefs_ended f_start_end_strings ; #*********************************************************** # DEBUGGING tools - see : # debugging code - "/media/bill/PROJECTS/Qnial/1_bug hunt template for ndf files.txt" # general principles - "/media/bill/PROJECTS/Qnial/1_Debugging.txt" # Handy to debug - standard tests setup # test_comment IS OP t_name t_input t_standard t_result - means of testing string answers # is in "strings.ndf" # for examples, see : # /media/bill/PROJECTS/Qnial/code tests/strings- sed tests.ndf # /media/bill/PROJECTS/Qnial/code tests/sym_stdForm- tests.ndf #*********************************** # Debugging setup and reminders # Copy this to the desired breakpoint. Can toggle off in debug mode to continue routine. # IF flag_break THEN BREAK ; ENDIF ; # IF flag_writescreen THEN Writescreen routine ; ENDIF ; # IF flag_writescreen THEN writescreen link routine ' ' (string line_count); ENDIF ; # for tests using test_comment - don't use "write" use : # write_testStr '' ; # EACH write_testStr strList ; # use "nextv" in BREAKs!! #] Debugging - problem with trapping faults: From: /media/bill/HOWELL_BASE/Qnial/v6testing/0a_notebook.txt 7. Command line options OK-supresses fault triggering # Faults occur normally during searches, and must not stop execution! # Howell approach : /home/bill/bin/qnial uses -s invocation, which suppresses fault triggering # # watch : awesome eQNial power!! # X gets count 5; # watch !x 'write ''X changed to: '' X' flag_break := o ; % stop execution to test local environment ; flag_check := o ; % force checking of all operators with examples, showing results ; flag_debug := l ; % include additional output to help debug results ; flag_fault := o ; fon IS { NONLOCAL flag_break ; flag_break := l } foff IS { NONLOCAL flag_break ; flag_break := o } # doesn't seem to work - really screws up variable assigments? program_break IS { IF flag_break = l THEN Break ; ENDIF ; } # setdeftrace " l settrigger o ; # write_debug writes to the screen # writefile_debug writes to the debug FILE! (log file for debug) # Change p_debug for each project!!! # 16Aug2017 - doesn't work!! write_debug IS OP AAA { IF flag_debug THEN EACHRIGHT write (rows picture AAA) ; ENDIF ; } writefile_debug IS OP AAA { LOCAL fot p_debug ; NONLOCAL d_QNial_temp ; IF flag_debug THEN p_debug := link d_QNial_temp '0_QNial debug log.txt' ; fot := open p_debug "a ; fot EACHRIGHT writefile (rows picture AAA) ; close fot ; ENDIF ; } killfile_debug IS { LOCAL fot p_debug ; NONLOCAL d_QNial_temp ; IF flag_debug THEN p_debug := link d_QNial_temp '0_QNial debug log.txt' ; host link 'rm "' p_debug '"' ; ENDIF ; } # might want a different file for each project? writefile_log IS OP AAA { LOCAL fot p_log ; NONLOCAL d_QNial_temp ; p_log := link d_QNial_temp '0_QNial log.txt' ; fot := open p_log "a ; fot EACHRIGHT writefile (rows picture AAA) ; close fot ; } killfile_log IS { LOCAL fot p_log ; NONLOCAL d_QNial_temp ; p_log := link d_QNial_temp '0_QNial log.txt' ; host link 'rm "' p_log '"' ; } # important for text files fault_eof := ??eof ; #******************************** # Debugging - problem with trapping faults: routine := '/home/bill/Qnial/MY_NDFS/Dell64_HD_backup.ndf' ; flag_writescreen := o ; flag_break := l ; % Set this to track things or not at break point ; flag_debug := l ; #*********************************************** DEBUGGING COMMANDS From QNial Language Definition - earlier version 6.3 The debugging commands permit resumption of execution in several forms, with or without the display of data computed during execution. The commands are: Command Effect step(v) [N] step executes the next executable expression (displayed after ?..) in either the current definition or in a definition called within the current expression. It steps into definitions called within an expression. If stepv is used, the value of the executed expression is displayed. If N is provided (N>=1) then the command is executed N times before the user is prompted again. next(v) [N] next is similar to step except that it does not go into definition calls, but rather, executes a definition within a the current expression quietly. It is used to trace the statements within one definition, without showing the detailed execution of definitions that are called by the current expression. If nextv is used, the value of the executed expression is displayed. If N is provided then the command is executed N times before the user is prompted again. stepin [N] stepin is the same as step except that it traces the evaluation of the next expression to be executed. It is useful for seeing the details of how an expression is computing its value. toend(v) toend executes to the end of a loop or of a definition. It is useful if you want to skip all of the remaining expressions within a loop or an expression sequence in a definition and stop on the first expression after the loop or definition call. resume resume continues program execution until either another break or fault is encountered, or until the expression being executed completes. The debugging facilities can be used in a number of different ways. For example, you can step forward from a breakpoint using nextv, stepv, or stepin, depending on the details you wish to observe. If a breakin is used to break in a definition then you may want to use next to move quickly to the area where the problem is. Alternatively, you can edit the definition and insert a Break expression at the point of concern and reload the definition. Then execution will be interrupted at that point and you can enter variable references to observe the value of variables that affect the computation, or try out parts of the next expression to be executed to see why it is not working as expected. Another way to get debugging started at a convenient place is to place a watch on a variable with its corresponding action being a break. See the section below on the Watch Mechanism. The debugging commands step and next have special behaviour for the control structure expressions such as if-then-else and while-do expressions. When the next expression is a control structure expression only two lines of it are displayed. If next or step are given as the command, then the next expression becomes one of the components in the control structure expression. For example, in an if-expression, the next expression becomes the boolean expression following IF. Nothing is executed, just the focus of debugging has moved into the control construct. If the value versions of the command are used, then on the execution of the last expression in the control construct, both the value for the last expression and the value for the entire control construct are displayed. The toend command serves a dual purpose: it is used to terminate a loop, or to terminate a definition. If execution is in a loop and toend is given as the command, then all the remaining iterations of the loop are executed and execution stops after completion of the loop. If the current loop is nested within another, only the inner loop is executed to completion. If the toend command is given at the debug prompt and the current expression is not within a loop, then the execution continues to the end of the definition. If the definition had been called during the execution of an expression by using step or stepv then the execution will stop on the expression following the definition. If the break that started debug mode was in the definition, then toend behaves like resume. In the rare case where there is a conflict between a variable name and a debugging command you can precede an expression given in the debugging loop with a backslash (\) to indicate that it is an expression to be evaluated. ******************* 12Feb2018 "Segmentation fault" error - Qnial7 crashes This happened when doing simple text file processing : # /media/bill/PROJECTS/Qnial/MY_NDFS/conf papers & author emails.ndf and AFTER I had just defined a string operator : strings_between IS OP strStrt strEndr strIn +-----+ https://www.cyberciti.biz/tips/segmentation-fault-on-linux-unix.html Why Does The Segmentation Fault Occur on Linux / UNIX Systems? last updated September 12, 2008 A segmentation fault occurs when a program attempts to access a memory location that it is not allowed to access, or attempts to access a memory location in a way that is not allowed (for example, attempting to write to a read-only location, or to overwrite part of the operating system). Segmentation fault can also occur under following circumstances: a) A buggy program / command, which can be only fixed by applying patch. b) It can also appear when you try to access an array beyond the end of an array under C programming. c) Inside a chrooted jail this can occur when critical shared libs, config file or /dev/ entry missing. d) Sometime hardware or faulty memory or driver can also create problem. e) Maintain suggested environment for all computer equipment (overheating can also generate this problem). Suggestions to debug Segmentation Fault errors To debug this kind of error try one or all of the following techniques : Use gdb to track exact source of problem. Make sure correct hardware installed and configured. Always apply all patches and use updated system. Make sure all dependencies installed inside jail. Turn on core dumping for supported services such as Apache. Use strace which is a useful diagnostic, instructional, and debugging tool. Google and find out if there is a solution to problem. Fix your C program for logical errors such as pointer, null pointer, arrays and so on. Analyze core dump file generated by your system using gdb >> I seem to have a Qnial7 configuration problems >> Might be caused by : calling operators with null arguments, wrong array arguments memory too limited? - easy to check!! string too long? ... Memory at start : +--------+--------+---------+--------+-----+-----+--------+ |free |lgstblk |#freeblks|Wkspc |stack|atom |internal| +--------+--------+---------+--------+-----+-----+--------+ |31904941|31903868| 11|32000000|10000|10000| 1000| +--------+--------+---------+--------+-----+-----+--------+ >> just before crash : 31808716 31901908 21 32000000 10000 10000 2000 >> this shouldn't be the problem >> Try changing workspace to 100 000 000 (three-fold increase) NOTE : Qnial7 manual workspace size 200,000 words command line option +--------+--------+---------+---------+-----+-----+--------+ |free |lgstblk |#freeblks|Wkspc |stack|atom |internal| +--------+--------+---------+---------+-----+-----+--------+ |99904941|99903868| 11|100000000|10000|10000| 1000| +--------+--------+---------+---------+-----+-----+--------+ >> Qnial still crashes ... ************************************* See QNial "Language definition" Debugging CommandsDebugging Commands The debugging commands permit resumption of execution in several forms, with or without the display of data computed during execution. The commands are: Command Effect step(v) [N] step executes the next executable expression (displayed after ?..) in either the current definition or in a definition called within the current expression. It steps into definitions called within an expression. If stepv is used, the value of the executed expression is displayed. If N is provided (N>=1) then the command is executed N times before the user is prompted again. next(v) [N] next is similar to step except that it does not go into definition calls, but rather, executes a definition within a the current expression quietly. It is used to trace the statements within one definition, without showing the detailed execution of definitions that are called by the current expression. If nextv is used, the value of the executed expression is displayed. If N is provided then the command is executed N times before the user is prompted again. stepin [N] stepin is the same as step except that it traces the evaluation of the next expression to be executed. It is useful for seeing the details of how an expression is computing its value. toend(v) toend executes to the end of a loop or of a definition. It is useful if you want to skip all of the remaining expressions within a loop or an expression sequence in a definition and stop on the first expression after the loop or definition call. resume resume continues program execution until either another break or fault is encountered, or until the expression being executed completes. The debugging facilities can be used in a number of different ways. For example, you can step forward from a breakpoint using nextv, stepv, or stepin, depending on the details you wish to observe. If a breakin is used to break in a definition then you may want to use next to move quickly to the area where the problem is. Alternatively, you can edit the definition and insert a Break expression at the point of concern and reload the definition. Then execution will be interrupted at that point and you can enter variable references to observe the value of variables that affect the computation, or try out parts of the next expression to be executed to see why it is not working as expected. Another way to get debugging started at a convenient place is to place a watch on a variable with its corresponding action being a break. See the section below on the Watch Mechanism. The debugging commands step and next have special behaviour for the control structure expressions such as if-then-else and while-do expressions. When the next expression is a control structure expression only two lines of it are displayed. If next or step are given as the command, then the next expression becomes one of the components in the control structure expression. For example, in an if-expression, the next expression becomes the boolean expression following IF. Nothing is executed, just the focus of debugging has moved into the control construct. If the value versions of the command are used, then on the execution of the last expression in the control construct, both the value for the last expression and the value for the entire control construct are displayed. The toend command serves a dual purpose: it is used to terminate a loop, or to terminate a definition. If execution is in a loop and toend is given as the command, then all the remaining iterations of the loop are executed and execution stops after completion of the loop. If the current loop is nested within another, only the inner loop is executed to completion. If the toend command is given at the debug prompt and the current expression is not within a loop, then the execution continues to the end of the definition. If the definition had been called during the execution of an expression by using step or stepv then the execution will stop on the expression following the definition. If the break that started debug mode was in the definition, then toend behaves like resume. In the rare case where there is a conflict between a variable name and a debugging command you can precede an expression given in the debugging loop with a backslash (\) to indicate that it is an expression to be evaluated. ************** Other QNial Language definition p61 erase A Erase the variable or definition specified by the phrase A >> However, the symbol cannot be used in a different role [variable,expression,operator, transformer,etc] enddoc