I'm trying to debug a multi- architecture OSS
program (the Das u-boot boot loader under sandbox configuration - it produces a standard linux executable) using Eclipse CDT. I like how it presents things (wonderful GUI work!). For example it shows something like this for a thread,
Thread [1] 9480 [core:2] (Suspend:Step)
As I ran the program the "core number" would change (value between 0 & 3, when running on an Intel i3). This initially led me to believe that the debugger was showing me different processing contexts of the application (i.e. I thought it was running on all 4 processor cores). I spent a LOT of time trying to install the "multi-core gbd debugger" and configure it, but had to admit failure in the end.
When I came back to the problem a weekend later, I noticed that while the "core number" would change, the thread-id did not (Additionally, I could not locate (in source code) where the fork()
(or similar) system call was being made from).
My current theory is that the program is indeed running as a single threaded application, but for reasons I do not understand, enjoys jumping between the different processor cores of my system.
My questions are as follows;
- Is my current theory correct?
- If so, can I expect this kind of behaviour for
__any__
single threaded application running outside the debug environment? - From an optimization perspective, there would be some amount of context switching when moving between cores, even for a single threaded application. Is there any practical benefit to the jumping around?