This is the mail archive of the ecos-discuss@sourceware.org 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: building and debugging


On Mon, Feb 19, 2007 at 06:22:56PM +1100, Laurie Gellatly wrote:
> Hi All,
> I've been using eclipse to develop my arm based system for some time.
> The application runs multiple threads and I had been able to debug them
> reasonably well (the program did not always flow the way I expected when
> single stepping and sometimes local variables are not able to be displayed).

Try disabling the optimizer, i.e. remove the -O2 flag. It will then
flow in a more logical, but less efficient way.

> What I have now is that although the main thread seems to be able to be
> debugged, the other threads have problems.
> I can set a breakpoint in a thread and it will stop, but single stepping or
> trying to display local variables etc no longer works.

Part of the problem is that gdb is not fully thread aware. It cannot
stop a thread context change at a time slice. It cannot stop a higher
priority thread taking over, it cannot stop a timer tick happening
etc. So when every you do a single step something else can take over
control from the current thread. What you can do is run the thread you
are trying to debug at a higher priority than anything else. That will
reduce the likelihood of it being preempted. However if you are
looking for a race condition this is not going to help you...

        Andrew

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


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