SeeWasm
SeeWasm copied to clipboard
`strstr` function does not perform well
Describe the bug
In Wasm-samples/c_samples.nosync/source/test_c_library.c
, we add a strstr
function to illustrate the ability of our engine.
However, after several tests, we find that: once the needle
is longer than 4 bytes, the strstr
would invoke twoway_strstr
, and the return value of strstr
is always 0
.
We find the source code of twoway_strstr
, and put it in Wasm-samples/c_samples.nosync/source/twoway_strstr.c
, whose result is equivalent to the real execution.
Thus, we guess the reason behind that is:
- something error happened on the way from
strstr
totwoway_strstr
- the
twoway_strstr
embedded instrstr
is not equivalent to ours
To Reproduce Directly execute these two samples to see the different:
The twoway_strstr
we found:
python3 eunomia_entry -f /Users/ningyuhe/Downloads/test.wasm -s --onlyfunc __original_main --concrete_globals
The problematic strstr
:
python3 eunomia_entry -f ./Wasm-samples/c_samples.nosync/wasi/test_c_library.wasm -s --onlyfunc __original_main --concrete_globals
Expected behavior
The haystack is TutorialPoint
and the needle is Point
. Thus, the output should be Point
.