📄 debugger.html
字号:
<!doctype html public "-//W3C//DTD HTML 3.2//EN"><html><head><title>The debugger</title><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><meta http-equiv="content-language" content="en" /><meta name="resource-type" content="document"><meta name="copyright" content="This document copyright 2002 by Richard Murray. Use for non-profit and education purposes explicitly granted."><meta name="author" content="Richard Murray"><meta name="rating" content="general"></head><!-- /assembler/debugger.html --><!-- --><!-- (C) Copyright 2002 Richard Murray --><!-- Designed by Richard Murray --><!-- rmurray@heyrick.co.uk --><!-- --><body bgcolor="#f0f0f0" text="#000000" link="#0022dd" vlink="#002288"><table border = "0" width="100%"> <tr> <td align=center width=100> <img src="arm3.gif" width=79 height=78 align = middle> </td> <td> <h1 align="center"><font color="#800080">The debugger</font></h1> </td> <td align=center width=100> <img src="arm3.gif" width=79 height=78 align = middle> </td></table><p> <p>The first thing to remember, is save often. Save, save, and save again.<p> <p>There are two types of debugging. The simplest way to trace a program is to have printstatements. You can make use of the SWI 256 + ASCII to trace your way through a program. Here isa lame and trivial example:<pre> STMFD R13!, {R0-R2, R14} SWI 256 + ASC("A") MOV R1, #1 SWI 256 + ASC("B") MOV R2, #2 SWI 256 + ASC("C") MUL R0, R1, R2 SWI 256 + ASC("D") LDMFD R13!, {R0-R2, PC}</pre>Here, we are simply multiplying two registers. When run, it will print <code>ABCD</code> to thescreen. Applied to a larger program, this method can help you follow code.<p>You can also drop in <code>SWI 256 + 7</code> if you would rather a beep, but use this sparinglyas a beep in a stuck loop is annoying - to say the least!<p> <p>However, sooner or later you'll be wanting to use the debugger built into RISC OS.<p>You are supposed to officially enter the debugger using the <code>*Debug</code> command, but asfar as I can ascertain this just outputs 'Debug' before the * prompt. All the debugger commandscan be called from any OS_CLI handler (the command line, OSCLI, SYS OS_CLI, etc...).<p>The debugger accepts two types of parameter. You can either pass a memory address (a hex number,with or without the ampersand), or a register name, like <code>R12</code>. Often two addressesmay be given, the first address being the start and the second address being the end. The endaddress may be absolute, or an offset. The offset is denoted by a <code>+</code> before thevalue.<br>You can use a negative offset, but it doesn't quite work correctly.<p>Here is an example of a debug session. This is the 'MemTest' program (try looking onarcade.demon.co.uk's filesearch?), and I want to get at it just as it starts...<pre>*Load %.MemTest 8000*MemoryI 8000 +A00 [<i>...snip...</i>]0000806C : .... : 00000000 : ANDEQ R0,R0,R000008070 : ...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -