CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Sep 2017
    Posts
    26

    Question How to backtrace or backstep while debugging?

    Language: C++
    Skill Level: Novice to intermediate

    Environment: Visual Studio Community V.2017


    HI. I don't know if this post should be here or in another forum so I apologize.I would like to be able to track a sequence of interdependent values along their variable pathway from their original assignment(i.e. user input or constant) to their ultimate usage and purpose. Because of pointers this can be VERY tedious for someone of my novice skill level.

    I think debugging backwards or something very similar would make things a lot easier! (Btw, I am tinkering with the Blender 3d codebase to try to learn a little about programming). Visual Studio Enterprise has IntelliTrace which seems to do something very similar to what I would like to do, but it has only a 30 day trial.


    I'm wondering, how do programmers usually trace variables from their assignment to their usage?

    What kind of software do programmers use to trace variables from their assignment to their usage?

    Do you know of any good tutorials about this issue?


    Thanks

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: How to backtrace or backstep while debugging?

    Visual Studio 2017 has a free community edition. Assuming if you want to track variables while debugging, all versions of VS have a built-in debugger. You can set breakpoints and inspect variables. There is also a stack window that lets you navigate around the chain of method calls.

    If you need to look at variables outside of debugger, you can log calls to a file.

  3. #3
    Join Date
    Sep 2017
    Posts
    26

    Re: How to backtrace or backstep while debugging?

    Quote Originally Posted by Arjay View Post
    Visual Studio 2017 has a free community edition.
    Of course, but it doesn't come with IntelliTrace.

    You can set breakpoints and inspect variables.
    Well, I don't know how to inspect "void *" variables within nested linked lists using the VS breakpoints. Can you point me to how to do this ?

    I've also been using the VS local window to track variable values but it seems it can only do so much.

    If you need to look at variables outside of debugger, you can log calls to a file.
    Ok. If you know of any good tutorials on how to log calls that would be helpful. Otherwise I'll just google-research it. I'm a logger virgin.


    ----------- - -





    Is there any other software or techniques that professionals use to track variables? Keep in mind that void * variables in nested linked list are what I am currently finding very tedious.
    Last edited by JohnBartle; January 14th, 2019 at 02:41 PM.

  4. #4
    Join Date
    Sep 2017
    Posts
    26

    Re: How to backtrace or backstep while debugging?

    Quote Originally Posted by Arjay View Post
    If you need to look at variables outside of debugger, you can log calls to a file.

    Holy crap! I just now looked at Visual Studio's logger, and apparently it can create a visual map of calls. I don't know how helpful this will be to me but it looks delicious.

  5. #5
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: How to backtrace or backstep while debugging?

    In the watch window, you can cast the void * to the type you need.

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: How to backtrace or backstep while debugging?

    Sounds like you need the call stack. You can set a breakpoint, then use the stack to see how you got where you are, and what the value of variables was along the way.

  7. #7
    Join Date
    Sep 2017
    Posts
    26

    Re: How to backtrace or backstep while debugging?

    Quote Originally Posted by Arjay View Post
    In the watch window, you can cast the void * to the type you need.
    Alright, thank you very much for the advice sir.

  8. #8
    Join Date
    Sep 2017
    Posts
    26

    Re: How to backtrace or backstep while debugging?

    Quote Originally Posted by GCDEF View Post
    Sounds like you need the call stack.
    Well, it seems like tracing the user input from the GUI to its final purpose would really help me learn the Blender 3D codebase. The call stack, as is, works but it seems like it would really speed things up to have historical debugging as an option. By historical debugging I mean that, during debugging, the states of the target program would be auto-snapshotted for x lines of code prior to a break point. This would allow for a programmer to reverse debug or "step back" during debugging.

    I intend to trace many variables in order to help me learn the Blender 3D codebase.

  9. #9
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: How to backtrace or backstep while debugging?

    Quote Originally Posted by JohnBartle View Post
    Well, it seems like tracing the user input from the GUI to its final purpose would really help me learn the Blender 3D codebase. The call stack, as is, works but it seems like it would really speed things up to have historical debugging as an option. By historical debugging I mean that, during debugging, the states of the target program would be auto-snapshotted for x lines of code prior to a break point. This would allow for a programmer to reverse debug or "step back" during debugging.

    I intend to trace many variables in order to help me learn the Blender 3D codebase.
    I'm not sure how much debugging you have done or if you have done any debugging with Visual Studio, but the VS debugger is pretty advanced. Intellitrace is more for trying to repro a problem after the fact (as it records the state of a program so you can rerun that state later under a debugger). It's cool but hardly necessary when learning a code base by stepping through code in a debugger.

  10. #10
    Join Date
    Sep 2017
    Posts
    26

    Re: How to backtrace or backstep while debugging?

    Quote Originally Posted by Arjay View Post
    It's cool but hardly necessary when learning a code base by stepping through code in a debugger.
    Ok. I'll assume that Visual Studio Community's standard debugging tools are sufficient and that I just need to practice debugging more to get faster. Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured