Debug stack trace without main - How?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi All,

Short version:

I've got a debug stack trace which doesn't contain 'main' - how is that possible? (see attached)

Thanks!

Long version:

I'm struggling with a weird intermittent problem around I2C and how the process is somehow stalling after running well for a LONG time, but it's complex to detail, so I'm trying to abstract the fundamental symptoms from this post and look at a curious symptom which may give a clue to the cause.

I've connected through SWD to a PSOC exhibiting the issue and investigated a bit.

I've done it a few times, everytime it halts in the WDT callback process as expected (good that the WDT keeps firing!) and I see an oddity about the stack trace:  there is no main anywhere in it, the root is the function '__aeabi_uidivmod'.

Can anyone help me understand how this is possible?

is it a sign of a stack smash, or are there other explanations?

I should highlight I'm using interrupts on:

- WDT, (8hz)

- GPIO, (never used in these tests)

- (EZ)I2C, (controlled by EZI2C)

- ADC done (store value)

There is an infinite loop in main that should never exit.

for(;;){ ... }

I've caused normal WDT timeouts to occur, and that stack trace includes the expected function list (see attached screenshot).

I'm hoping that this may be a cryptic clue to the cause of my other troubles...

Any thoughts appreciated, no matter how speculative.

Thanks for any suggestions!

P.S. Unfortunately I've not been able to make a minimal project with the same symptoms yet and there is proprietary code mixed in so I can't post the code.  I may in future if I can get similar results from a basic project.

0 Likes
2 Replies
Anonymous
Not applicable

Hi All,

I've got a small update:

  A mistake on my part lead to an infinite recursion and that produced similar results (i.e. no main in the stack trace, even the same function at the root of the call stack).

I am wondering if the situation arises when a stack overflow ocurs - though I'm running some long running tests on other parts of the code, so I don't have a device to test the theory right now.

Does that seem plausible to those with more experience of PSOCs?

0 Likes

A clobbered stack will result in false callstack interpretation. But there are some other scenarios which will show the same symptom as a stack overflow.

Bob

0 Likes