Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix src/lib/support/StateMachine pattern matching #13664

Conversation

msandstedt
Copy link
Contributor

Problem

The variant state Enter method can rewrite state objects during pattern matching traversal if Dispatch is called and a state transition occurs. We therefore need to ensure that the Enter method pattern matching can only evaluate true once. Without a check for this, the pattern matching may continue accessing the state object after its destructor has been called.

Change overview

Add a one-shot bool to ensure that Enter is only executed once. And although state changes from Exit, LogTransition and GetName aren't expected, checks are added for these too. In all cases, the pattern match should only execute once.

Testing

A new unit test has been added to check for the bug that is fixed by this PR.

@github-actions
Copy link

github-actions bot commented Jan 18, 2022

PR #13664: Size comparison from 78a6636 to 3693b83

Full report (14 builds for efr32, k32w, linux, p6, qpg, telink)
platform target config section 78a6636 3693b83 change % change
efr32 lighting-app BRD4161A (read only) 834948 834948 0 0.0
(read/write) 127636 127636 0 0.0
.bss 125744 125744 0 0.0
.data 1892 1892 0 0.0
.text 834940 834940 0 0.0
BRD4161A+rpc (read only) 822352 822352 0 0.0
(read/write) 144296 144296 0 0.0
.bss 142304 142304 0 0.0
.data 1992 1992 0 0.0
.text 822344 822344 0 0.0
window-app BRD4161A (read only) 805536 805536 0 0.0
(read/write) 126328 126328 0 0.0
.bss 124480 124480 0 0.0
.data 1844 1844 0 0.0
.text 805528 805528 0 0.0
k32w light k32w061+release (read/write) 659156 659156 0 0.0
.bss 77136 77136 0 0.0
.data 1860 1860 0 0.0
.text 574360 574360 0 0.0
lock k32w061+release (read/write) 661888 661888 0 0.0
.bss 77432 77432 0 0.0
.data 1880 1880 0 0.0
.text 576776 576776 0 0.0
linux chip-tool-ipv6only arm64 (read only) 8090660 8090660 0 0.0
(read/write) 373409 373409 0 0.0
.bss 55217 55217 0 0.0
.data 1112 1112 0 0.0
.data.rel.ro 248088 248088 0 0.0
.dynamic 560 560 0 0.0
.got 65296 65296 0 0.0
.init 24 24 0 0.0
.init_array 168 168 0 0.0
.rodata 421100 421100 0 0.0
.text 6873764 6873764 0 0.0
thermostat-no-ble arm64 (read only) 2044156 2044156 0 0.0
(read/write) 145985 145985 0 0.0
.bss 65089 65089 0 0.0
.data 896 896 0 0.0
.data.rel.ro 73016 73016 0 0.0
.dynamic 560 560 0 0.0
.got 4048 4048 0 0.0
.init 24 24 0 0.0
.init_array 304 304 0 0.0
.rodata 129932 129932 0 0.0
.text 1699616 1699616 0 0.0
p6 all-clusters-app default (read/write) 2405304 2405304 0 0.0
.bss 117556 117556 0 0.0
.data 2608 2608 0 0.0
.text 1363568 1363568 0 0.0
light-app default (read/write) 2330160 2330160 0 0.0
.bss 106128 106128 0 0.0
.data 2400 2400 0 0.0
.text 1288424 1288424 0 0.0
lock-app default (read/write) 2299168 2299168 0 0.0
.bss 104976 104976 0 0.0
.data 2352 2352 0 0.0
.text 1257432 1257432 0 0.0
qpg lighting-app qpg6105+debug (read only) 565160 565160 0 0.0
(read/write) 146940 146940 0 0.0
.bss 89960 89960 0 0.0
.data 1056 1056 0 0.0
.text 559840 559840 0 0.0
lock-app qpg6105+debug (read only) 515572 515572 0 0.0
(read/write) 146936 146936 0 0.0
.bss 88584 88584 0 0.0
.data 980 980 0 0.0
.text 510252 510252 0 0.0
persistent-storage-app qpg6105+debug (read only) 106848 106848 0 0.0
(read/write) 146940 146940 0 0.0
.bss 38512 38512 0 0.0
.data 288 288 0 0.0
.text 101528 101528 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 840902 840902 0 0.0
bss 87316 87316 0 0.0
noinit 37160 37160 0 0.0
text 587854 587854 0 0.0

