Home » Language IDEs » C / C++ IDE (CDT) » Support for multithread stack in Debug view(Support for multithread stack in Debug view)
Support for multithread stack in Debug view [message #1767426] |
Thu, 06 July 2017 02:16 |
Richmond Umagat Messages: 18 Registered: July 2017 |
Junior Member |
|
|
I am extending Eclipse CDT plugin for our MCU. I have implemented Remote Debugging Launcher feature by implementing launch configuration types and launch delegates. I am now implementing FreeRTOS thread-aware debugging feature.
So far, I have already created views for Task list, Queue list, Timer list and Heap usage by reading the values of the FreeRTOS kernel global variables (like uxCurrentNumberOfTasks, pxCurrentTCB, xQueueRegistry, etc). Now I have to make the built-in Debug view show the stack of all threads/tasks. Currently, the Debug view shows only the stack of 1 task - the suspended running task.
Based on the gdb logs, Eclipse CDT queries our custom GDB with the MI command -list-thread-groups and it returns an array of only 1 task.
threads=[{id="1",target-id="Thread 1",details="Runnable",frame={level="1",addr="0x00003e2c",func="prvPrintTask",args=[{name="pvParameters",value="0x800cd8"}],file="../free_rtos_example\
3.c",fullname="C:\\free_rtos_example3.c",line="781"},state="stopped"}]
Since the GDB is not aware that MCU is running on FreeRTOS, then it does not know that there are more than 1 thread. In fact, GDB "info threads" always return 1 thread.
To support multiple thread stack in the Debug view, I think that I need to replace the Eclipse CDT to query the FreeRTOS task global variables (similar to what I did for the Task list view) instead of querying -list-thread-groups. This query happens when the debug session is suspended. So I need to know where the class where CDT sends an MI command during suspend.
Am I correct? What classes, extension points do I need to extend or implement? Any help will be appreciated. Thank you.
Regards,
Richmond
|
|
| | |
Re: Support for multithread stack in Debug view [message #1767590 is a reply to message #1767571] |
Fri, 07 July 2017 10:09 |
Richmond Umagat Messages: 18 Registered: July 2017 |
Junior Member |
|
|
Hi Jonah,
Thank you. I searched of -list-thread-groups keyword and also arrived at CommandFactory. To extend CommandFactory, it seems I have to newServiceFactory() in GdbLaunchDelegate and extend ServiceFactoriesManager, GdbDebugServicesFactory, CommandFactory_6_8, CommandFactory. Will try to work on this track.
As for Code Confidence, the plugin downloaded via Eclipse from http://www.highintegritysystems.com/StateViewer/ do not support multi-thread stack in Debug view. It only supports custom views for task, queues and timers.
Regards,
Richmond
Jonah Graham wrote on Fri, 07 July 2017 08:25Try providing your own implementation of either IProcesses (or more likely one of its sub-interfaces like IGDBProcesses, or extending existing classes), or if just the command need replacing but the rest of the logic in GDBProcesses_* is correct and you simply want to issue your own command you can extend CommandFactory and override the various createMIListThreadGroups.
Does that help in getting you started?
That said, before you start from scratch I would recommend considering one of the existing implementations of FreeRTOS support for Eclipse before spinning up a new one. For example, see http://www.codeconfidence.com/freertos-tools.shtml MCU On Eclipse wrote a good article a couple of years ago too: https://mcuoneclipse.com/2015/10/03/freertos-arm-thread-debugging-with-eclipse-and-gdb/
|
|
| | | |
Re: Support for multithread stack in Debug view [message #1767789 is a reply to message #1767590] |
Tue, 11 July 2017 07:23 |
Richmond Umagat Messages: 18 Registered: July 2017 |
Junior Member |
|
|
Hi Jonah,
I've extended GdbDebugServicesFactory which is called in the extended GdbLaunchDelegate. The extended GdbDebugServicesFactory overrides createCommandControl and createProcessesService. createCommandControl is for calling the extended CommandFactory_6_8 which overrides createMIListThreadGroups while createProcessesService is for calling the extended GDBProcesses_7_10 which overrides GDBProcesses_7_0 getProcessesBeingDebugged() and GDBProcesses_7_1 getExecutionData().
Overriding createMIListThreadGroups do not seem to be proper as this only creates the command that will be executed by getProcessesBeingDebugged() in GDBProcesses_7_0. I've override getProcessesBeingDebugged() instead by extending GDBProcesses_7_10 but getProcessesBeingDebugged() has many dependencies on the file that makes it complicated. I can just pass a simulated MIThreads[] to the DataRequestMonitor but MIThreads[] constructor is protected so I need to construct MIOutput and MIThreadInfoInfo instead of MIThreads.
Is this path possible? Is there class I can extend to override a function like getThreadList(), where I can simply provide my own MIThreads[] array to replace the one retrieved from the result of createMIListThreadGroups command execution?
Regards,
Richmond
Richmond Umagat wrote on Fri, 07 July 2017 10:09Hi Jonah,
Thank you. I searched of -list-thread-groups keyword and also arrived at CommandFactory. To extend CommandFactory, it seems I have to newServiceFactory() in GdbLaunchDelegate and extend ServiceFactoriesManager, GdbDebugServicesFactory, CommandFactory_6_8, CommandFactory. Will try to work on this track.
As for Code Confidence, the plugin downloaded via Eclipse from http://www.highintegritysystems.com/StateViewer/ do not support multi-thread stack in Debug view. It only supports custom views for task, queues and timers.
Regards,
Richmond
Jonah Graham wrote on Fri, 07 July 2017 08:25Try providing your own implementation of either IProcesses (or more likely one of its sub-interfaces like IGDBProcesses, or extending existing classes), or if just the command need replacing but the rest of the logic in GDBProcesses_* is correct and you simply want to issue your own command you can extend CommandFactory and override the various createMIListThreadGroups.
Does that help in getting you started?
That said, before you start from scratch I would recommend considering one of the existing implementations of FreeRTOS support for Eclipse before spinning up a new one. For example, see http://www.codeconfidence.com/freertos-tools.shtml MCU On Eclipse wrote a good article a couple of years ago too: https://mcuoneclipse.com/2015/10/03/freertos-arm-thread-debugging-with-eclipse-and-gdb/
|
|
| | | | | | | | | | | | | | |
Goto Forum:
Current Time: Thu Sep 26 08:53:03 GMT 2024
Powered by FUDForum. Page generated in 0.07313 seconds
|