Skip to content

OCSD_ERR_RET_STACK_OVERFLOW with back-to-back exceptions in ETMv4 trace. #88

@leomao

Description

@leomao

Library version: v1.8.1

I am encountering an OCSD_ERR_RET_STACK_OVERFLOW error when decoding a specific ETMv4 trace sequence involving back-to-back exceptions. The packet sequence looks similar to the following:

EXCEPTION
ADDR
...
ATOM_E
EXCEPTION_RETURN
TIMESTAMP
EXCEPTION
ADDR
...

I tried to debug the execution and found:

  1. After committing ATOM_E (indicating the exception return), m_return_stack.pop_pending() becomes true.
  2. When the library attempts to commit the subsequent EXCEPTION packet, it tries to pop the stack because pop_pending() is true.
  3. Since the stack is empty at this point, the library triggers OCSD_ERR_RET_STACK_OVERFLOW.

Based on sections 5.2.8 and 5.3.1 of the ETMv4 specification, it appears the library should not attempt to pop the stack if the preceding ATOM_E indicates an exception return.

I tested adding m_return_stack.clear_pop_pending() within case P0_EXCEP_RET: of TrcPktDecodeEtmV4I::commitElements. The decoding result looks correct for this specific trace. However, I am not sure if this is the correct way to fix this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions