Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dsdp-dd-dev] local variables view modes

You brought up a valid point, but it's not unique to the feature I've described. Some symbolics formats don't track the transitional nature of a variable. At some point in a function, the variable might be stored in the stack frame, at another point it's being stored and manipulated in registers. But throughout the entire function call, the sym format says the variable is x bytes into the stack frame. So, the debugger provides, effectively, a misleading representation of the variables depending on where you are in the function.

So, the rule is: when you're dealing with optimized code, you need to be a little skeptical of what the debugger tells you.

John


At 01:11 PM 6/9/2006, Chris Recoskie wrote:
What indication to the user do you give, if any, if the value of a non-live
variable is not valid?  If you are debugging code that is optimized in any
way it's quite possible that whatever the variable's value is stored in on
the target could be reused as soon as it's not needed, e.g., perhaps the
value is stored in a register which gets reused quickly.

===========================

Chris Recoskie
Team Lead, IBM CDT Team
IBM Toronto
http://www.eclipse.org/cdt




             John Cortell
             <john.cortell@fre
             escale.com>                                                To
             Sent by:                  CDT Debug developers list
             dsdp-dd-dev-bounc         <cdt-debug-dev@xxxxxxxxxxx>,
             es@xxxxxxxxxxx            dsdp-dd-dev@xxxxxxxxxxx
                                                                        cc

             09/06/2006 02:07                                      Subject
             PM                        [dsdp-dd-dev] local variables view
                                       modes

             Please respond to
             Device Debugging
                 developer
                discussions
             <dsdp-dd-dev@ecli
                 pse.org>






There is a feature we've developed in our CDT-based debugger that we
would like to contribute if there is general interest in it.

A function can contain any number of local variables. Typically, not
all of the variables are necessarily "live" at every point along the
function code, but often there is a storage representation for each.
Consider the following simple scenario

void foo()
{
    int var1;
    {
       int var2;
    }
    var1 = 0;   <--- program is stopped here
    int var3 = 0;
}

Our debugger can support  showing "all locals", which means that the
variables view will display all three local variables (depending on
the sym information), even though only one is in scope at the stopped
location (PC). Our debugger also has the ability to show only "live"
variables, which means that in the above example, it would just show
var1. Finally, our debugger also has the ability to show only
variables that are referenced within a few source lines of the
current PC; here it does a very simple scan (i.e., grep) of the
source to make that determination (no preprocessor support).

The user can cycle through these modes during a debug session.

Does anyone with a CDT based debugger find this feature useful?
Distinguishing variables between "all" and "live" requires debugger
backend involvement. The "near PC" mode does not. We had to enhance
CDT/CDI to implement this feature. We'd like to contribute this to
the community and have it be out of our customization domain, but if
no one else has a need for this, we won't bother trying.

John

_______________________________________________
dsdp-dd-dev mailing list
dsdp-dd-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dsdp-dd-dev


_______________________________________________
dsdp-dd-dev mailing list
dsdp-dd-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dsdp-dd-dev



Back to the top