[Libwebsockets] Correct way to initialize connect_info and context_info

Pranjali Chumbhale pranjalic at safeai.ai
Tue Mar 24 02:21:37 CET 2020


Hello Brice,

Looks like a typo there.
But here is what I wanted to ask, that I am initializing connect info and
connect info in the similar way.
But for connect_info->address (it says cannot access memory)

Find my gdb trace below;
(gdb) n
24        std::memset(m_context_info, 0, sizeof(*m_context_info));
(gdb) *print(m_context_info )*
$7 = (lws_context_creation_info *) 0x7ffd8d2b93c0
*(gdb) print(*m_context_info)*
$8 = {port = 0, iface = 0x0, protocols = 0x7ffd8d2b93f0, extensions =
0x7fa6b4184b18, token_limits = 0x7ffd8d2b9400,
  ssl_private_key_password = 0x55f041dbdd6b <std::get<0ul,
testing::internal::GTestFlagSaver*,
std::default_delete<testing::internal::GTestFlagSaver>
>(std::tuple<testing::internal::GTestFlagSaver*,
std::default_delete<testing::internal::GTestFlagSaver> >&)+42>
"H\211\302H\213\005\363Z(",
  ssl_cert_filepath = 0x7ffd8d2b9440 "P\224+\215\375\177",
ssl_private_key_filepath = 0x7fa6b4184b18 "\260\345\021C\360U",
  ssl_ca_filepath = 0x7ffd8d2b9420 "P\224+\215\375\177",
  ssl_cipher_list = 0x55f041db0c08
<std::__uniq_ptr_impl<testing::internal::GTestFlagSaver,
std::default_delete<testing::internal::GTestFlagSaver> >::_M_ptr()+42>
"H\211\302H\213\005\006_)", http_proxy_address = 0x7ffd8d2b9430
"\260\345\021C\360U", http_proxy_port = 3021490968, gid = 32678, uid =
-1926523824,
  options = 94490385386429, user = 0x55f04311e5b0, ka_time = -1273476328,
ka_probes = 32678, ka_interval = -1926523824, provided_client_ssl_ctx =
0x0,
  max_http_header_data = 37888, max_http_header_pool = 36139, count_threads
= 32765, fd_limit_per_thread = 1125242896, timeout_secs = 22000,
  ecdh_curve = 0x7ffd8d2b9480 "\260\224+\215\375\177", vhost_name =
0x71af164c0e4fb00 <error: Cannot access memory at address
0x71af164c0e4fb00>,
  plugin_dirs = 0x7ffd8d2b94a0, pvo = 0x0, keepalive_timeout = -1926523728,
  log_filepath = 0x55f041db0d6e
<testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test,
void>(testing::Test*, void (testing::Test::*)(), char const*)+137>
"\220H\213\005Z])", mounts = 0x21, server_string = 0x0, pt_serv_buf_size =
1105040747, max_http_header_data2 = 22000, ssl_options_set =
140353962789648,
  ssl_options_clear = 140726971897152, ws_ping_pong_interval = 7995,
headers = 0x21, reject_service_keywords = 0x0,
  external_baggage_free_on_destroy = 0x55f041dd956b,
client_ssl_private_key_password = 0x7fa6b4184b10 "@\035",
  client_ssl_cert_filepath = 0x55f041d5280c
<testing::TestPartSkipped(testing::TestPartResult const&)>
"UH\211\345H\203\354\020H\211}\370H\213\005\061\207\060",
  client_ssl_cert_mem = 0x55f04311d8b8, client_ssl_cert_mem_len =
2368443688, client_ssl_private_key_filepath = 0x0, client_ssl_ca_filepath =
0x0,
  client_ssl_ca_mem = 0x71af164c0e4fb00, client_ssl_ca_mem_len =
2368443696,
  client_ssl_cipher_list = 0x55f041d528a8 <testing::TestResult::Skipped()
const+90> "\211\302H\213\005\177\206\060", fops = 0x7ffd8d2b9530,
  simultaneous_ssl_restriction = -1058735360, socks_proxy_address =
0x7ffd8d2b9540 "\260\225+\215\375\177", socks_proxy_port = 0, bind_iface =
0,
  ssl_info_event_mask = -1926523472, timeout_secs_ah_idle = 32765,
ip_limit_ah = 17320, ip_limit_wsi = 16853, http2_settings = {22000, 17, 0,
0, 0, 0, 0},
  error_document_404 = 0x7fa6b4184b10 "@\035", alpn = 0x0, foreign_loops =
0x55f04311c840, signal_cb = 0x7ffd8d2b95a0, pcontext = 0x0,
  finalize = 0x55f041d6f8c8
<testing::internal::UnitTestImpl::RunAllTests()>, finalize_arg = 0x0,
max_http_header_pool2 = 17, ssl_client_options_set = 0,
  ssl_client_options_clear = 140726971897376, tls1_3_plus_cipher_list =
0x55f041d55976 <testing::TestInfo::Run()+594> "H\213\005\313I0",
  client_tls_1_3_plus_cipher_list = 0x0, listen_accept_role =
0x55f04311d7f0 "\200\327\021C\360U", listen_accept_protocol =
0x55f04311c840 "\340\027",
  pprotocols = 0x55f04311ca40, server_ssl_cert_mem = 0x1710a1bb600,
server_ssl_cert_mem_len = 3021490960, server_ssl_private_key_mem =
0x7ffd8d2b9620,
  server_ssl_private_key_mem_len = 0, server_ssl_ca_mem = 0x55f041d6f8c8
<testing::internal::UnitTestImpl::RunAllTests()>, server_ssl_ca_mem_len =
0,
  username = 0x55f041d90e16 <testing::TestCase::RunSetUpTestCase()>
"UH\211\345H\203\354\020H\211}\370H\213\005w\354,", groupname = 0x0,
  unix_socket_perms = 0x7ffd8d2b9690 "\360\226+\215\375\177", system_ops =
0x55f041d56697 <testing::TestCase::Run()+525>, detailed_latency_cb = 0x1,
---Type <return> to continue, or q <return> to quit---
  detailed_latency_filepath = 0x55f04311d9b0 "p\032", retry_and_idle_policy
= 0x8d2b9660, register_notifier_list = 0x55f04311c840, udp_loss_sim_tx_pc =
64 '@',
  udp_loss_sim_rx_pc = 202 '\312', pss_policies_json = 0x1710a1bb600
<error: Cannot access memory at address 0x1710a1bb600>, pss_plugins =
0x7ffd8d2b9690,
  ss_proxy_bind = 0x0, ss_proxy_address = 0x55f041d6f8c8
<testing::internal::UnitTestImpl::RunAllTests()>
"UH\211\345H\203\354PH\211}\270dH\213\004%(",
  ss_proxy_port = 0, _unused = {0x0, 0x0, 0x7ffd8d2b96f0, 0x55f041d6fdf9
<testing::internal::UnitTestImpl::RunAllTests()+1329>}}
(gdb) *print(m_connect_info)*
$9 = (lws_client_connect_info *) 0x55f041dcc0f4 <std::_Tuple_impl<0ul,
testing::internal::GTestFlagSaver*,
std::default_delete<testing::internal::GTestFlagSaver>
>::_M_head(std::_Tuple_impl<0ul, testing::internal::GTestFlagSaver*,
std::default_delete<testing::internal::GTestFlagSaver> >&)+42>
*(gdb) print(*m_connect_info)*
$10 = {context = 0x3e9a058b48c28948, address = 0x894801c083480027 <error:
Cannot access memory at address 0x894801c083480027>, port = 658411269,
  ssl_connection = -796309504, path = 0x8348e5894855c3c9 <error: Cannot
access memory at address 0x8348e5894855c3c9>,
  host = 0x8b48f87d894810ec <error: Cannot access memory at address
0x8b48f87d894810ec>,
  origin = 0xc0834800273e5f05 <error: Cannot access memory at address
0xc0834800273e5f05>,
  protocol = 0x273e5405894801 <error: Cannot access memory at address
0x273e5405894801>, ietf_version_or_minus_one = -129660088, userdata =
0x48c2894800002c95,
  client_exts = 0x834800273e46058b, method = 0x273e3b05894801c0 <error:
Cannot access memory at address 0x273e3b05894801c0>, parent_wsi =
0x4855c3c9d0894800,
  uri_replace_from = 0x894810ec8348e589 <error: Cannot access memory at
address 0x894810ec8348e589>,
  uri_replace_to = 0x273e0b058b48f87d <error: Cannot access memory at
address 0x273e0b058b48f87d>, vhost = 0x5894801c0834800, pwsi =
0xf8458b4800273e00,
  iface = 0x2c96e8c78948 <error: Cannot access memory at address
0x2c96e8c78948>,
  local_protocol_name = 0x4800273df5058b48 <error: Cannot access memory at
address 0x4800273df5058b48>,
  alpn = 0x3dea05894801c083 <error: Cannot access memory at address
0x3dea05894801c083>, seq = 0x485590c3c9900027, opaque_user_data =
0x8b48f87d8948e589,
  retry_and_idle_policy = 0xc0834800273dbf05, manual_initial_tx_credit =
92882945, sys_tls_client_cert = 180 '\264', mqtt_cp = 0xc748f8458b48,
_unused = {
    0x4855c35d90000000, 0x894810ec8348e589, 0x273d83058b48f87d,
0x5894801c0834800}}



