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

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Oracle Data Integrator (ODI): Executing A Load Plan
  • Creating a Web Project: Key Steps to Identify Issues
  • Teradata Performance and Skew Prevention Tips
  • Cost Optimization Strategies for Managing Large-Scale Open-Source Databases

Trending

  • DGS GraphQL and Spring Boot
  • How to Convert XLS to XLSX in Java
  • Unlocking AI Coding Assistants: Generate Unit Tests
  • Unlocking the Potential of Apache Iceberg: A Comprehensive Analysis
  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.2K 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, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Oracle Data Integrator (ODI): Executing A Load Plan
  • Creating a Web Project: Key Steps to Identify Issues
  • Teradata Performance and Skew Prevention Tips
  • Cost Optimization Strategies for Managing Large-Scale Open-Source Databases

Partner Resources

×

Comments

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

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

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 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: