jet-live
jet-live copied to clipboard
`reload` command from example code `cannot hook functions` on Fedora 30
I'm experiencing a problem with jet-live
on Fedora 30
. The library is identifying changes to the files correctly, but it is not reloading the code as expected.
The error occurred while trying to follow the example of README.md
I assigned severityString.append("[D]")
to the jet::LogSeverity::kDebug
on onLog
method from ExampleListerner
to make the output easier to understand.
Running the code for the first time it was the output:
[I]: Initializing...
[D]: Parsing compilation commands...
[D]: Reading `compile_commands.json` from /home/username/jet-live/build/compile_commands.json
[D]: Success parsing compilation commands, total 48 compilation units
[I]: Load CUs: done
[D]: Root directory: /home/username/jet-live/
[D]: Parsing dependencies...
[D]: Success parsing dependencies
[I]: Load dependencies: done
[I]: Setup file watcher: done
[D]: Loading symbols for ...
[D]: Symbols loaded: funcs 9541, vars 33, Self
[D]: Loading symbols for linux-vdso.so.1 ...
[E]: Cannot load linux-vdso.so.1 file
[D]: linux-vdso.so.1 has no symbols, skipping
[D]: Loading symbols for /lib64/libpthread.so.0 ...
[D]: Symbols loaded: funcs 497, vars 45, /lib64/libpthread.so.0
[D]: Loading symbols for /lib64/libdl.so.2 ...
[D]: Symbols loaded: funcs 32, vars 8, /lib64/libdl.so.2
[D]: Loading symbols for /lib64/libstdc++.so.6 ...
[D]: /lib64/libstdc++.so.6 has no symbols, skipping
[D]: Loading symbols for /lib64/libm.so.6 ...
[D]: Symbols loaded: funcs 1910, vars 3, /lib64/libm.so.6
[D]: Loading symbols for /lib64/libgcc_s.so.1 ...
[D]: /lib64/libgcc_s.so.1 has no symbols, skipping
[D]: Loading symbols for /lib64/libc.so.6 ...
[D]: Symbols loaded: funcs 5248, vars 468, /lib64/libc.so.6
[D]: Loading symbols for /lib64/ld-linux-x86-64.so.2 ...
[D]: Symbols loaded: funcs 310, vars 40, /lib64/ld-linux-x86-64.so.2
[I]: Load symbols: done
[D]: Loading exported symbols list...
[D]: Done, total exported symbols: 12528 in 48 files
[I]: Load exported symbols: done
[I]: Ready
Enter command
Available commands: 'exit', 'reload', 'hello'
Hello
ttl: 2 > Hi there!
So I added an exclamation mark to the end of the phrase "Hi there!" that is displayed at the output of the command Hello
.
[I]: Compiling: SimpleCommandInterpreter.cpp
[I]: Success: SimpleCommandInterpreter.cpp
Jet-live was able to interpret the change correctly, but when I ran the command again, the output had not been changed.
Hello
ttl: 3 > Hi there!
Then I ran the command reload
and the errors below appeared (with status -22):
reload
[I]: Trying to reload code...
[I]: Linking...
[D]: Link command:
/usr/bin/g++ -fPIC -shared -g -Wl,-Ttext-segment,0xa42000 -Wl,-z,max-page-size=0x1000 -Wl,-export-dynamic -Wl,-soname,lib_reload1.so -o lib_reload1.so "/home/username/jet-live/build/example/CMakeFiles/example.dir/src/SimpleCommandInterpreter.cpp.o"
[I]: Linked successfully
[D]: Opening /home/username/jet-live/build/lib_reload1.so...
[D]: Library opened successfully
[D]: Loading symbols from /home/username/jet-live/build/lib_reload1.so...
[D]: Symbols loaded
[D]: Loading exported symbols list...
[D]: Done, total exported symbols: 21 in 1 files
[D]: Loading link-time relocations...
[D]: Done, relocated: 0/0
[D]: Hooking functions...
[E]: Cannot hook function: _ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_, status -22
[E]: Cannot hook function: _ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z, status -22
[E]: Cannot hook function: _ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_RKS8_, status -22
[E]: Cannot hook function: _ZNSt11char_traitsIcE6lengthEPKc, status -22
[E]: Cannot hook function: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE16_M_construct_auxIPcEEvT_S7_St12__false_type, status -22
[E]: Cannot hook function: _ZN24SimpleCommandInterpreterC2Ei, status -22
[E]: Cannot hook function: _ZNSt7__cxx119to_stringEi, status -22
[E]: Cannot hook function: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_, status -22
[E]: Cannot hook function: _ZSt4moveIRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEONSt16remove_referenceIT_E4typeEOS8_, status -22
[E]: Cannot hook function: _ZSt8distanceIPcENSt15iterator_traitsIT_E15difference_typeES2_S2_, status -22
[E]: Cannot hook function: _ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_PKS5_, status -22
[E]: Cannot hook function: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IPcvEET_S7_RKS3_, status -22
[E]: Cannot hook function: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IPcvEET_S7_RKS3_, status -22
[E]: Cannot hook function: _ZSt19__iterator_categoryIPcENSt15iterator_traitsIT_E17iterator_categoryERKS2_, status -22
[E]: Cannot hook function: _ZN24SimpleCommandInterpreter10runCommandERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE, status -22
[E]: Cannot hook function: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag, status -22
[E]: Cannot hook function: _ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_RKS8_, status -22
[E]: Cannot hook function: _ZNK24SimpleCommandInterpreter25getCurrentCommandsCounterEv, status -22
[E]: Cannot hook function: _ZN9__gnu_cxx17__is_null_pointerIcEEbPT_, status -22
[E]: Cannot hook function: _ZSt10__distanceIPcENSt15iterator_traitsIT_E15difference_typeES2_S2_St26random_access_iterator_tag, status -22
[E]: Cannot hook function: _ZN24SimpleCommandInterpreterC1Ei, status -22
[D]: Done, hooked: 0/21
[D]: Copying statics from old code to new one...
[D]: Done, copied: 1/1
[I]: Code reloaded
I'm using Cmake 3.14.5
and g++ 9.2.1
.
Hi. Yes, there're some problems with gcc 9+, I'm very busy right now and have no time to investigate it, but I'll let you know in this thread when it will be resolved.
I've had the same problem with Fedora 33 (clang 11.0). The problem might be with some SElinux permissions, since when I disable it (sudo setenforce 0
) the code reloads successfully.
I've had the same problem with Fedora 33 (clang 11.0). The problem might be with some SElinux permissions, since when I disable it (
sudo setenforce 0
) the code reloads successfully.
Yes, this is the solution. I've had the same problem in centos7(root, devtoolset-7, g++7.3.1), when I execute setenforce 0
, it works fine!