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.
Post Reply
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Eclipse debug plugin for ChibiOS/RT

Post by Giovanni »

Hi,

Probably it is time to improve the debug support for ChibiOS/RT, the kernel supports already the required mechanisms but the supporting tools are missing (I am used to do everything using the Eclipse debugger but probably this is not enough for most people).

My idea is to create a ChibiOS/RT-specific plugin for Eclipse that would augment the CDT with RTOS awareness. I am collecting ideas about the functionality to implement, this is the list so far:

  • Readback of the trace buffer and representation in table and graphic format (what about an UML sequence-like diagram?).
  • Readback of the registry and representation of the active threads in a table (I am also considering a graphical representation using Graphviz, it would look like a connected graph of system objects: threads, sems, mutexes etc).
  • Readback of the timers list and representation in a table.
  • Access to the common system variables: time, current thread, panic message.
  • Add support for "named" threads in order to improve debug.

What else could be useful inside a debugging session?

Giovanni
brian360
Posts: 27
Joined: Wed Dec 08, 2010 5:47 pm

Re: Eclipse debug plugin for ChibiOS/RT

Post by brian360 »

Excellent! I can't wait! The graphical representations you suggested sound like very nice ideas.

My two cents might be something to easily view each thread's current stack usage.

Thanks
liamstask
Posts: 34
Joined: Wed Dec 08, 2010 5:42 pm

Re: Eclipse debug plugin for ChibiOS/RT

Post by liamstask »

Sounds like fun :) It might be interesting to have a visualization of the thread profiling information as well.

I also noticed in some recent commits to openocd that there is preliminary support for RTOS integration (including thread names, etc). It's not clear when they're ever going to make another release, but it could be interesting to add support for ChibiOS there as well.

Liam
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Eclipse debug plugin for ChibiOS/RT

Post by Giovanni »

Both good points, OpenOCD support is a good idea, probably I could submit a patch and see how it goes. Stacks inspection is a must-have.

I am just having problems with the Eclipse documentation, it is extensive and the debug parts obsolete (2007...).

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Eclipse debug plugin for ChibiOS/RT

Post by Giovanni »

It is going better than I expected, the plugin is already able to scan the registry and fetch the values. The interesting thing is that it is possible to use the internal debugger classes so I can access the various structures in memory using C expressions, for example "rlist.r_newer".

regscan.jpg
regscan.jpg (32.44 KiB) Viewed 11775 times
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Eclipse debug plugin for ChibiOS/RT

Post by Giovanni »

A small update :-)

The plugin now is able to show all threads and verify the integrity of the registry list, I think to add also the integrity check for the ready list and the timers list.

Giovanni

regscan2.jpg
regscan2.jpg (50.36 KiB) Viewed 11765 times
mabl
Posts: 417
Joined: Tue Dec 21, 2010 10:19 am
Been thanked: 1 time

Re: Eclipse debug plugin for ChibiOS/RT

Post by mabl »

Very cool! Does it rely on openocd? i'd like it to work with my jlink. Any way to test it yet?
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Eclipse debug plugin for ChibiOS/RT

Post by Giovanni »

It is already usable, I am adding new views and functionalities, I am also making some changes to the kernel in order to enhance debugging in general.

The plugin is not dependent on OpenOCD anyway, it interacts with the Eclipse debugger regardless the lower layers.

I hope to have more news next week, I still have to learn how to deploy a plugin... I also have to verify various Eclipse versions, right now I am using the new Indigo.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Eclipse debug plugin for ChibiOS/RT

Post by Giovanni »

A prototype is available here: http://www.chibios.org/plugins/org.chib ... _1.0.0.jar

It allows to explore the threads list and the timers list, so far I tested it with Eclipse Helios and Indigo.

Few notes:
  • Put the plug-in into the plug-ins directory of your Eclipse installation.
  • Enable the plug-in while in the "Debug" view under: Window->Show View->Other...->ChibiOS/RT->ChibiOS/RT
  • The plug-in uses the "Standard" Eclipse debugger, not the "DSF" one, you may select the debugger associated to the "GDB Hardware Debugging" under Window->Preferences->Run/Debug->Launching->Default Launchers.
  • I haven't tested the plug-in with the Zylin plug-in because Indigo no more supports it, could somebody report if it works?

The plug-in has 3 sub-views:

  • General, not currently filled, it will show global info about the kernel state.
  • Threads, the list of threads, it also shows thread names using the latest kernel in the trunk.
  • Timers, the list of enabled virtual timers.

In order to update a view press the refresh button (the yellow one) in the plug-in tool bar. The kernel must have already be initialized or the plug-in will report an error when it tries to read the system lists.
Note that the views are refreshable only when the target is suspended (because a breakpoint or the suspend button), while it is running the memory is not accessible and the refresh button has no effect.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Eclipse debug plugin for ChibiOS/RT

Post by Giovanni »

New preview: http://www.chibios.org/plugins/org.chib ... _1.0.1.jar

This one is able to inspect the Trace Buffer too:

tracebuf.png
tracebuf.png (14.21 KiB) Viewed 11722 times


Note that this feature requires the kernel currently in the repository.

Giovanni
Post Reply