rjhdby
08/16/2018, 10:12 AMSegmentation Fault
when use it.
gdb
shows surprising error
Program received signal SIGSEGV, Segmentation fault.
kfun:kotlinx.cinterop.toKString@kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVarOf<kotlin.Byte>>.()kotlin.String ()
at /opt/buildAgent/work/4d622a065c544371/Interop/Runtime/src/main/kotlin/kotlinx/cinterop/Utils.kt:402
402 /opt/buildAgent/work/4d622a065c544371/Interop/Runtime/src/main/kotlin/kotlinx/cinterop/Utils.kt: No such file or directory.
olonho
08/16/2018, 12:54 PMrjhdby
08/16/2018, 1:07 PM#0 kfun:kotlinx.cinterop.toKString@kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVarOf<kotlin.Byte>>.()kotlin.String ()
at /opt/buildAgent/work/4d622a065c544371/Interop/Runtime/src/main/kotlin/kotlinx/cinterop/Utils.kt:402
#1 0x00007fffe71c913e in kfun:php.extension.proxy.getString@kotlinx.cinterop.CPointer<php._zval_struct>.()kotlin.String ()
from ./phpmodule/modules/example.so
#2 0x00007fffe71c9d92 in kfun:printArray(kotlinx.cinterop.CPointer<php._zval_struct>) ()
from ./phpmodule/modules/example.so
#3 0x00007fffe71c449a in _konan_function_8_impl(void*) () from ./phpmodule/modules/example.so
#4 0x00007fffe71c2fc1 in zif_printArray (execute_data=<optimized out>, return_value=0x7fffffffcd30)
at /root/simpleExtension/phpmodule/extension.c:183
#5 0x0000555555802e7a in ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER ()
#6 0x00005555557f2cab in execute_ex ()
#7 0x0000555555846964 in zend_execute ()
#8 0x000055555579c168 in zend_eval_stringl ()
#9 0x000055555579c319 in zend_eval_stringl_ex ()
#10 0x00005555558488e3 in do_cli ()
#11 0x0000555555624bbf in main ()
Last called function
fun zval.getString() = __zp_zval_to_string(this.ptr)?.toKString() ?: ""
function in .def
static inline char* __zp_zval_to_string(zval *z_value){
return Z_STRVAL_P(z_value);
}
function in compiled .def
fun __zp_zval_to_string(z_value: CValuesRef<zval>?): CPointer<ByteVar>? {
memScoped {
return interpretCPointer<ByteVar>(kniBridge1239(z_value?.getPointer(memScope).rawValue))
}
}
K/N version
info: kotlinc-native 1.2.60-dev-444 (JRE 1.8.0_171-b10)
Kotlin/Native: 0.7.1
rjhdby
08/16/2018, 2:35 PMtoKString()
in this code
fun zval.getString() = __zp_zval_to_string(this.ptr)?.toKString() ?: ""
static inline char* __zp_zval_to_string(zval *z_value){
return Z_STRVAL_P(z_value);
}
When I cast same zval
to Long, all works properly
fun zval.getLong() = __zp_zval_to_long(this.ptr)
static inline int32_t __zp_zval_to_long(zval *z_value){
return Z_LVAL_P(z_value);
}
rjhdby
08/17/2018, 9:31 AMunion
.
union {
uint32_t intVal;
char * strVal;
Error appears if structure defined with intVar
, but requested as strVal
.
But error like /opt/buildAgent/work/4d622a065c544371/Interop/Runtime/src/main/kotlin/kotlinx/cinterop/Utils.kt: No such file or directory.
is confusingolonho
08/18/2018, 7:33 AM