platform-espressif32 icon indicating copy to clipboard operation
platform-espressif32 copied to clipboard

esp32_exception_decoder do not decode with option time.

Open GOB52 opened this issue 4 years ago • 5 comments

Vscode 1.56.2 PlatformIO Core 5.1.1 Home 3.3.4 PLATFORM Espressif 32 (3.2.0) BOARD M5Stack Grey FRAMEWORK arduino

monitor_filters = esp32_exception_decoder decoded.

monitor_filters = esp32_exception_decoder,time not decoded.

time is processed first, and the timestamped text is passed to filter_exception_decoder.py, so the regex won't match?

Is it possible to control the order in which filters are processed? If we can't control the order, then modifying the regular expression might help.

In my environment, decoded with option time. filter_exception_decoder.py line:35 r"(?:^\d+:\d+:\d+.\d+ > Backtrace:|^Backtrace:) ?((0x[0-9a-f]+:0x[0-9a-f]+ ?)+)\s*"

However, if you use it with options other than time, it might not be decoded.

GOB52 avatar May 21 '21 08:05 GOB52

I wrote

monitor_filters = time, esp32_exception_decoder

and it worked.

Analyzed how the filter is processed.

https://github.com/platformio/platformio-core/blob/master/platformio/commands/device/helpers.py line:91

miniterm.TRANSFORMATIONS[obj.NAME] = obj

https://github.com/pyserial/pyserial/blob/master/serial/tools/miniterm.py line:352

TRANSFORMATIONS = {
    'direct': Transform,    # no transformation
    'default': NoTerminal,
    'nocontrol': NoControls,
    'printable': Printable,
    'colorize': Colorize,
    'debug': DebugIO,
}

line:454

transformations = [EOL_TRANSFORMATIONS[self.eol]] + [TRANSFORMATIONS[f]
                                                             for f in self.filters]
self.tx_transformations = [t() for t in transformations]
self.rx_transformations = list(reversed(self.tx_transformations))

line:505

for transformation in self.rx_transformations:
    text = transformation.rx(text)`

Except for Miniterm's built-in filters, they seem to be processed in the reverse order of enumeration.

If this behavior is a specification, could you please add a note in the documentation about the processing order when multiple filters are specified in monitor_filters?

(Sorry if there is already a description about the processing order).

GOB52 avatar May 22 '21 13:05 GOB52

@gob52 I came here to file the same bug as I came across this same issue yesterday. Thanks for sharing a workaround. At least it's simple enough.

Hopefully this bug can be fixed, or at the very least the docs can be updated to call out this important detail. I just checked the docs at https://docs.platformio.org/en/latest/core/userguide/device/cmd_monitor.html#cmd-device-monitor-filters and didn't see anything about the ordering of filters being of importance.

theficus avatar Jan 23 '22 20:01 theficus

This issue has been automatically marked as stale because it has not had recent activity. Please provide more details or it will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 31 '22 20:07 stale[bot]

Any update? Facing the same issue...

AgainPsychoX avatar Aug 20 '22 10:08 AgainPsychoX

This issue has been automatically marked as stale because it has not had recent activity. Please provide more details or it will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 20 '22 17:09 stale[bot]