Regards,
Pranjali


On Mon, Mar 23, 2020 at 5:50 PM Brice Hamon <brice at ydotm.com> wrote:

> This is a C question, not a LWS.
> std::memset(&m_context_info, 0, sizeof(m_connect_info));
>
> On Mon, Mar 23, 2020 at 8:38 PM Pranjali Chumbhale <pranjalic at safeai.ai>
> wrote:
>
>> Hello team,
>> This is how I initialize the connect info and context info in my case:
>> std::memset(m_context_info, 0, sizeof(*m_context_info));
>> std::memset(m_context_info, 0, sizeof(*m_connect_info));
>> Following is my gdb debug log.
>>
>> (gdb) print(m_connect_info->address)
>> $4 = 0x894801c083480027 <error: Cannot access memory at address
>> 0x894801c083480027>
>> (gdb) print(m_connect_info->address)
>> $5 = 0x894801c083480027 <error: Cannot access memory at address
>> 0x894801c083480027>
>> (gdb) print(m_connect_info)
>> $6 = (lws_client_connect_info *) 0x55d9eb7820f4
>>      <std::_Tuple_impl<0ul, testing::internal::GTestFlagSaver*,
>> std::default_delete<testing::internal::GTestFlagSaver>
>> >::_M_head(std::_Tuple_impl<0ul, testing::internal::GTestFlagSaver*,
>> std::default_delete<testing::internal::GTestFlagSaver> >&)+42>
>> (gdb) print(m_connect_info->address)
>> $7 = 0x894801c083480027 <error: Cannot access memory at address
>> 0x894801c083480027>
>> (gdb) print(*m_connect_info.address)
>> Cannot access memory at address 0x894801c083480027
>>
>> What am I missing?
>>
>> Regards,
>> Pranjali
>> _______________________________________________
>> Libwebsockets mailing list
>> Libwebsockets at ml.libwebsockets.org
>> https://libwebsockets.org/mailman/listinfo/libwebsockets
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20200323/b576278c/attachment.htm>


More information about the Libwebsockets mailing list