Eclipse debug plugin for ChibiOS/RT

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Eclipse debug plugin for ChibiOS/RT

Post by Giovanni »

mabl wrote:I have one wish too :D
I don't know if it is feasible, but I'd love to click on a thread/callback and directly jump to the source code as well.


I tried this but so fat I've been unable to convert from an object address to the associated symbol name so no luck, the Eclipse code is huge and documentation scarce, even things apparently simple can be difficult to implement if you don't know exactly where so search.

Giovanni
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: Eclipse debug plugin for ChibiOS/RT

Post by barthess »

What might be the cause of this error:
Error: ChibiOS/RT registry integrity check failed, NULL pointer.


Additional info:
After some time of successful running one tread hm... dead. Looks like it simple do return, but it has not return statment. All debug options switched on and I have no kernel panic. All other treads running fine (I successfully trap to breakpoint in it). When I press "refresh" plugin button than I have denoted error message. If I break before the death of problematic thread than "refresh" button works as expected.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Eclipse debug plugin for ChibiOS/RT

Post by Giovanni »

That error is returned when one of the registry pointers is found to be NULL. The registry is a close double linked list so it must contains no NULLs.

A possible cause is a stack overflow, the stack overflow detection is not 100% accurate being implemented in software and only at context switch time.

Giovanni
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: Eclipse debug plugin for ChibiOS/RT

Post by barthess »

Problem solved.
That was not stack overflow, but buffer overflow. Overflowed buffer overwrite "problematic" thread.
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: Eclipse debug plugin for ChibiOS/RT

Post by barthess »

When I set CH_USE_DYNAMIC to TRUE, select "Threads" tab and press refresh button, than I have following error:
"Error: error reading memory at 536879156"
All other tabs work fine. There are no error messages from OpenOCD in console. Manually that address readed fine.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Eclipse debug plugin for ChibiOS/RT

Post by Giovanni »

I test it with dynamic threads enabled and don't get that error.

The message is generated when failing to read a zero terminated string (the thread name). It is possible that that location reads fine but the location pointed by that location is invalid.

What is the content of the word located at 536879156 (0x20002034)? My hypothesis is that it is a corrupted thread name for some reason.

Giovanni
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: Eclipse debug plugin for ChibiOS/RT

Post by barthess »

content:
0x20002034 080004A1 00000000 55555555 55555555 55555555 55555555 55555555 55555555 08000D8F 55555555

I have no dynamic treads at all. Differences between builds only in that flag.

UPDATE
from ch.map:
COMMON 0x20001fe8 0xb0 ../chibios/os/kernel/src/chsys.o
0x20001fe8 _idle_thread_wa
COMMON 0x20002098 0x414 ../chibios/os/kernel/src/chdebug.o
0x20002098 dbg_trace_buffer

it points somewhere in idle thread.

UPDATE2
looking for 0x080004A1 gives follow info:
.text._idle_thread
0x080004a0 0x20 ../chibios/os/kernel/src/chsys.o
0x080004a0 _idle_thread
Last edited by barthess on Tue Sep 06, 2011 8:35 pm, edited 1 time in total.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Eclipse debug plugin for ChibiOS/RT

Post by Giovanni »

Probably it is the p_name field of the idle thread and it points to 080004A1, is 080004A1 a valid address? it should be a zero terminated string.

Giovanni
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: Eclipse debug plugin for ChibiOS/RT

Post by barthess »

Yes, it correct address, but I can not see any readable strings in memory. Disassembler successfully jump to that address and show idle function.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Eclipse debug plugin for ChibiOS/RT

Post by Giovanni »

Is it really the p_name field? id so it must point to "idle\0" string, if the p_name points to something different then it is possible the structure got corrupted somehow.
Post Reply