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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

Jump to solution
1,618 Views
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 Solution
1,330 Views
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.

View solution in original post

2 Replies
1,331 Views
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,330 Views
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 Kudos
Reply