avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] local variables in ddd


From: Gre7g Luterman
Subject: Re: [avr-gcc-list] local variables in ddd
Date: Mon, 21 Jan 2008 16:02:16 -0800 (PST)

--- Javier Almansa Sobrino <address@hidden>
wrote:

> Hi everyone. I'm trying to simulate and trace a
> program developed with
> avr-gcc, but I'm not able to see the value of any
> local variable with
> ddd or avr-gdb.

This is a common problem that is not simply solved. 
gcc is optimizing your code to the point where the
variable you are interested is no longer being stored
in memory, this keeps ddd from looking at it.

Some options:

* Reduce gcc's optimization while debugging (be sure
to turn it back on once the bugs are removed).

* Mark the variable(s) you are interested in as
"volatile" (again, make sure you un-do this later).

* Add code to store important values in a volatile
location:

#ifdef DEBUG
volatile uint16_t DebugTrace;
#endif

x = f(y);
#ifdef DEBUG
DebugTrace = x;
#endif
z = g(x);
#ifdef DEBUG
DebugTrace = z;
#endif

HTH,
Gre7g

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]