yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 1 | //**************************************************************************
|
| 2 | //*
|
| 3 | //* Copyright (c) 2017 ZTE Corporation.
|
| 4 | //*
|
| 5 | //**************************************************************************
|
| 6 | // penglei
|
| 7 |
|
| 8 | //**************************************************************************
|
| 9 | //* tos/linux/uClinux²Ù×÷ϵͳÄں˴úÂë¶Î±È½Ï£¬²é¿´´úÂë¶ÎÊÇ·ñÓÐÍ»±äµÄÇé¿ö
|
| 10 | //**************************************************************************
|
| 11 |
|
| 12 | local &addressStart
|
| 13 | local &addressEnd
|
| 14 |
|
| 15 |
|
| 16 | //Òª±È½ÏµÄelfÎļþ
|
| 17 | ;&elfname="D:\ramdump\7520v5\0523\vmlinux"
|
| 18 |
|
| 19 | //´´½¨Ò»¸ö´°¿Ú£»
|
| 20 | &width=20.
|
| 21 | &nameWidth=20.
|
| 22 | &fileColumns=90.
|
| 23 | &fileLines=500.
|
| 24 | &diffCount=0
|
| 25 |
|
| 26 | area.create codeDiff &fileColumns &fileLines
|
| 27 | area.clear codeDiff
|
| 28 | area.select codeDiff
|
| 29 | area.open codeDiff codeDiff.txt
|
| 30 | area.view codeDiff
|
| 31 |
|
| 32 | //´ò¿ªÎļþ£»
|
| 33 | &dir=os.pwd()+"\log"
|
| 34 | if !os.dir(&dir)
|
| 35 | (
|
| 36 | mkdir &dir
|
| 37 | )
|
| 38 | &file="&dir\codeDiff.txt"
|
| 39 |
|
| 40 | ;Load Code from Binary and verify specific sections with the Elf file
|
| 41 | //¸ù¾Ý²Ù×÷ϵͳÀàÐÍ»ñÈ¡´úÂë¶ÎÆðʼµØÖ·ºÍ½áÊøµØÖ·
|
| 42 | if symbol.exist(init_task) //linux or uClinux
|
| 43 | (
|
| 44 | &addressStart=sYmbol.SECADDRESS(".head.text")
|
| 45 | &addressEnd=sYmbol.SECEND(".text")
|
| 46 | )
|
| 47 | else if symbol.exist(tos_except) //tos
|
| 48 | (
|
| 49 | &addressStart=sYmbol.SECADDRESS(".rom_vectors")
|
| 50 | &addressEnd=sYmbol.SECADDRESS(".data")
|
| 51 | )
|
| 52 | else
|
| 53 | (
|
| 54 | area.close codeDiff
|
| 55 | ENDDO
|
| 56 | )
|
| 57 | print FORMAT.CHAR('-',&fileColumns,'-')
|
| 58 | //´òÓ¡title
|
| 59 | &string=format.string(" ",&fileColumns/3,' ')
|
| 60 | &string="&string"+"elfÓëbinÎļþµÄ´úÂë¶Î²îÒì"
|
| 61 | print %string "&string"
|
| 62 | print FORMAT.CHAR('-',&fileColumns,'-')
|
| 63 | repeat
|
| 64 | (
|
| 65 | Data.LOAD.Elf &elfname &addressStart--&addressEnd /DIFF /NoRegister /NosYmbol
|
| 66 | &find=FOUND()
|
| 67 | if &find
|
| 68 | (
|
| 69 | &addressStart=ADDRESS.OFFSET(TRACK.ADDRESS())
|
| 70 | &result="P:"+format.string("&addressStart",10,'')
|
| 71 | &string=format.string("different address=",-&width,' ')+"&result"
|
| 72 | &result=sYmbol.NAME(&result)
|
| 73 | &result=os.file.name("&result")
|
| 74 | &string="&string"+" symbol="+format.string("&result",20,'')
|
| 75 | print %string "&string"
|
| 76 | &addressStart=(&addressStart&(~0x3))+4
|
| 77 | &addressStart="P:"+format.string("&addressStart",10,'')
|
| 78 | &diffCount=&diffCount+1
|
| 79 |
|
| 80 | )
|
| 81 | else
|
| 82 | (
|
| 83 | &addressStart=""
|
| 84 | )
|
| 85 | )
|
| 86 | while ("&addressStart"!="")&&(&diffCount!=0x78)
|
| 87 | if (&diffCount==0x0)
|
| 88 | (
|
| 89 | &string=format.string(" ",&fileColumns/3,' ')
|
| 90 | &string="&string"+"Äں˴úÂë¶Î²»´æÔÚÍ»±ä"
|
| 91 | print %string "&string"
|
| 92 | )
|
| 93 | print FORMAT.CHAR('-',&fileColumns,'-')
|
| 94 | area.close codeDiff
|
| 95 | ENDDO
|
| 96 | RETURN
|