Re: [hatari-devel] unexpected output of 'm' with count or range in debugger

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Personally I don't see any benefit printing the whole lines when specifying a count/range. So as far as I am concerned, I'm fine with:

m b $5120 --> print whole line of byte values
m w $5120 --> print whole line of word values
m b $5120 1 --> print one byte
m w $5120 1 --> print one word
m b $5120-$5125 --> print five bytes
m b $5120-$5140 --> print 32 bytes, aligned on 16 (or whatever column value Hatari debugger uses now)



On Tue, 27 Feb 2024 at 21:32, J.Young <jyoung8299@xxxxxxxxxx> wrote:
After talking with Eero the preferred method to see structures in an
organized way is to add a 'promptoff' command which would suppress the
command prompt output when processing the breakpoint file.  It would be
turned back on with either a 'prompton' command or when the breakpoint
file ends/errors.

Is that acceptable to everyone?  Best to get people's opinions on it
before adding the change.

Jeff


On 2/25/24 18:53, J.Young wrote:
> And just because I'm throwing around ideas train-of-thought :), a
> simpler way would just have a command to suppress the output of the
> command prompt while the breakpoint file was processed such as
> 'noprompt'.
>
> Then output of a structure requires no more adjustment of the code
> except the proper recognizing the 'count' and/or '<range> ' to their
> size specifications, i.e. a word or byte, etc.
>
> So then the breakpoint file could be as simple as:
>
> noprompt   ;suppress output of command prompt
> m b sprite_id 1
> m b sprite_x 1
> m b sprite_y 1
> m l sprite_data 4
> prompt    ;output of command prompt back on
>
> That way the user could specify their own structures and use all the
> existing functionality of the 'm' command assuming the size counts are
> output correctly.
>
> On 2/25/24 18:37, J.Young wrote:
>> Or maybe a better way would just extend the functionality of the 'm'
>> command to optionally process a list of sizes:
>>
>> 'm sprite_id struct b b% l w:4'
>>
>> Would print in succession on individual lines with no command prompt
>> in-between:
>>
>> sprite_id: byte value
>> byte: binary byte value
>> long: long value
>> word: 4 word values
>>
>>
>> On 2/25/24 18:27, J.Young wrote:
>>> Thanks, yes, I know about the evaluate command, but that isn't
>>> really what I'm needing.   Wanting to be able to output structures
>>> for reverse engineering.  One of the more challenging aspects of RE
>>> since there is no prior knowledge with raw binaries.  For example,
>>> when decoding sprite object blocks it would be very helpful to be
>>> able to specify a type of structure output.
>>>
>>> Beyond that aspect, the output of 'm b <address> 1' seems
>>> intuitively like it should output a single byte, hence the term
>>> 'count'.  Currently it outputs 1 line.
>>>
>>> Here's an example where some structure values could be useful to
>>> output at a breakpoint or breakpoint :trace:
>>>
>>> Assuming labels are defined and the following in a breakpoint file:
>>> 'm b sprite_id 1'
>>> 'm b sprite_x 1'
>>> 'm b sprite_y 1'
>>> 'm l sprite_data 1'
>>>
>>> so that it would output the labels and their values at the trigger:
>>>
>>> sprite_id:  05
>>> sprite_x:   b0
>>> sprite_y:  80
>>> sprite_data: 5ce00
>>> etc...
>>>
>>> Sometime these sprite blocks have up to 128 bytes of fields of
>>> differing sizes.  Static analysis is helpful, but for some
>>> situations dynamic analysis is the best way to see what some of the
>>> fields in the structure are purposed for.
>>>
>>> Now currently the debugger outputs the command prompt after each
>>> line in the breakpoint file so maybe something like a new command
>>> 'struct' would be appropriate which would take a series of size vars
>>> to output a structure without the prompt interrupting the output?
>>>
>>> Like, 'struct sprite_id b:1 b:%1 b:1 l:1 w:4'  where the b:1 means 1
>>> byte at sprite_id, the next b:1 at sprite_id+1 in binary, etc up to
>>> w:4 which output 4 word from the offset. Does that make sense?
>>>
>>> Jeff
>>>
>>> On 2/25/24 17:47, Eero Tamminen wrote:
>>>> Hi,
>>>>
>>>> On 25.2.2024 23.04, J.Young wrote:
>>>>> Likewise, specifying a range "m b 5120-5120" or "m b 5120-5121"
>>>>> prints an entire line also.
>>>>>
>>>>> The reason I bring this up is that being able to print a byte,
>>>>> word or long only or any arbitrary number instead of line
>>>>> granularity would be very helpful when looking at structures.
>>>>
>>>> You can use "evaluate" command for printing individual address values.
>>>>
>>>> Some examples:
>>>>
>>>> > e ($100).b
>>>>   value at ($100).b = $0
>>>> = %0 (bin), #0 (dec), $0 (hex)
>>>>
>>>> > e (a0 + $100).w
>>>>   value at ($100).w = $e0
>>>> = %11100000 (bin), #224 (dec), $e0 (hex)
>>>>
>>>> > e (basepage).l
>>>>   value at ($1a39c).l = $1a39c
>>>> = %11010001110011100 (bin), #107420 (dec), $1a39c (hex)
>>>>
>>>> Is that good enough?
>>>>
>>>>
>>>>     - Eero
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>
>
>





--
http://mikro.atari.org


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/