[hatari-devel] Debugger usage examples?

Eero Tamminen eerot at users.berlios.de
Sat Jun 11 22:26:31 CEST 2011


Hi,

On lauantai 11 kesäkuu 2011, Laurent Sallafranque wrote:
> Perhaps also the same commands for DSP ?
> 7. disassembling from DSP PC
> 
> 8. show (set ?) dsp registers

Well, it could mention that one just needs to prefix the CPU commands
with "d" (or "dsp" if using full command names) to do the exactly
same operations on DSP.


> Another little question : when I break hatari and use d or dd, I see the
> instructions at PC + some more instructions.
> 
> If I use d or dd again, I can see the next instructions.
> Sometimes, I use d xxx to see instructions at a certain jump address.
> 
> But if I want to return back to current PC address, I have to full write
> it.
> 
> Isn't it possible to have a "d pc" or "dd pc" command ?

Yes:
	d "pc"
	dd "pc"

PC is a variable, but to "evaluate" its value, you need to
put it inside "".

Quotes evaluate expressions and expressions can contain any arithmetic
operations, registers, breakpoint variables or loaded symbol names.
For example:
	d "pc + d0 + (a0) * ($200) - (a1) & %101 - 1"
	d "text"

See "help evaluate" (or "h e") for more info.


The reason why evaluating needs "", is that otherwise parser
cannot differentiate what's a range and what's a subtraction
operation.

I.e. if expressions weren't quoted, you couldn't give a range
to disassemble as e.g:
	d $100-$120
would complain about invalid disassembly address $ffffffe0
(as these are unsigned values, -$20 wraps around).


Currently only command where expression doesn't need quoting is
address breakpoint ("a").

Same can be done for any command that either:
- takes only a single input value and never more, or
- all other input to the command is separated by some character
  that cannot be used in the expressions.

In case of "a" command, the options are separated with ':' character
which isn't used by expressions.

However, currently there aren't any other such commands,
besides "a" and "c" (continue), but for "c" I didn't think
non-quoted expression evalution to be necessary. :-)


One possibility would be separate range values with some other character
like ':' instead of '-':
	d $100:$200

Then you could instead of:
	d "pc"-"pc+$20"
use:
	d pc:pc+$20
	d pc

Same for the "m" command.


	 Eero

PS. Quotes evaluate the expression before the command itself is parsed,
but in earlier mail I mentioned about possibility of adding some
syntax with which one can tell that instead an expression within
breakpoint should be evaluated always when that breakpoint is checked.



More information about the hatari-devel mailing list