Skip to content

Commit 012d620

Browse files
committed
vkext RPC printf debug
1 parent 61856c9 commit 012d620

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

vkext/vkext-rpc-tl-serialization.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,10 +930,16 @@ bool store_function2(VK_ZVAL_API_P arr, zval *fetcher) {
930930
START_TIMER(store_function2)
931931
assert(arr);
932932
if (Z_TYPE_P(arr) != IS_OBJECT) {
933+
fprintf(stderr, "store_function2 Z_TYPE not object, %d\n", int(Z_TYPE_P(arr)));
933934
END_TIMER(store_function2)
934935
return false;
935936
}
937+
fprintf(stderr, "store_function2 before typedStore call\n");
938+
if (EG(exception)) {
939+
fprintf(stderr, "typedStore exception before\n");
940+
}
936941
vk_zend_call_known_instance_method(arr, "typedStore", strlen("typedStore"), fetcher, 0, NULL);
942+
fprintf(stderr, "store_function2 after typedStore call\n");
937943
if (EG(exception)) {
938944
// This behavior is consistent with old code, in this case, query_one will return qid 0
939945
fprintf(stderr, "typedStore exception\n");
@@ -953,6 +959,7 @@ bool store_function2(VK_ZVAL_API_P arr, zval *fetcher) {
953959
}
954960
// when using fetcher, tl_current_function_name will not be accessed. But we set it anyway in case we forgot something.
955961
tl_current_function_name = "typedStore";
962+
fprintf(stderr, "store_function2 before finish\n");
956963
END_TIMER(store_function2)
957964
return true;
958965
}
@@ -1423,13 +1430,15 @@ static zval *convert_rpc_extra_header_to_php_repr(const vkext_rpc::tl::RpcReqRes
14231430
zval *fetch_function2(zval *fetcher) {
14241431
ADD_CNT(fetch_function2)
14251432
START_TIMER(fetch_function2)
1433+
fprintf(stderr, "fetch_function2 start\n");
14261434

14271435
assert(fetcher);
14281436
assert(Z_TYPE_P(fetcher) == IS_OBJECT);
14291437

14301438
vkext_rpc::RpcError rpc_error;
14311439
rpc_error.try_fetch();
14321440
if (rpc_error.error.has_value()) {
1441+
fprintf(stderr, "fetch_function2 rpc_error.error\n");
14331442
zval *ret = make_query_result_or_error(NULL, rpc_error.error.value(), rpc_error.header.has_value() ? &rpc_error.header.value() : nullptr, rpc_error.flags);
14341443
END_TIMER(fetch_function2)
14351444
return ret;
@@ -1438,7 +1447,9 @@ zval *fetch_function2(zval *fetcher) {
14381447
zval* return_value;
14391448
VK_ALLOC_INIT_ZVAL(return_value);
14401449
ZVAL_UNDEF(return_value);
1450+
fprintf(stderr, "fetch_function2 before typedFetch call\n");
14411451
vk_zend_call_known_instance_method(fetcher, "typedFetch", strlen("typedFetch"), return_value, 0, NULL);
1452+
fprintf(stderr, "fetch_function2 after typedFetch call %d\n", Z_TYPE_P(return_value));
14421453
if (EG(exception)) {
14431454
efree(return_value); // it is UNDEF
14441455

@@ -1451,8 +1462,9 @@ zval *fetch_function2(zval *fetcher) {
14511462
zval *message;
14521463
VK_ALLOC_INIT_ZVAL(message);
14531464
ZVAL_UNDEF(message);
1465+
fprintf(stderr, "fetch_function2 exception before call getMessage\n");
14541466
vk_zend_call_known_instance_method(&exception_zval, "getMessage", strlen("getMessage"), message, 0, NULL);
1455-
// fprintf(stderr, "getMessage after call %d\n", Z_TYPE(message));
1467+
fprintf(stderr, "fetch_function2 exception after call getMessage %d\n", Z_TYPE_P(message));
14561468
assert(Z_TYPE_P(message) == IS_STRING);
14571469

14581470
OBJ_RELEASE(old_exception);
@@ -1464,18 +1476,21 @@ zval *fetch_function2(zval *fetcher) {
14641476
// vk_zend_update_public_property_string(_err, "error", "hren");
14651477
vk_zend_update_public_property_long(_err, "error_code", -1000);
14661478
END_TIMER(fetch_function2)
1479+
fprintf(stderr, "fetch_function2 exception return %d\n", Z_TYPE_P(_err));
14671480
return _err;
14681481
}
14691482
// TODO - will remove later when everything works
14701483
// fprintf(stderr, "typedFetch after call %d\n", Z_TYPE_P(return_value));
14711484
if (Z_TYPE_P(return_value) != IS_OBJECT) { // should be never, but that is user code
1485+
fprintf(stderr, "fetch_function2 typedFetch return_value not object\n");
14721486
zval *_err = create_php_instance(reqResult_error_class_name);
14731487
vk_zend_update_public_property_string(_err, "error", "fetcher->typedFetch() did not return object, as expected");
14741488
vk_zend_update_public_property_long(_err, "error_code", -1000);
14751489
END_TIMER(fetch_function2)
14761490
return _err;
14771491
}
14781492
if (rpc_error.header.has_value()) {
1493+
fprintf(stderr, "fetch_function2 typedFetch rpc_error.header\n");
14791494
zval *wrapped_err = create_php_instance(reqResult_header_class_name);
14801495
zval *header_php_repr = convert_rpc_extra_header_to_php_repr(rpc_error.header.value());
14811496

@@ -1485,6 +1500,7 @@ zval *fetch_function2(zval *fetcher) {
14851500
END_TIMER(fetch_function2)
14861501
return wrapped_err;
14871502
}
1503+
fprintf(stderr, "fetch_function2 typedFetch underscore class\n");
14881504
zval *wrapped_err = create_php_instance(reqResult_underscore_class_name);
14891505
set_field(&wrapped_err, return_value, "result", -1);
14901506
END_TIMER(fetch_function2)

vkext/vkext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include "vkext/vk_zend.h"
99

10-
#define VKEXT_VERSION "1.03"
10+
#define VKEXT_VERSION "1.03-rpc-debug1"
1111

1212
#define VKEXT_NAME "vk_extension"
1313

0 commit comments

Comments
 (0)