findbacktrace 0x39e78728(sp) 2000(遍历次数) 0x0002cf00(.text开始) 0x01385d28(.text结束)

findBackTrace命令及C++设置代码

#command info:        find thread back trace.
#command:            findBackTrace.
#created:            jing_taiyang.

#
# findBackTrace sp count startText endText
#
define findBackTrace
    if $argc == 4
        set $addr = $arg0
        set $i = 0
        while $i < $arg1
            if *$addr >= $arg2 && *$addr <= $arg3
                set $value = *$addr
                printf "stackAddr(0x%x) returnAddr(0x%x)\n",$addr, $value 
                info line *$value
            end
            set $i++
            set $addr++
            set $addr++
            set $addr++
            set $addr++
            
        end
    else
        printf "argment not ok\n"
    end
end


#
# C++ related beautifiers (optional)
#

set height 0
set print pretty on
set print object on
set print static-members on
set print vtbl on
set print demangle on
set demangle-style gnu-v3
set print sevenbit-strings off
 

 

.text:00000000001CDABC .text:00000000001CDABC ; =============== S U B R O U T I N E ======================================= .text:00000000001CDABC .text:00000000001CDABC ; Attributes: bp-based frame .text:00000000001CDABC .text:00000000001CDABC sub_1CDABC ; CODE XREF: sub_1CDAB8↑p .text:00000000001CDABC ; sub_1CE2A4↓p ... .text:00000000001CDABC .text:00000000001CDABC var_C = -0xC .text:00000000001CDABC var_8 = -8 .text:00000000001CDABC var_4 = -4 .text:00000000001CDABC var_s0 = 0 .text:00000000001CDABC var_s8 = 8 .text:00000000001CDABC .text:00000000001CDABC ; __unwind { .text:00000000001CDABC SUB SP, SP, #0x20 .text:00000000001CDAC0 STP X29, X30, [SP,#0x10+var_s0] .text:00000000001CDAC4 ADD X29, SP, #0x10 .text:00000000001CDAC8 BL sub_519C28 .text:00000000001CDACC MOV W8, #0x2170 .text:00000000001CDAD0 MOV W9, #0xEF1E .text:00000000001CDAD4 STUR W8, [X29,#var_4] .text:00000000001CDAD8 MOV W8, #0xE985 .text:00000000001CDADC STP W8, W9, [SP,#0x10+var_C] .text:00000000001CDAE0 CBZ WZR, loc_1CDAF0 .text:00000000001CDAE4 LDP X29, X30, [SP,#0x10+var_s0] .text:00000000001CDAE8 ADD SP, SP, #0x20 ; &#39; &#39; .text:00000000001CDAEC RET .text:00000000001CDAF0 ; --------------------------------------------------------------------------- .text:00000000001CDAF0 .text:00000000001CDAF0 loc_1CDAF0 ; CODE XREF: sub_1CDABC+24↑j .text:00000000001CDAF0 BL sub_4FFFD8 .text:00000000001CDAF0 ; } // starts at 1CDABC .text:00000000001CDAF0 ; End of function sub_1CDABC .text:00000000001CDAF0 .text:00000000001CDAF4 .text:0000000000519C28 .text:0000000000519C28 ; =============== S U B R O U T I N E ======================================= .text:0000000000519C28 .text:0000000000519C28 .text:0000000000519C28 sub_519C28 ; CODE XREF: sub_1CDABC+C↑p .text:0000000000519C28 ; sub_453D4C+B8↑p ... .text:0000000000519C28 .text:0000000000519C28 var_30 = -0x30 .text:0000000000519C28 var_28 = -0x28 .text:0000000000519C28 var_20 = -0x20 .text:0000000000519C28 var_10 = -0x10 .text:0000000000519C28 var_8 = -8 .text:0000000000519C28 .text:0000000000519C28 ; __unwind { // loc_51A310 .text:0000000000519C28 PACIASP .text:0000000000519C2C STR X30, [SP,#var_20]! .text:0000000000519C30 STP X20, X19, [SP,#0x20+var_10] .text:0000000000519C34 LDR X20, [X0] .text:0000000000519C38 MOV X19, X0 .text:0000000000519C3C BL sub_5001EC .text:0000000000519C40 MOV X8, #0x434C4E47432B2B .text:0000000000519C50 CMP X8, X20,LSR#8 .text:0000000000519C54 SUB X8, X19, #0x60 ; &#39;`&#39; .text:0000000000519C58 B.NE loc_519CA8 .text:0000000000519C5C LDUR W10, [X19,#-0x28] .text:0000000000519C60 LDR X9, [X0] .text:0000000000519C64 CMP W10, #0 .text:0000000000519C68 CNEG W10, W10, MI .text:0000000000519C6C CMP X8, X9 .text:0000000000519C70 ADD W10, W10, #1 .text:0000000000519C74 STUR W10, [X19,#-0x28] .text:0000000000519C78 B.EQ loc_519C84 .text:0000000000519C7C STUR X9, [X19,#-0x30] .text:0000000000519C80 STR X8, [X0] .text:0000000000519C84 .text:0000000000519C84 loc_519C84 ; CODE XREF: sub_519C28+50↑j .text:0000000000519C84 LDR W8, [X0,#8] .text:0000000000519C88 SUB W9, W8, #1 .text:0000000000519C8C LDUR X8, [X19,#-8] .text:0000000000519C90 STR W9, [X0,#8] .text:0000000000519C94 LDP X20, X19, [SP,#0x20+var_10] .text:0000000000519C98 MOV X0, X8 .text:0000000000519C9C LDR X30, [SP+0x20+var_20],#0x20 .text:0000000000519CA0 AUTIASP .text:0000000000519CA4 RET .text:0000000000519CA8 ; --------------------------------------------------------------------------- .text:0000000000519CA8 .text:0000000000519CA8 loc_519CA8 ; CODE XREF: sub_519C28+30↑j .text:0000000000519CA8 LDR X9, [X0] .text:0000000000519CAC CBNZ X9, loc_519CCC .text:0000000000519CB0 STR X8, [X0] .text:0000000000519CB4 ADD X8, X19, #0x20 ; &#39; &#39; .text:0000000000519CB8 LDP X20, X19, [SP,#0x20+var_10] .text:0000000000519CBC MOV X0, X8 .text:0000000000519CC0 LDR X30, [SP+0x20+var_20],#0x20 .text:0000000000519CC4 AUTIASP .text:0000000000519CC8 RET .text:0000000000519CCC ; --------------------------------------------------------------------------- .text:0000000000519CCC .text:0000000000519CCC loc_519CCC ; CODE XREF: sub_519C28+84↑j .text:0000000000519CCC BL sub_4FFFD8 .text:0000000000519CD0 BL sub_1CDABC .text:0000000000519CD0 ; } // starts at 519C28 .text:0000000000519CD4 .text:0000000000519CD4 loc_519CD4 ; CODE XREF: sub_2E4C04+C↑p .text:0000000000519CD4 ; sub_31C574+C↑p .text:0000000000519CD4 ; __unwind { // loc_51A310 .text:0000000000519CD4 PACIASP .text:0000000000519CD8 STP X29, X30, [SP,#0x20+var_30]! .text:0000000000519CDC MOV X29, SP .text:0000000000519CE0 SUB X0, X0, #0x80 .text:0000000000519CE4 BL sub_51A1D4 .text:0000000000519CE8 LDP X29, X30, [SP+0x30+var_30],#0x10 .text:0000000000519CEC AUTIASP .text:0000000000519CF0 RET .text:0000000000519CF0 ; End of function sub_519C28 .text:0000000000519CF0 .text:0000000000519CF4 .text:0000000000519CF4 ; =============== S U B R O U T I N E ======================================= .text:0000000000519CF4 .text:0000000000519CF4 ; Attributes: noreturn .text:0000000000519CF4 .text:0000000000519CF4 sub_519CF4 .text:0000000000519CF4 BL sub_1CDABC .text:0000000000519CF4 ; } // starts at 519CD4 .text:0000000000519CF4 ; End of function sub_519CF4 .text:0000000000519CF4 .text:0000000000519CF8 .text:0000000000519CF8 ; =============== S U B R O U T I N E ======================================= .text:0000000000519CF8 .text:0000000000519CF8 ; Attributes: noreturn bp-based frame .text:0000000000519CF8 .text:0000000000519CF8 sub_519CF8 ; CODE XREF: sub_2E4BC0+40↑p .text:0000000000519CF8 ; sub_31C530+40↑p ... .text:0000000000519CF8 .text:0000000000519CF8 var_s0 = 0 .text:0000000000519CF8 var_s8 = 8 .text:0000000000519CF8 var_s10 = 0x10 .text:0000000000519CF8 var_s18 = 0x18 .text:0000000000519CF8 var_s20 = 0x20 .text:0000000000519CF8 var_s28 = 0x28 .text:0000000000519CF8 .text:0000000000519CF8 ; __unwind { .text:0000000000519CF8 PACIASP .text:0000000000519CFC STP X29, X30, [SP,#-0x30+var_s0]! .text:0000000000519D00 STP X22, X21, [SP,#var_s10] .text:0000000000519D04 STP X20, X19, [SP,#var_s20] .text:0000000000519D08 MOV X29, SP .text:0000000000519D0C MOV X19, X2 .text:0000000000519D10 MOV X20, X1 .text:0000000000519D14 MOV X21, X0 .text:0000000000519D18 BL sub_5001EC .text:0000000000519D1C MOV X22, X0 .text:0000000000519D20 BL sub_4FFFC4 .text:0000000000519D24 STUR X0, [X21,#-0x60] .text:0000000000519D28 BL sub_500018 .text:0000000000519D2C MOV X8, #0x2B00 .text:0000000000519D30 MOV W9, #1 .text:0000000000519D34 MOVK X8, #0x432B,LSL#16 .text:0000000000519D38 MOVK X8, #0x4E47,LSL#32 .text:0000000000519D3C MOVK X8, #0x434C,LSL#48 .text:0000000000519D40 STR X8, [X21,#-0x20]! .text:0000000000519D44 LDR W8, [X22,#8] .text:0000000000519D48 STUR X0, [X21,#-0x38] .text:0000000000519D4C MOV X0, X21 .text:0000000000519D50 STUR X19, [X21,#-0x48] .text:0000000000519D54 SUB X19, X21, #0x60 ; &#39;`&#39; .text:0000000000519D58 ADD W8, W8, #1 .text:0000000000519D5C STP X9, X20, [X21,#-0x58] .text:0000000000519D60 STR W8, [X22,#8] .text:0000000000519D64 NOP .text:0000000000519D68 ADR X8, sub_519D7C .text:0000000000519D6C STR X8, [X21,#8] .text:0000000000519D70 BL sub_51B870 .text:0000000000519D74 MOV X0, X19 .text:0000000000519D78 BL sub_519DE4 .text:0000000000519D78 ; } // starts at 519CF8 .text:0000000000519D78 ; End of function sub_519CF8 .text:0000000000519D78 .text:0000000000519D7C lib name is libanogs now send full fixed script for hook complete both
最新发布
11-16
/* lcf file for MPC5634M processor */ /* */ /* 1.5 MB Flash, 94KB SRAM */ MEMORY { resetvector: org = 0x00000000, len = 0x00000008 APP_ENTRY: org = 0x00010000, len = 0x00000100 init: org = 0x00010100, len = 0x00000F00 exception_handlers: org = 0x00011000, len = 0x00001000 internal_flash: org = 0x00012000, len = 0x0006C800 /*434K*/ crc32_flash: org = 0x0007E800, len = 0x00001800 /*6K*/ ASW_flash: org = 0x00080000, len = 0x00080000 /*512K*/ cal_flash: org = 0x00100000, len = 0x00020000 /*128K*/ cal_ram: org = 0x40000000, len = 0x00008000 /*32K*/ internal_ram: org = 0x40008000, len = 0x0000A800 /*42K*/ crc32_ram: org = 0x40012800, len = 0x00001800 /*6K*/ heap : org = 0x40014000, len = 0x00002000 /*8K*/ stack : org = 0x40016000, len = 0x00001800 /*6K*/ } /* This will ensure the rchw and reset vector are not stripped by the linker */ FORCEACTIVE { "bam_rchw" "bam_resetvector" } SECTIONS { .__bam_bootarea LOAD (0x00000000): {} > resetvector .app_entry (VLECODE) LOAD(0x00010000) : {} > APP_ENTRY GROUP : { .init LOAD (0x10100) : {} .init_vle (VLECODE) LOAD (_e_init) : { *(.init) *(.init_vle) } } > init .__exception_handlers (VLECODE) LOAD (0x00011000) : {} > exception_handlers /************将应用层代码和const数据放在ASW_flash************/ .ASW_section (VLECODE) ALIGN(0x08) LOAD (0x00080000): { KEEP(*(.ASW_function)) Sensor.o(.text) EEpromSaveVal.o(.text) CanSend.o(.text) CanReceive.o(.text) BKLrn.o(.text) ClTrqMapLrn.o(.text) TmPosCal.o(.text) EngMotCtrl.o(.text) ClCtrl.o(.text) SlopeEst_Single.o(.text) VehCtl.o(.text) SftMotPidCtrl.o(.text) ClMotPidCtrl.o(.text) TrgtGearSub.o(.text) SftCtrl.o(.text) SftCtrl_TrgtCurrSub.o(.text) TempEst.o(.text) AveCalculate_DBzCpi0h.o(.text) BINARYSEARCH_real32_T.o(.text) InValStdJdgSub_EJoZRQLM.o(.text) InValStdJdgSub_INONT01g.o(.text) look1_iflf_binlcapw.o(.text) look1_iflf_binlxpw.o(.text) look2_iflf_binlcapw.o(.text) look2_iflf_binlcpw.o(.text) look2_iflf_binlxpw.o(.text) LookUp_real32_T_real32_T.o(.text) Myfun_TimeChr2eWq0hbv.o(.text) rt_nonfinite.o(.text) rtGetInf.o(.text) rtGetNaN.o(.text) Sensor_data.o(.rodata) const_params.o(.rodata) ClCtrl.o(.rodata) VehCtl_data.o(.rodata) TempEst_data.o(.rodata) } > ASW_flash GROUP : { .text : {} .text_vle (VLECODE) ALIGN(0x08): { *(.text) *(.text_vle) } .rodata (CONST) : { *(.rdata) *(.rodata) } .ctors : {} .dtors : {} extab : {} extabindex : {} } > internal_flash GROUP : { .__uninitialized_intc_handlertable ALIGN(2048) : {} .data : {} .sdata : {} .sbss : {} .sdata2 : {} .sbss2 : {} .bss : {} } > internal_ram .crc32_section LOAD (0x0007E800): { KEEP(*(.crc32_section)) } > crc32_ram /************param_cal************/ .cal_section LOAD (0x00100000) : { KEEP(*(.cal_section)) } > cal_ram } /* Freescale CodeWarrior compiler address designations */ _stack_addr = ADDR(stack)+SIZEOF(stack); _stack_end = ADDR(stack); _heap_addr = ADDR(heap); _heap_end = ADDR(heap)+SIZEOF(heap); /* Exceptions Handlers Location (used in Exceptions.c IVPR initialization)*/ EXCEPTION_HANDLERS = ADDR(exception_handlers); /* L2 SRAM Location (used for L2 SRAM initialization) */ L2SRAM_LOCATION = 0x40000000; ~~~~~~~~~~~~ 以上是mpc5634的链接文件,用codewarrior2.10编译生成的map文件中, .rodata section layout Starting Virtual File address Size address offset --------------------------------- 00000000 00000c 00027a58 0004f4e8 1 .rodata __ppc_eabi_init.o 00000000 00000c 00027a58 0004f4e8 4 @22 __ppc_eabi_init.o 0000000c 000004 00027a68 0004f4f8 8 *fill* 00000010 003800 00027a68 0004f4f8 1 .rodata Motor_MCU_Interface.o 00000010 003800 00027a68 0004f4f8 8 etpu_code Motor_MCU_Interface.o 00003810 00000c 0002b268 00052cf8 1 .rodata Sensor_data.o 00003810 00000c 0002b268 00052cf8 4 Sensor_ConstB Sensor_data.o 0000381c 000004 0002b278 00052d08 8 *fill* 00003820 00001c 0002b278 00052d08 1 .rodata ClCtrl.o 00003820 00001c 0002b278 00052d08 4 ClCtrl_rtZCl2TrqCtrlDataBus ClCtrl.o 0000383c 000004 0002b298 00052d28 8 *fill* 00003840 000030 0002b298 00052d28 1 .rodata VehCtl_data.o 00003840 000030 0002b298 00052d28 8 VehCtl_ConstB VehCtl_data.o 00003870 00005c 0002b2c8 00052d58 1 .rodata TempEst_data.o 00003870 00005c 0002b2c8 00052d58 4 TempEst_ConstP TempEst_data.o 000038cc 000004 0002b328 00052db8 8 *fill* 000038d0 000150 0002b328 00052db8 1 .rodata const_params.o 000038d0 00000c 0002b328 00052db8 4 rtCP_pooled_0JMyuAsMOwil const_params.o 000038e0 000010 0002b338 00052dc8 8 rtCP_pooled_1rHWNHyJ5jD5 const_params.o 000038f0 000009 0002b348 00052dd8 4 rtCP_pooled_2vQMKU01UH0A const_params.o 00003900 000018 0002b358 00052de8 8 rtCP_pooled_3j9sNwln33UW const_params.o 00003918 00000c 0002b370 00052e00 4 rtCP_pooled_435vSzr2B3ga const_params.o 00003924 000024 0002b37c 00052e0c 4 rtCP_pooled_4mXD8NQdYsPP const_params.o UNUSED 00000c ........ ........ rtCP_pooled_7aRblQ8ZikmU const_params.o 00003948 000009 0002b3a0 00052e30 4 rtCP_pooled_BDFUXfRy9FB9 const_params.o UNUSED 0113b8 ........ ........ rtCP_pooled_CxHMTLeDJqOm const_params.o 00003954 00000c 0002b3ac 00052e3c 4 rtCP_pooled_P3IFcUsZHL40 const_params.o 00003960 00001c 0002b3b8 00052e48 4 rtCP_pooled_QTf4115BsApr const_params.o UNUSED 000048 ........ ........ rtCP_pooled_T7LJKz0qDStL const_params.o 0000397c 000009 0002b3d4 00052e64 4 rtCP_pooled_TA1PDX4owOXO const_params.o 00003988 000010 0002b3e0 00052e70 8 rtCP_pooled_Z9xEYqlPuj1U const_params.o UNUSED 00000c ........ ........ rtCP_pooled_elNW18cpOeL9 const_params.o 00003998 000009 0002b3f0 00052e80 4 rtCP_pooled_klAghWKMJZcQ const_params.o 000039a8 000018 0002b400 00052e90 8 rtCP_pooled_mIyM6o03E9NC const_params.o UNUSED 000048 ........ ........ rtCP_pooled_sBIJJlXDbIPs const_params.o UNUSED 00000c ........ ........ rtCP_pooled_sjXc2szChSoS const_params.o 000039c0 000009 0002b418 00052ea8 4 rtCP_pooled_ssalKWy0HONi const_params.o 000039d0 000010 0002b428 00052eb8 8 rtCP_pooled_uRI6StAYhRva const_params.o 000039e0 00001c 0002b438 00052ec8 4 rtCP_pooled_vcTuGzxyBaTT const_params.o UNUSED 0113b8 ........ ........ rtCP_pooled_xdeCXgKaCR9b const_params.o 000039fc 000024 0002b454 00052ee4 4 rtCP_pooled_xgv7ryg6ZEnf const_params.o 00003a20 000010 0002b478 00052f08 1 .rodata MSL_C.PPCEABI.bare.VS.UC.a e_fmod.o 00003a20 000010 0002b478 00052f08 8 Zero MSL_C.PPCEABI.bare.VS.UC.a e_fmod.o 我想把Sensor_data.o 的.rodata数据放在.ASW_section段,应该怎么修改?
07-19
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值