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

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


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






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