打印

bl指令为什么不跳转呢?

[复制链接]
1544|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
rxg10000|  楼主 | 2008-9-11 15:37 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
        AREA    StrCopy, CODE, READONLY
        ENTRY                   ; mark the first instruction to call

start
        LDR     r1, =srcstr     ; pointer to first string
        LDR     r0, =dststr     ; pointer to second string

        BL      strcopy         ; call subroutine to do copy

stop
        MOV     r0, #&18       ; angel_SWIreason_ReportException
        LDR     r1, =0x20026    ; ADP_Stopped_ApplicationExit
        SWI     0x123456        ; ARM semihosting SWI


strcopy                 
        LDRB    r2, [r1],#1     ; load byte and update address
        STRB    r2, [r0],#1     ; store byte and update address;
        CMP     r2, #0          ; check for zero terminator
        BNE     strcopy         ; keep going if not
        MOV     pc,lr           ; Return


        AREA    Strings, DATA, READWRITE
srcstr  DCB "First string - source",0
dststr  DCB "Second string - destination",0

        END
以上是一条字符串拷贝程序,
程序执行到BL  strcopy后,没有跳转到strcopy处,而是继续执行下一条语句(stop),请问为什么?         

相关帖子

沙发
rxg10000|  楼主 | 2008-9-11 16:02 | 只看该作者

如果在要跳转的子函数里加一个断点就可以

真是奇怪了,如果在子函数里面加一个断点就可以跳转过去,这是为什么呢?

使用特权

评论回复
板凳
zouboan| | 2010-10-21 00:14 | 只看该作者
你使用的是单步步过,执行到strcop后再下一步执行完子函数后又出来了!
若在子函数里设置单点,进入子函数后就停在子函数里面了!所以这时候看见它
跳进去了!

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

3

主题

13

帖子

1

粉丝