jesse stone

Hardware shared lib debugging on Jtag

Discussion created by jesse stone on May 9, 2016

1. Get target load address

cat /proc/*/maps | grep gralloc_viv.imx6.so

ad920000-ad924000 r-xp 00000000 103:02 722 /system/lib/hw/gralloc_viv.imx6.so

 

2. Get lib .text address

/mnt/projects/lollipop_mnt/myandroid/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-readelf -S /mnt/projects/lollipop_mnt/out/matrix_io/android/target/product/matrix_io/system/lib/hw/gralloc_viv.imx6.so

Section Headers:

[Nr] Name Type Addr Off Size ES Flg Lk Inf Al

[ 8] .text PROGBITS 000013d8 0013d8 001988 00 AX 0 0 8

 

0xad920000 + 0x000013d8 = 0xad921d38

 

3. Set to arm-eabi-gdb

click Startup tab

uncheck the all items on startup page

add those lines under [Halt] box but do not check [Halt]

add-symbol-file /mnt/projects/lollipop_mnt/out/matrix_io/android/target/product/matrix_io/system/lib/hw/gralloc_viv.imx6.so 0xad9213d8

apply to debug

 

4. Set breakpoint in a function

/mnt/projects/lollipop_mnt/myandroid/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-readelf -s /mnt/projects/lollipop_mnt/out/matrix_io/android/target/product/matrix_io/system/lib/hw/gralloc_viv.imx6.so

28: 00001af1 456 FUNC GLOBAL DEFAULT 8 _Z25gralloc_alloc_framebu


gralloc_alloc_frame = 0x00001af1 - 0x1 = 0x00001af0 (aligned 4 address in arm cortex)


set break point at target

0xad920000 + 0x00001af0 = 0xad921af0

 

Demo

Picasa Web Albums - Jesse Stone - i.mx6

 

Ref.

Programming Guide: OpenOCD with Eclipse debug u-boot & kernel on i.mx6

Outcomes