This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to get thread state info?


On Mon, Dec 09, 2002 at 11:45:00PM +0000, Nick Garnett wrote:

> > When I dump each thread's stack, I check values against various
> > linker section begin/end and print a "hint" if it matches. It's
> > a bit iffy and produces false positives since a lot of typical
> > integer values (0-4K) could also be pointers into the text
> > section which starts at 384.  If the text section was at the
> > top end of memory, it would works better, since really large
> > integers are far more rare.  I'm thinking about temporarily
> > moving my text section up a ways to a region where things like
> > buffer and string length parameters can't be confused with
> > return address pointers.
> 
> That should give you a good approximation of the call stack. But you
> will always get false readings if any uninitialized stack locations
> happen to contain old return links.

Right. If you know where the tasks are supposed to be blocked
it's usually good enough to let you figure out if they're
behaving as expected or not.

> The only sure way to get it right is to work out the stack
> frames and unwind them properly. That's the hard part since the
> compiler's optimizations tend to make them difficult to detect.

-- 
Grant Edwards
grante@visi.com

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]