Unhandled exception - how to debug

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

mikeprotts
Posts: 166
Joined: Wed Jan 09, 2019 12:37 pm
Has thanked: 19 times
Been thanked: 31 times

Re: Unhandled exception - how to debug

Post by mikeprotts »

Can you provide a link please (ChibiStudio for Linux)? I've not been able to find the Linux version, or do I need to extract from the Windows version?

Mike
elagil
Posts: 94
Joined: Tue Sep 19, 2017 7:38 am
Has thanked: 8 times
Been thanked: 7 times

Re: Unhandled exception - how to debug

Post by elagil »

I also did not find it. As far as I am aware, OSDN is now used for new versions of ChibiOS and ChibiStudio. Anyway, I just installed it on a fresh Windows installation.

The problem was indeed a full stack in a thread. After increasing it, the program ran fine. However, after the exception handler was called, the thread view was also broken. Only the last running thread was still visible. Is there a way to see that thread in some structure inside ChibiOS? I would really like to use my standard IDE and still be able to debug threads and stack sizes. I would be happy to know some details on the debugging information that ChibiOS stores. Maybe I can write a plugin for VS Code.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Unhandled exception - how to debug

Post by Giovanni »

I noticed the old download is gone....

It was very old anyway, will prepare a new one during weekend, it will be available on OSDN.

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

Re: Unhandled exception - how to debug

Post by Giovanni »

elagil wrote: However, after the exception handler was called, the thread view was also broken. Only the last running thread was still visible. Is there a way to see that thread in some structure inside ChibiOS?


If the plugin does not work then it means that structures in RAM got corrupted (the registry) so it is unable to fetch the list. You can inspect using the debugger: look at the "ch" structure then follow the "older" and "newer" links, those go across all threads.

Giovanni
elagil
Posts: 94
Joined: Tue Sep 19, 2017 7:38 am
Has thanked: 8 times
Been thanked: 7 times

Re: Unhandled exception - how to debug

Post by elagil »

Giovanni wrote:You can inspect using the debugger: look at the "ch" structure then follow the "older" and "newer" links, those go across all threads.
Giovanni


That is very helpful, thanks! Can you tell me, where the thread stack information is encoded? I am looking at the "rlist" field and the current/older/newer threads.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Unhandled exception - how to debug

Post by Giovanni »

Stack information is in each thread structure, there is a pointer for the stack limit.

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

Re: Unhandled exception - how to debug

Post by Giovanni »

I uploaded the previous Linux ChibiStudio on OSDN: https://osdn.net/projects/chibios/releases/

Please consider that it is not just an unpack-and-go thing, you need to change paths from my default /home/giovanni/Projects/ChibiStudio.

Giovanni
Post Reply