axd(1) | AFNIX Client | axd(1) |
NAME¶
axd - afnix cross debuggerSYNOPSIS¶
axd [options] fileOPTIONS¶
[h]DESCRIPTION¶
axd invokes the AFNIX cross debugger. The axd client permits to debug an AFNIX program by inserting breakpoint at strategic positions in the source code. During a debugging session, when a breakpoint is reached, the program is suspended and the debugger prompt is shown. Since the debugger is based on the AFNIX interpreter, the full power of the AFNIX interpreter is available at the debugger prompt.VERSION¶
The current version is the 2.2.0 release.SEE ALSO¶
axc, axd, axl,NOTES¶
AFNIX comes with an extensive documentation. The documentation is available online or in the doc directory in the form of formatted xhtml documents.AUTHOR¶
axd has been written by (amaury@afnix.org) Amaury Darsch.GETTING STARTED¶
This chapter is short introduction to the cross debugger or axd. The debugger is a special interpreter that is designed to help the developer to trace an application. The debugger is designed to operate in a stand-alone mode or with Emacs. If you plan to use the debugger with Emacs, you will have to install a gud-mode package. A sample debugger sessionzsh> axd (axd)axd:quitDebugger commands
zsh> axi 0501.als major version number : minor version number : patch version number : interpreter version : .. program name : afnix operating system name : linux operating system type : unix afnix official uri : http://www.afnix.orgThe source code for this example is given below.
# many comments before println "major version number : " interp:major-version println "minor version number : " interp:minor-version println "patch version number : " interp:patch-version println "interpreter version : " interp:version println "program name : " interp:program-name println "operating system name : " interp:os-name println "operating system type : " interp:os-type println "afnix official url : " interp:afnix-uriThe debugger is started with the file to debug. The axd:info command can be used to print some information.
zsh> axd 0501.als (axd) axd:info debugger version : .. os name : linux os type : unix initial file : 0501.als form file name : 0501.als form line number : 17 verbose mode : true max line display : 10 defined breakpoints : 0 (axd)Along with the version, initial file name and other information, is the form file name and the form line number that indicates where the debugger is position. Another way to get this information is with the axd:list command that display the file at its current break position.
(axd) axd:list 17 println "major version number : " interp:major-version 18 println "minor version number : " interp:minor-version 19 println "patch version number : " interp:patch-version 20 println "interpreter version : " interp:version 21 println "program name : " interp:program-name 22 println "operating system name : " interp:os-name 23 println "operating system type : " interp:os-type 24 println "afnix official uri : " interp:afnix-uri 25 26 (axd)With this in place it is possible to run the program. The axd:run command will do the job, but will not give you the opportunity to do something since there is no breakpoint installed. So, installing a breakpoint is simply achieved by giving the file name and line number. To make life easier, the axd:break command takes also 0 or argument. Without argument, a breakpoint is set at the current position. With one integer argument, a breakpoint is set at the specified line in the current file. If the verbose mode is active (which is the default), a message is printed to indicate the breakpoint index.
(axd) axd:break 19 setting breakpoint 0 in file 0501.als at line 19 (axd)axd:run major version number : minor version number : breakpoint 0 in file 0501.als at line 19 (axd)The axd:run command starts the program and immediately stops at the breakpoint. Note that the debugger prints a message to indicate the cause of such break. After this, stepping is achieved with the axd:next command. Resuming the execution is done with the axd:continue command. The axd:exit or axd:quit command terminates the session.
(axd)axd:next patch version number : (axd)axd:next interpreter version : -- (axd)axd:continue program name : axd operating system name : linux operating system type : unix afnix official uri : http://www.afnix.org (axd)axd:quit
USING THE DEBUGGER¶
This chapter describes in detail the usage of the cross debugger or axc. The debugger is a special application that is built on top of the interpreter. For this reason, the debugger provides the full execution environment with special commands bound into a dedicated nameset. Invocation and terminationzsh> axd PROGRAM [arguments]When the debugger is started, a prompt '(axd)' indicates that the session is running. The debugger session is terminated with the commands axd:exit or axd:quit.
zsh> axd PROGRAM (axd) axd:quit zsh>Debugger options
zsh> axd [h] usage: axd [options] [file] [arguments] [h] print this help message [v] print version information [i] path add a path to the resolver [e mode] force the encoding mode [f runini] run initial file [f emacs] enable emacs mode [f assert] enable assertion checks [f nopath] do not set initial pathRunning the program
(axd)axd:runThe axd:run is the primary command to execute before the program can be debugged. Eventually, a file name can be used as the primary file to execute.
(axd)axd:run "test.als"Setting program arguments
(axd)interp:argv:reset (axd)interp:argv:append "hello"In this example, the interpreter argument vector is reset and then a single argument string is added to the vector. If one wants to see the interpreter argument vector, a simple procedure can be used as shown below.
const argc (interp:argv:length) loop (trans i 0) (< i argc) (i:++) { trans arg (interp:argv:get i) println "argv[" i "] = " arg }Breakpoints operations
(axd) axd:break "demo.als" 12 Setting breakpoint 0 in file demo.als at line 12In this example, a breakpoint is set in the file demo.als at the line number 12. The file name does not have to be the primary file. If another file name is specified, the file is loaded, instrumented and the breakpoint is set. Viewing breakpoints
(axd) axd:break "demo.als" 12 (axd) axd:break "test.als" 18 (axd) axd:break-info Breakpoint 0 in file demo.als at line 12 Breakpoint 1 in file test.als at line 18Resuming execution
(axd) axd:run Breakpoint 0 in file demo.als at line 12 (axd) axd:continueIn this example, the program is run and stopped at breakpoint 0. The axd:continue command resumes the program execution.
DEBUGGER CONTROL REFERENCE¶
This appendix is a reference of the cross debugger or axd. The cross debugger is started with the axd command. All control commands are bound to the axd nameset. breakaxd:break axd:break "line" axd:break
"file" "line"
(axd) axd:break "demo.als" 12 (axd) axd:break 25The first example sets a breakpoint in the file demo.als at line 12. The second example sets a breakpoint in the current file at line 25. Without argument, the command sets the breakpoint at the current line. The current line can be seen with the axd:info command. break-info
axd:break-info
(axd) axd:break "demo.als" 12 (axd) axd:break "test.als" 18 (axd) axd:break-info Breakpoint 0 in file demo.als at line 12 Breakpoint 1 in file test.als at line 18In this example, two breakpoints are set. One in file demo.als at line 12 and one in file test.als at line 18. The axd:break-info command reports the current breakpoint settings. continue
axd:continue
(axd) axd:run Breakpoint 0 in file demo.als at line 12 (axd) axd:continueIn this example, the program is run and stopped at breakpoint 0. The axd:continue command resumes the program execution. exit
axd:exit
(axd) axd:exitinfo
axd:info
(axd) axd:info debugger version : .. os name : linux os type : unix initial file : 0501 form file name : 0501.als form line number : 17 verbose mode : true max line display : 10 defined breakpoints : 0list
axd:list axd:list "line" axd:list
"file" "line"
(axd) axd:list (axd) axd:list 20 (axd) axd:list "file.als" 20The first example shows the listing at the current debugger line. The second example starts the listing at line 20. The third example starts at line 20 with file file.als. load
axd:load "file"
(axd) axd:load "demo.als"In this example, the file demo.als is set as the primary file. Using the axd:info command will report at which line, the first available form has been found. next
axd:next
(axd) axd:nextquit
axd:quit
(axd) axd:quitrun
axd:run axd:run "file"
(axd) axd:run (axd) axd:run "demo.als"The first example runs the initial file. The second example sets the initial file as demo.als and run it.
2012-03-26 | AFNIX |