Commit 713b89ee authored by Christos Gentsos's avatar Christos Gentsos

General: add tiny utilities to ease reading / debugging asm listings

parent 8d9f057a
#!/usr/bin/bash
# The purpose of the script is to track down what function the assembly code calls.
# for example, for the call in the two lines below:
# 211a: 4b05 ldr r3, [pc, #20] ; (2130 <io_write+0x34>)
# 211c: 4798 blx r3
# the user would have to run `asm_find_func.sh listing_file.lss 2130` and they
# would learn that the function called here is "assert".
num=$(grep $2: "$1" | cut -f2)
numhex=0x$(echo "ibase=16; obase=10; ${num^^}-1" | bc)
numhexwide=$(printf '%08x\n' $numhex)
grep $numhexwide "$1"
#!/usr/bin/bash
# The purpose of the script is to track down the value of a variable accessed
# in an assembly listing. for example, for the call in the line below:
# 61de: 4b25 ldr r3, [pc, #148] ; (6274 <float_to_linear+0xa8>)
# the user would have to run `asm_find_val.sh listing_file.lss 6274`
# to learn the value loaded to r3.
num=$(grep $2: "$1" | cut -f2)
printf '%08x\n' 0x$num
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment