DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Centralized Job Execution Strategy in Cloud Data Warehouses
  • Python Async/Sync: Advanced Blocking Detection and Best Practices (Part 2)
  • Debug Like a Pro in 2025: 10 New Eclipse Java Debugger Features to Enhance Your Productivity (With Spring Boot Examples)
  • Creating a Web Project: Key Steps to Identify Issues

Trending

  • Advanced Error Handling and Retry Patterns in Enterprise REST Integrations
  • Good Data, Bad Metric: A Mutation Testing Pattern for Analytics Engineering
  • Prompt Injection Is Real, So I Built a Python Firewall for LLM Pipelines
  • How to Save Money Using Custom LLMs for Specific Tasks
  1. DZone
  2. Data Engineering
  3. AI/ML
  4. Stepping Backwards while Debugging: Move To Line

Stepping Backwards while Debugging: Move To Line

By 
Erich Styger user avatar
Erich Styger
·
Apr. 15, 13 · Interview
Likes (0)
Comment
Save
Tweet
Share
9.9K Views

Join the DZone community and get the full member experience.

Join For Free

it happens to me many times: i’m stepping with the debugger through my code, and ups! i made one step too far!

debugging, and made one step over too far

debugging, and made one step over too far

what now? restart the whole debugging session?

actually, there is a way to go ‘backwards’ :-)

:?: gdb has a ‘reverse debugging’ feature, described here . i’m using the eclipse based codewarrior debugger, and this debug engine is not using gdb.

the codewarrior debugger in mcu10.3 supports an eclipse feature: i select a code line in the editor view and use move to line :

move to line

move to line

what it does: it changes the current pc (program counter) of the program to that line:

performed move to line

performed move to line

now i can continue debugging from that line, e.g. stepping into that function call.

yes, this is not true backward debugging. but it is simple and very effective. to perform true backward stepping, the debugger would need to reverse all operations, typically with a rather heavy state machine and data recording. but for the usual case where i simply need to go back a few lines, the ‘move to line’ is perfect.

of course there are a few points to consider:

  1. this only changes the program counter. any variable changes/etc are not affected or reverted.
  2. in case of highly optimized code, there might be multiple sequence points per source line. so doing this for highly optimized code might not work correctly.
  3. it works ok within a function. it is not recommended to use it e.g. to set the pc outside of a function. because the context/stack frame is not set up.

:idea: i use the ‘move to line’ frequently to ‘advance’ the program execution. e.g. to bypass some long sequences i’m not interested in, or to get out of an ‘endless’ loop.

the same ‘move to line’ as available while doing assembly stepping too. see this post for details.

happy line moving :)



Eclipse CodeWarrior optimization Execution (computing) Debug (command) Data (computing) Session (web analytics) Machine

Published at DZone with permission of Erich Styger. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Centralized Job Execution Strategy in Cloud Data Warehouses
  • Python Async/Sync: Advanced Blocking Detection and Best Practices (Part 2)
  • Debug Like a Pro in 2025: 10 New Eclipse Java Debugger Features to Enhance Your Productivity (With Spring Boot Examples)
  • Creating a Web Project: Key Steps to Identify Issues

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook