??????????????????????????????斜???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????y???????UNIX????ptrace???谩??????????????????????????????????????????????????????????????????????睢�??????????妫�????????????????????????????????贸?????????????????????????????????????????????????????????????????????????????????????????????????????????????渭????????????????????慰?????????????????????????????泄?????????????????????????????????????????未????些??????????????????????????????????????????????????????
??????????????????????????????????????些????

???????

? ?????stub??

???????????????????????????????????些??????椋�??????????????械????????????????????????????

???????????????????
?????????????????????????????????????????????????????协????????

?????????????????????????
????????????????????????????????椋�???????????????????????????????????????????????????????????

???????????????????????
?????????????????????????????????????????????????????些???????????????????????????????????????????????????????娲�????????????????????????????些????????????

??????????泄?????????????????????????????????
??????????????????????????????????????????????????????y??????????????????????????锌???????????????????????

???????????????????????????
??2????????????????????????????????????????????????????????????????????????????????伞????????????????GNU GDB??????????

???????????????????????????????????????协????????楗�?????????璞�???????????????????????写????????泄?????????????????????????????????????????????械????????????????????????????debug trap????????????????????X86??INT 3?????????些???????????????????????????????????械???????????????妾�??????????????些???????"???"????????????????ROM??????ROM monitor????貌???????芯?????????????????????Alpha??Sparc??PowerPC????LINUX???????kgdb????????????????????

????????????????????????贸??????????????????????????????????????????????????????????椋�?????????host???????????????????????????????????????????????????????????????????????????????????????睢�
???????????????????????????????????????exception handler?????????卸??????????胁?????????????椋�?????????????????????????????????????????????????????????????????????????????????????????????????????????贸???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????卸???????????????械????????????????????????????????????????????????????妾�

?? ???????On Chip Debugging????Embedded PowerPC Background Debug Mode

??????????????????????????????椋�??????????????????????????????????????????锟�???????????????校????????????????????????????????????????????????????????娲�????????????睢�??????????????????????????????????????????????????????????????????路?????????????????????????????????????????????microcode monitor?????????????????????????些?????????????????????????????????Motorola CPU16??CPU32??Coldfire??械?BDM??Background Debug Mode????Motorola PowerPC 5xx??8xx??械?EPBDM??Embedded PowerPC Background Debug Mode????IBM??TI??JTAG??Joint Test Action Debug??IEEE???????????OnCE??MPSD??????????MPC860??EPBDM?????????????????

EPBDM???????????????????????????????卸???????????????????????????????debug enable register?????????些?卸?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????load/store ??????????妫�???妫╟ache?????娲�????????MMU????????????????????????????????????DPDR?????mtspr??mfspr?????????????????????rfi(return from interrupt)??????????????????????????????小?

??????????????????OCD??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????璨�????????????????????????????椋�???????????芯????????????写????ROM??RAM??????????

???????????????MPC860??LINUX??????????OCD???????OS ??????些???????

?????LINUX??????????????zImage?????????????ROM????????????????ROM?????位?????????????RAM?????????????????????????????小????????????????????ROM?械?????????????????????????????????????????????????????????MPC860??EPBDM?????????巍?

MPC860???????X86??INT 3??????????????????????????????????????????????????????????????????????????????械???????小???????????????????????????????梅????????????"??"???

LINUX????????????????LINUX????????????????????????????????????????????斜??????????????????????贸??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Translation Lookaside Buffer????????????????LINUX???TLB?效?????????????????????械????????位?????????????????????贸?????????????????????????????MPC860???霉??????Harvard architecture??????????????????????????????????魏?????????????????????????????????????????????????????TLB?????????????TLB?效????????????????????????????????????????????????????睢�?????????????????????????????????????????????????????????????????????????????????????????????璞�????????????????????????????????????????????

??????

????????????????????1????????--???????--????????--???????小????????????????????????????????????????????????????????睢�??????????????????????????????????????????????????????????????????????些??????????GDB??????????trace point??????????????危????????????械????????????????????agent??????????????????????????眉??????????????????????????????????????????????????????????????????????????????????????????????????????泻????屑???????????????????????????????????????????????????????????????????????????屑??????????????????校????????????????????????????????????????????????????????????????渭????????????????????????????????????????????椋�????????????????写??3K?????????????????????????????????娲�????????????????小?????????????????????????????????????????????????????????????????????????????蟹?????

?????????????味??????--???????--???--?????????????????????profiling???????trace?????????危??????????????????????????些??????蔚???写???????????????????????????????????????????????????????????????娑�??????芯????RISC???????????????????????"??"????????????芯??????????????校?芯??????????????????????????prefetch??????????????????校?????????????????????????????????????????????????????校?????????????????????????????????????????????

?械????????????????????????????蟹?????校????械????????????????????????????????????????????????????????????????????????????????????????????????????????????

????????????????????????????????????????????写?????gprof??profiling??????????????????????????????????????????写???????????芯?????????????????????????????????????????????????????????????????????????????????????????????????intrusive??????????????????

??????????????????????????写???????????????????路??????????????????"??????"??discontinuities???????????????????????????????????????????????????????????????????????????????????????????????梅??????????????小??

???????????????????????????????路????????????????????????????????????????????????????????????????????些???????????????????????????????????1998???????Nexus 5001 Forum???????????????????????貌????????????????????????????????????????????????Global Embedded Processor Debug Interface Standard Consortium???????????????????????协????Nexus??????24???????位????????????Motorola??Infineon Technologies????????ETAS??HP??????????????????????????????????????????????????????????????????????????????????????????y???

??????

???????????锌??????????????????椤�?????????????????????????????????????????????????????????????????? jxiong@ict.ac.cn?????????