How does the LPCXpresso IDE implement step-into/step-over/step-return?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How does the LPCXpresso IDE implement step-into/step-over/step-return?

跳至解决方案
1,990 次查看
chaitanyapravee
Contributor II

Hello everyone,

I am using lpcxpresso v8.2.2 IDE for debugging my application. I am very curious to know how the step-into/step-over/step-return are implemented in the IDE.

I tried searching for the same, I could not find any source.

If there is any document where this is discussed please share with me?

If someone could share some hints on how this is done, also very helpful.

Thanks for your time

Best Regards,

Chaitanya Praveen

1 解答
1,702 次查看
thefallguy
Contributor IV

For a general introduction to debugging on Arm Cortex-M chips, I suggest that you read Chapter 15 ('The Debug Architecture') of "The Definitive Guide to the ARM Cortex-M3" by Joseph Yui, but simply:

- step-into can be implemented by placing a breakpoint on the first instruction of the branch target

- step-over by setting a breakpoint on the instruction following the branch instruction

- step return by reading the stack for the function return address and setting the breakpoint there.

Some processors implement a single-step flag that can be used by debuggers to execute a single instruction before trapping back to the debugger (useful for step-into).

The actual implementation will be far more complex than this as (for example) you may step at source-level rather than assembly instruction level - but the principle is sound. This will be similar for any debugger implementation.

在原帖中查看解决方案

2 回复数
1,703 次查看
thefallguy
Contributor IV

For a general introduction to debugging on Arm Cortex-M chips, I suggest that you read Chapter 15 ('The Debug Architecture') of "The Definitive Guide to the ARM Cortex-M3" by Joseph Yui, but simply:

- step-into can be implemented by placing a breakpoint on the first instruction of the branch target

- step-over by setting a breakpoint on the instruction following the branch instruction

- step return by reading the stack for the function return address and setting the breakpoint there.

Some processors implement a single-step flag that can be used by debuggers to execute a single instruction before trapping back to the debugger (useful for step-into).

The actual implementation will be far more complex than this as (for example) you may step at source-level rather than assembly instruction level - but the principle is sound. This will be similar for any debugger implementation.

1,702 次查看
chaitanyapravee
Contributor II

Dear Fall Guy,

This is very helpful.

- step-into can be implemented by placing a breakpoint on the first instruction of the branch target

- step-over by setting a breakpoint on the instruction following the branch instruction

- step return by reading the stack for the function return address and setting the breakpoint there.

What if I have already set all the hardware break points(6 for my microcontroller) available while debugging?

Does the debugger remove the breakpoint which was set ahead and set as per the requirement and reset back to where it was originally after finishing the work?

Best Regards,

Chaitanya Praveen

0 项奖励
回复