@github-actions
Copy link

github-actions bot commented Jan 18, 2022

PR #13664: Size comparison from 78a6636 to 5facee3

Full report (32 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section 78a6636 5facee3 change % change
efr32 lighting-app BRD4161A (read only) 834948 834948 0 0.0
(read/write) 127636 127636 0 0.0
.bss 125744 125744 0 0.0
.data 1892 1892 0 0.0
.text 834940 834940 0 0.0
BRD4161A+rpc (read only) 822352 822352 0 0.0
(read/write) 144296 144296 0 0.0
.bss 142304 142304 0 0.0
.data 1992 1992 0 0.0
.text 822344 822344 0 0.0
window-app BRD4161A (read only) 805536 805536 0 0.0
(read/write) 126328 126328 0 0.0
.bss 124480 124480 0 0.0
.data 1844 1844 0 0.0
.text 805528 805528 0 0.0
esp32 all-clusters-app c3devkit (read only) 912452 912452 0 0.0
(read/write) 1316698 1316698 0 0.0
.dram0.bss 70528 70528 0 0.0
.dram0.data 14292 14292 0 0.0
.flash.rodata 178384 178384 0 0.0
.flash.text 912452 912452 0 0.0
.iram0.text 62056 62056 0 0.0
m5stack (read only) 961295 961295 0 0.0
(read/write) 448856 448856 0 0.0
.dram0.bss 74984 74984 0 0.0
.dram0.data 34072 34072 0 0.0
.flash.rodata 207672 207672 0 0.0
.flash.text 955911 955911 0 0.0
.iram0.text 123399 123399 0 0.0
k32w light k32w061+release (read/write) 659156 659156 0 0.0
.bss 77136 77136 0 0.0
.data 1860 1860 0 0.0
.text 574360 574360 0 0.0
lock k32w061+release (read/write) 661888 661888 0 0.0
.bss 77432 77432 0 0.0
.data 1880 1880 0 0.0
.text 576776 576776 0 0.0
linux chip-tool-ipv6only arm64 (read only) 8090660 8090660 0 0.0
(read/write) 373409 373409 0 0.0
.bss 55217 55217 0 0.0
.data 1112 1112 0 0.0
.data.rel.ro 248088 248088 0 0.0
.dynamic 560 560 0 0.0
.got 65296 65296 0 0.0
.init 24 24 0 0.0
.init_array 168 168 0 0.0
.rodata 421100 421100 0 0.0
.text 6873764 6873764 0 0.0
thermostat-no-ble arm64 (read only) 2044156 2044156 0 0.0
(read/write) 145985 145985 0 0.0
.bss 65089 65089 0 0.0
.data 896 896 0 0.0
.data.rel.ro 73016 73016 0 0.0
.dynamic 560 560 0 0.0
.got 4048 4048 0 0.0
.init 24 24 0 0.0
.init_array 304 304 0 0.0
.rodata 129932 129932 0 0.0
.text 1699616 1699616 0 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2350176 2350176 0 0.0
.bss 189220 189220 0 0.0
.data 5328 5328 0 0.0
.text 1312752 1312752 0 0.0
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2334632 2334632 0 0.0
.bss 180760 180760 0 0.0
.data 5576 5576 0 0.0
.text 1297232 1297232 0 0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2304984 2304984 0 0.0
.bss 179768 179768 0 0.0
.data 5552 5552 0 0.0
.text 1267584 1267584 0 0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1139712 1139712 0 0.0
.bss 11756 11756 0 0.0
.data 4368 4368 0 0.0
.text 103096 103096 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2054464 2054464 0 0.0
.bss 156876 156876 0 0.0
.data 4864 4864 0 0.0
.text 1017064 1017064 0 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 943491 943491 0 0.0
bss 119628 119628 0 0.0
rodata 108824 108824 0 0.0
text 637456 637456 0 0.0
nrf52840dk_nrf52840+rpc (read/write) 928975 928975 0 0.0
bss 116672 116672 0 0.0
rodata 101276 101276 0 0.0
text 632852 632852 0 0.0
nrf52840dongle_nrf52840 (read/write) 994171 994171 0 0.0
bss 122472 122472 0 0.0
rodata 113580 113580 0 0.0
text 669656 669656 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 853334 853334 0 0.0
bss 116416 116416 0 0.0
rodata 102000 102000 0 0.0
text 554380 554380 0 0.0
lock-app nrf52840dk_nrf52840 (read/write) 912851 912851 0 0.0
bss 118784 118784 0 0.0
rodata 103792 103792 0 0.0
text 612904 612904 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 822922 822922 0 0.0
bss 115600 115600 0 0.0
rodata 97020 97020 0 0.0
text 529864 529864 0 0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 541835 541835 0 0.0
bss 52588 52588 0 0.0
rodata 50104 50104 0 0.0
text 376940 376940 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 915719 915719 0 0.0
bss 118548 118548 0 0.0
rodata 104156 104156 0 0.0
text 615556 615556 0 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 910787 910787 0 0.0
bss 118572 118572 0 0.0
rodata 103264 103264 0 0.0
text 611480 611480 0 0.0
shell nrf52840dk_nrf52840 (read/write) 798655 798655 0 0.0
bss 109776 109776 0 0.0
rodata 78388 78388 0 0.0
text 533992 533992 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 711470 711470 0 0.0
bss 107664 107664 0 0.0
rodata 72688 72688 0 0.0
text 451668 451668 0 0.0
p6 all-clusters-app default (read/write) 2405304 2405304 0 0.0
.bss 117556 117556 0 0.0
.data 2608 2608 0 0.0
.text 1363568 1363568 0 0.0
light-app default (read/write) 2330160 2330160 0 0.0
.bss 106128 106128 0 0.0
.data 2400 2400 0 0.0
.text 1288424 1288424 0 0.0
lock-app default (read/write) 2299168 2299168 0 0.0
.bss 104976 104976 0 0.0
.data 2352 2352 0 0.0
.text 1257432 1257432 0 0.0
qpg lighting-app qpg6105+debug (read only) 565160 565160 0 0.0
(read/write) 146940 146940 0 0.0
.bss 89960 89960 0 0.0
.data 1056 1056 0 0.0
.text 559840 559840 0 0.0
lock-app qpg6105+debug (read only) 515572 515572 0 0.0
(read/write) 146936 146936 0 0.0
.bss 88584 88584 0 0.0
.data 980 980 0 0.0
.text 510252 510252 0 0.0
persistent-storage-app qpg6105+debug (read only) 106848 106848 0 0.0
(read/write) 146940 146940 0 0.0
.bss 38512 38512 0 0.0
.data 288 288 0 0.0
.text 101528 101528 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 840902 840902 0 0.0
bss 87316 87316 0 0.0
noinit 37160 37160 0 0.0
text 587854 587854 0 0.0

Copy link

@wbschiller wbschiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

@msandstedt msandstedt force-pushed the bugfix/state-machine-pattern-matching branch 2 times, most recently from 03232f1 to 5facee3 Compare January 19, 2022 05:00
@github-actions
Copy link

PR #13664: Size comparison from 150c479 to 5facee3

Full report (6 builds for k32w, qpg, telink)
platform target config section 150c479 5facee3 change % change
k32w light k32w061+release (read/write) 659156 659156 0 0.0
.bss 77136 77136 0 0.0
.data 1860 1860 0 0.0
.text 574360 574360 0 0.0
lock k32w061+release (read/write) 661888 661888 0 0.0
.bss 77432 77432 0 0.0
.data 1880 1880 0 0.0
.text 576776 576776 0 0.0
qpg lighting-app qpg6105+debug (read only) 565160 565160 0 0.0
(read/write) 146940 146940 0 0.0
.bss 89960 89960 0 0.0
.data 1056 1056 0 0.0
.text 559840 559840 0 0.0
lock-app qpg6105+debug (read only) 515572 515572 0 0.0
(read/write) 146936 146936 0 0.0
.bss 88584 88584 0 0.0
.data 980 980 0 0.0
.text 510252 510252 0 0.0
persistent-storage-app qpg6105+debug (read only) 106848 106848 0 0.0
(read/write) 146940 146940 0 0.0
.bss 38512 38512 0 0.0
.data 288 288 0 0.0
.text 101528 101528 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 840902 840902 0 0.0
bss 87316 87316 0 0.0
noinit 37160 37160 0 0.0
text 587854 587854 0 0.0

@msandstedt msandstedt force-pushed the bugfix/state-machine-pattern-matching branch from 5facee3 to 3690bb6 Compare January 19, 2022 05:24
@github-actions
Copy link

github-actions bot commented Jan 19, 2022

PR #13664: Size comparison from 150c479 to 3690bb6

Full report (32 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section 150c479 3690bb6 change % change
efr32 lighting-app BRD4161A (read only) 834948 834948 0 0.0
(read/write) 127636 127636 0 0.0
.bss 125744 125744 0 0.0
.data 1892 1892 0 0.0
.text 834940 834940 0 0.0
BRD4161A+rpc (read only) 822352 822352 0 0.0
(read/write) 144296 144296 0 0.0
.bss 142304 142304 0 0.0
.data 1992 1992 0 0.0
.text 822344 822344 0 0.0
window-app BRD4161A (read only) 805536 805536 0 0.0
(read/write) 126328 126328 0 0.0
.bss 124480 124480 0 0.0
.data 1844 1844 0 0.0
.text 805528 805528 0 0.0
esp32 all-clusters-app c3devkit (read only) 912364 912364 0 0.0
(read/write) 1316698 1316698 0 0.0
.dram0.bss 70528 70528 0 0.0
.dram0.data 14292 14292 0 0.0
.flash.rodata 178384 178384 0 0.0
.flash.text 912364 912364 0 0.0
.iram0.text 62056 62056 0 0.0
m5stack (read only) 961231 961231 0 0.0
(read/write) 448856 448856 0 0.0
.dram0.bss 74984 74984 0 0.0
.dram0.data 34072 34072 0 0.0
.flash.rodata 207672 207672 0 0.0
.flash.text 955847 955847 0 0.0
.iram0.text 123399 123399 0 0.0
k32w light k32w061+release (read/write) 659156 659156 0 0.0
.bss 77136 77136 0 0.0
.data 1860 1860 0 0.0
.text 574360 574360 0 0.0
lock k32w061+release (read/write) 661888 661888 0 0.0
.bss 77432 77432 0 0.0
.data 1880 1880 0 0.0
.text 576776 576776 0 0.0
linux chip-tool-ipv6only arm64 (read only) 8123052 8123052 0 0.0
(read/write) 374225 374225 0 0.0
.bss 55217 55217 0 0.0
.data 1112 1112 0 0.0
.data.rel.ro 248696 248696 0 0.0
.dynamic 560 560 0 0.0
.got 65504 65504 0 0.0
.init 24 24 0 0.0
.init_array 168 168 0 0.0
.rodata 422244 422244 0 0.0
.text 6903140 6903140 0 0.0
thermostat-no-ble arm64 (read only) 2044156 2044156 0 0.0
(read/write) 145985 145985 0 0.0
.bss 65089 65089 0 0.0
.data 896 896 0 0.0
.data.rel.ro 73016 73016 0 0.0
.dynamic 560 560 0 0.0
.got 4048 4048 0 0.0
.init 24 24 0 0.0
.init_array 304 304 0 0.0
.rodata 129932 129932 0 0.0
.text 1699616 1699616 0 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2350176 2350176 0 0.0
.bss 189220 189220 0 0.0
.data 5328 5328 0 0.0
.text 1312752 1312752 0 0.0
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2334632 2334632 0 0.0
.bss 180760 180760 0 0.0
.data 5576 5576 0 0.0
.text 1297232 1297232 0 0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2304984 2304984 0 0.0
.bss 179768 179768 0 0.0
.data 5552 5552 0 0.0
.text 1267584 1267584 0 0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1139712 1139712 0 0.0
.bss 11756 11756 0 0.0
.data 4368 4368 0 0.0
.text 103096 103096 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2054464 2054464 0 0.0
.bss 156876 156876 0 0.0
.data 4864 4864 0 0.0
.text 1017064 1017064 0 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 943491 943491 0 0.0
bss 119628 119628 0 0.0
rodata 108824 108824 0 0.0
text 637456 637456 0 0.0
nrf52840dk_nrf52840+rpc (read/write) 928975 928975 0 0.0
bss 116672 116672 0 0.0
rodata 101276 101276 0 0.0
text 632852 632852 0 0.0
nrf52840dongle_nrf52840 (read/write) 994171 994171 0 0.0
bss 122472 122472 0 0.0
rodata 113580 113580 0 0.0
text 669656 669656 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 853334 853334 0 0.0
bss 116416 116416 0 0.0
rodata 102000 102000 0 0.0
text 554380 554380 0 0.0
lock-app nrf52840dk_nrf52840 (read/write) 912851 912851 0 0.0
bss 118784 118784 0 0.0
rodata 103792 103792 0 0.0
text 612904 612904 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 822922 822922 0 0.0
bss 115600 115600 0 0.0
rodata 97020 97020 0 0.0
text 529864 529864 0 0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 541835 541835 0 0.0
bss 52588 52588 0 0.0
rodata 50104 50104 0 0.0
text 376940 376940 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 915719 915719 0 0.0
bss 118548 118548 0 0.0
rodata 104156 104156 0 0.0
text 615556 615556 0 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 910787 910787 0 0.0
bss 118572 118572 0 0.0
rodata 103264 103264 0 0.0
text 611480 611480 0 0.0
shell nrf52840dk_nrf52840 (read/write) 798655 798655 0 0.0
bss 109776 109776 0 0.0
rodata 78388 78388 0 0.0
text 533992 533992 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 711470 711470 0 0.0
bss 107664 107664 0 0.0
rodata 72688 72688 0 0.0
text 451668 451668 0 0.0
p6 all-clusters-app default (read/write) 2405304 2405304 0 0.0
.bss 117556 117556 0 0.0
.data 2608 2608 0 0.0
.text 1363568 1363568 0 0.0
light-app default (read/write) 2330160 2330160 0 0.0
.bss 106128 106128 0 0.0
.data 2400 2400 0 0.0
.text 1288424 1288424 0 0.0
lock-app default (read/write) 2299168 2299168 0 0.0
.bss 104976 104976 0 0.0
.data 2352 2352 0 0.0
.text 1257432 1257432 0 0.0
qpg lighting-app qpg6105+debug (read only) 565160 565160 0 0.0
(read/write) 146940 146940 0 0.0
.bss 89960 89960 0 0.0
.data 1056 1056 0 0.0
.text 559840 559840 0 0.0
lock-app qpg6105+debug (read only) 515572 515572 0 0.0
(read/write) 146936 146936 0 0.0
.bss 88584 88584 0 0.0
.data 980 980 0 0.0
.text 510252 510252 0 0.0
persistent-storage-app qpg6105+debug (read only) 106848 106848 0 0.0
(read/write) 146940 146940 0 0.0
.bss 38512 38512 0 0.0
.data 288 288 0 0.0
.text 101528 101528 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 840902 840902 0 0.0
bss 87316 87316 0 0.0
noinit 37160 37160 0 0.0
text 587854 587854 0 0.0

@github-actions
Copy link

PR #13664: Size comparison from 41d3a6c to b07ee40

Full report (14 builds for efr32, k32w, linux, p6, qpg, telink)
platform target config section 41d3a6c b07ee40 change % change
efr32 lighting-app BRD4161A (read only) 834948 834948 0 0.0
(read/write) 127636 127636 0 0.0
.bss 125744 125744 0 0.0
.data 1892 1892 0 0.0
.text 834940 834940 0 0.0
window-app BRD4161A (read only) 805536 805536 0 0.0
(read/write) 126328 126328 0 0.0
.bss 124480 124480 0 0.0
.data 1844 1844 0 0.0
.text 805528 805528 0 0.0
lighting-app BRD4161A+rpc (read only) 822352 822352 0 0.0
(read/write) 144296 144296 0 0.0
.bss 142304 142304 0 0.0
.data 1992 1992 0 0.0
.text 822344 822344 0 0.0
k32w light k32w061+release (read/write) 659156 659156 0 0.0
.bss 77136 77136 0 0.0
.data 1860 1860 0 0.0
.text 574360 574360 0 0.0
lock k32w061+release (read/write) 661888 661888 0 0.0
.bss 77432 77432 0 0.0
.data 1880 1880 0 0.0
.text 576776 576776 0 0.0
linux chip-tool-ipv6only arm64 (read only) 8123116 8123116 0 0.0
(read/write) 374225 374225 0 0.0
.bss 55217 55217 0 0.0
.data 1112 1112 0 0.0
.data.rel.ro 248696 248696 0 0.0
.dynamic 560 560 0 0.0
.got 65504 65504 0 0.0
.init 24 24 0 0.0
.init_array 168 168 0 0.0
.rodata 422244 422244 0 0.0
.text 6903204 6903204 0 0.0
thermostat-no-ble arm64 (read only) 2044220 2044220 0 0.0
(read/write) 145985 145985 0 0.0
.bss 65089 65089 0 0.0
.data 896 896 0 0.0
.data.rel.ro 73016 73016 0 0.0
.dynamic 560 560 0 0.0
.got 4048 4048 0 0.0
.init 24 24 0 0.0
.init_array 304 304 0 0.0
.rodata 129932 129932 0 0.0
.text 1699680 1699680 0 0.0
p6 all-clusters-app default (read/write) 2405304 2405304 0 0.0
.bss 117556 117556 0 0.0
.data 2608 2608 0 0.0
.text 1363568 1363568 0 0.0
light-app default (read/write) 2330160 2330160 0 0.0
.bss 106128 106128 0 0.0
.data 2400 2400 0 0.0
.text 1288424 1288424 0 0.0
lock-app default (read/write) 2299184 2299184 0 0.0
.bss 104976 104976 0 0.0
.data 2352 2352 0 0.0
.text 1257448 1257448 0 0.0
qpg lighting-app qpg6105+debug (read only) 565152 565152 0 0.0
(read/write) 146940 146940 0 0.0
.bss 89960 89960 0 0.0
.data 1056 1056 0 0.0
.text 559832 559832 0 0.0
lock-app qpg6105+debug (read only) 515564 515564 0 0.0
(read/write) 146936 146936 0 0.0
.bss 88584 88584 0 0.0
.data 980 980 0 0.0
.text 510244 510244 0 0.0
persistent-storage-app qpg6105+debug (read only) 106848 106848 0 0.0
(read/write) 146940 146940 0 0.0
.bss 38512 38512 0 0.0
.data 288 288 0 0.0
.text 101528 101528 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 840886 840886 0 0.0
bss 87316 87316 0 0.0
noinit 37160 37160 0 0.0
text 587842 587842 0 0.0

The Enter method can rewrite the state objects during pattern matching
traversal.  We need a one-shot bool to ensure we only execute
Enter once.  And although state changes from Exit, LogTransition and
GetName aren't expected, we should check in these too.  In all cases,
the pattern match should only execute once.

This commit adds the necessary check and a test case to verify this is
working correctly.
@msandstedt msandstedt force-pushed the bugfix/state-machine-pattern-matching branch from b07ee40 to 5f459ad Compare January 19, 2022 17:25
@github-actions
Copy link

github-actions bot commented Jan 19, 2022

PR #13664: Size comparison from 5274676 to 5f459ad

Full report (32 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section 5274676 5f459ad change % change
efr32 lighting-app BRD4161A (read only) 834836 834836 0 0.0
(read/write) 127636 127636 0 0.0
.bss 125744 125744 0 0.0
.data 1892 1892 0 0.0
.text 834828 834828 0 0.0
BRD4161A+rpc (read only) 822224 822224 0 0.0
(read/write) 144296 144296 0 0.0
.bss 142304 142304 0 0.0
.data 1992 1992 0 0.0
.text 822216 822216 0 0.0
window-app BRD4161A (read only) 805408 805408 0 0.0
(read/write) 126328 126328 0 0.0
.bss 124480 124480 0 0.0
.data 1844 1844 0 0.0
.text 805400 805400 0 0.0
esp32 all-clusters-app c3devkit (read only) 912466 912466 0 0.0
(read/write) 1316642 1316642 0 0.0
.dram0.bss 70528 70528 0 0.0
.dram0.data 14276 14276 0 0.0
.flash.rodata 178344 178344 0 0.0
.flash.text 912466 912466 0 0.0
.iram0.text 62056 62056 0 0.0
m5stack (read only) 961247 961247 0 0.0
(read/write) 448800 448800 0 0.0
.dram0.bss 74984 74984 0 0.0
.dram0.data 34072 34072 0 0.0
.flash.rodata 207616 207616 0 0.0
.flash.text 955863 955863 0 0.0
.iram0.text 123399 123399 0 0.0
k32w light k32w061+release (read/write) 659060 659060 0 0.0
.bss 77136 77136 0 0.0
.data 1860 1860 0 0.0
.text 574264 574264 0 0.0
lock k32w061+release (read/write) 661792 661792 0 0.0
.bss 77432 77432 0 0.0
.data 1880 1880 0 0.0
.text 576680 576680 0 0.0
linux chip-tool-ipv6only arm64 (read only) 8122444 8122444 0 0.0
(read/write) 374145 374145 0 0.0
.bss 55217 55217 0 0.0
.data 1112 1112 0 0.0
.data.rel.ro 248632 248632 0 0.0
.dynamic 560 560 0 0.0
.got 65488 65488 0 0.0
.init 24 24 0 0.0
.init_array 168 168 0 0.0
.rodata 422212 422212 0 0.0
.text 6902804 6902804 0 0.0
thermostat-no-ble arm64 (read only) 2043580 2043580 0 0.0
(read/write) 145905 145905 0 0.0
.bss 65089 65089 0 0.0
.data 896 896 0 0.0
.data.rel.ro 72952 72952 0 0.0
.dynamic 560 560 0 0.0
.got 4032 4032 0 0.0
.init 24 24 0 0.0
.init_array 304 304 0 0.0
.rodata 129916 129916 0 0.0
.text 1699296 1699296 0 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2350160 2350160 0 0.0
.bss 189220 189220 0 0.0
.data 5328 5328 0 0.0
.text 1312736 1312736 0 0.0
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2334424 2334424 0 0.0
.bss 180760 180760 0 0.0
.data 5576 5576 0 0.0
.text 1297024 1297024 0 0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2304768 2304768 0 0.0
.bss 179768 179768 0 0.0
.data 5552 5552 0 0.0
.text 1267368 1267368 0 0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1139712 1139712 0 0.0
.bss 11756 11756 0 0.0
.data 4368 4368 0 0.0
.text 103096 103096 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2054256 2054256 0 0.0
.bss 156876 156876 0 0.0
.data 4864 4864 0 0.0
.text 1016856 1016856 0 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 943347 943347 0 0.0
bss 119628 119628 0 0.0
rodata 108760 108760 0 0.0
text 637368 637368 0 0.0
nrf52840dk_nrf52840+rpc (read/write) 928831 928831 0 0.0
bss 116672 116672 0 0.0
rodata 101212 101212 0 0.0
text 632764 632764 0 0.0
nrf52840dongle_nrf52840 (read/write) 994027 994027 0 0.0
bss 122472 122472 0 0.0
rodata 113516 113516 0 0.0
text 669568 669568 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 853174 853174 0 0.0
bss 116416 116416 0 0.0
rodata 101936 101936 0 0.0
text 554292 554292 0 0.0
lock-app nrf52840dk_nrf52840 (read/write) 912707 912707 0 0.0
bss 118784 118784 0 0.0
rodata 103728 103728 0 0.0
text 612816 612816 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 822778 822778 0 0.0
bss 115600 115600 0 0.0
rodata 96956 96956 0 0.0
text 529776 529776 0 0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 541835 541835 0 0.0
bss 52588 52588 0 0.0
rodata 50104 50104 0 0.0
text 376940 376940 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 915559 915559 0 0.0
bss 118548 118548 0 0.0
rodata 104092 104092 0 0.0
text 615468 615468 0 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 910643 910643 0 0.0
bss 118572 118572 0 0.0
rodata 103200 103200 0 0.0
text 611392 611392 0 0.0
shell nrf52840dk_nrf52840 (read/write) 798479 798479 0 0.0
bss 109776 109776 0 0.0
rodata 78324 78324 0 0.0
text 533872 533872 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 711278 711278 0 0.0
bss 107664 107664 0 0.0
rodata 72624 72624 0 0.0
text 451548 451548 0 0.0
p6 all-clusters-app default (read/write) 2405536 2405536 0 0.0
.bss 117556 117556 0 0.0
.data 2608 2608 0 0.0
.text 1363800 1363800 0 0.0
light-app default (read/write) 2329976 2329976 0 0.0
.bss 106128 106128 0 0.0
.data 2400 2400 0 0.0
.text 1288240 1288240 0 0.0
lock-app default (read/write) 2299000 2299000 0 0.0
.bss 104976 104976 0 0.0
.data 2352 2352 0 0.0
.text 1257264 1257264 0 0.0
qpg lighting-app qpg6105+debug (read only) 565064 565064 0 0.0
(read/write) 146940 146940 0 0.0
.bss 89960 89960 0 0.0
.data 1056 1056 0 0.0
.text 559744 559744 0 0.0
lock-app qpg6105+debug (read only) 515476 515476 0 0.0
(read/write) 146936 146936 0 0.0
.bss 88584 88584 0 0.0
.data 980 980 0 0.0
.text 510156 510156 0 0.0
persistent-storage-app qpg6105+debug (read only) 106848 106848 0 0.0
(read/write) 146940 146940 0 0.0
.bss 38512 38512 0 0.0
.data 288 288 0 0.0
.text 101528 101528 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 840698 840698 0 0.0
bss 87316 87316 0 0.0
noinit 37160 37160 0 0.0
text 587724 587724 0 0.0

@andy31415
Copy link
Contributor

fast track: small delta with unit tests, created by a domain owner.

@andy31415 andy31415 merged commit bb9ac68 into project-chip:master Jan 19, 2022
selissia pushed a commit to selissia/connectedhomeip that referenced this pull request Jan 28, 2022
The Enter method can rewrite the state objects during pattern matching
traversal.  We need a one-shot bool to ensure we only execute
Enter once.  And although state changes from Exit, LogTransition and
GetName aren't expected, we should check in these too.  In all cases,
the pattern match should only execute once.

This commit adds the necessary check and a test case to verify this is
working correctly.
@msandstedt msandstedt deleted the bugfix/state-machine-pattern-matching branch March 31, 2022 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants