Debugger
Rick Murray (539) 13850 posts |
Some things that would be nice to see in Debugger (listed in decreasing order of how much their omission bugs me ☺):
|
Jeffrey Lee (213) 6048 posts |
Adding it as a comment would make sense, but changing the disassembled instructions could lead to problems with some code. Consider: .func_one ADR R0,somewhere .common ADD R0,R0,#some_offset ... .func_two ADR R0,somewhere_else B common The debugger won’t know that the ‘common’ label exists, so any attempt to convert the ADR+ADD at the start of func_one into an ADRL will break func_two.
ARMv7 has a NOP instruction (which I think is an undefined instruction on earlier architectures?), so although assemblers may treat NOP as an alias for MOV R0,R0, attempting to perform the same transformation in reverse would be wrong as it would result in disassembly that isn’t guaranteed to result in the same binary when re-assembled. |
Jon Abbott (1421) 2651 posts |
I second Rick. I was debugging some code earlier and getting very frustrated constantly having to convert things in either BASIC or on a calculator, some of these QoL suggestions would have made the code a lot clearer. They should go in the comments though as Jeffrey suggests, so the code is an accurate representation. A few more suggestions:
There’s already a good example of this type of confusion in the Debugger:
Instead of:
|
Colin Ferris (399) 1818 posts |
Using !Zap ARM module/FF8 – If I remember! – you would see:- adr r0,&1000 Clicking on ‘adr’ in the !Zap window – and then the right arrow key – it would take you to &1000 – very useful. Pity something like that couln’t be implemented for use in a Text’ file – Rick had a go in his Windows RO file viewer. |
Jon Abbott (1421) 2651 posts |
Spent another day yesterday with two laptops on my lap, manually working out constant value output from Debugger 😡 Another useful QoL improvement, would be a scrollable Debugger where you can move around memory and follow branches etc, like Zap/StrongEd.
I think StrongEd supports this as well, it certainly works for branches. Not sure I’ve tried an ADR yet. |
Colin Ferris (399) 1818 posts |
Ref begining of thread. adrl r0,&xxxxx &xxxx moved to value by using right arrow key. [edit 1] adrl r0,#&xxxxx Where you work out what the pointer value was. |
Fred Graute (114) 645 posts |
It’s something I’ve looked at for StrongED but have been putting it off in the hope it would be added to Debugger.
The addresses you’re looking at can’t be grabbed by Zap/StrongED?
Yes, StrongED will follow ADR on right arrow key (4.70a13 will also follow ADRL), PC-relative LDR/STR can also be followed. |
Jon Abbott (1421) 2651 posts |
It’s certainly a change that’s required in the Debugger as its currently really inconsistent. For example:
Debugger reports this as:
However,
is reported as:
If the Debugger is trying to report exact encodings, both of these should be reported as:
Of course there’s also the glaring issue with use of pseudo instructions:
being reported as:
No, the machine is in a single tasking mode. I do however dump memory and use StrongEd when I’ve located the code, but it obviously doesn’t help with the unintuitive output Debugger shows for constants. |
Fred Graute (114) 645 posts |
It appears that the different way of displaying immediate constants is by design. If the value is encoded with the lowest possible immediate + shift then the actual value is shown. If this is not the case, ie immediate has bottom two bits clear, then #&xx,yy is used.
Here’s the relevant bit of code from Debugger 2.02
If you RMfaster Debugger and change the indicated branch using MemoryA then it should always output the actual value. |
Jeffrey Lee (213) 6048 posts |
Correct – the ARM ARM stipulates that the “preferred” encoding (I.e. the one that assemblers/compilers should produce by default) is the one which has the smallest possible rotation value, and disassemblers should disassemble to the #xx,rr form whenever an instruction is encountered which is using the non-preferred form. So changing the disassembly of the instruction would be naughty, but adding a comment which shows the expanded 32bit value should be fine (and maybe also a hint for the carry flag value – since #xx,rr is sometimes used explicitly in order to force a specific value) |