What application for dbg in wx-less environment

I’m trying to make an OTP release on production, and in the past, I have had runtime_tools'' as a dependency to use the dbg’’ tooling. In a plain erlang shell on this production box, I can play with dbg'' just fine, however now I see that the runtime_tools’’ application relies of ``observer’’ and I didn’t install a wx version of erlang on this server. (OpenBSD has two flavors of erlang25 – with wx, and without.)

My main question is: if I can access dbg'' tooling on production, what application in making a release should I use that ISN'T runtime_tools’’ but provides the ``dbg’’ tooling. Happy to share more info as needed.

P.S. I have the same OpenBSD version running on various machines, and the wx-less libs that are NOT installed on my problematic server are: debugger-5.3, observer-2.12, and wx-2.2.

2 Likes

The runtime_tools application is not dependent on observer but in the opposite direction observer is dependent on runtime_tools and its observer_backend module.

What made you think that runtime_tools relies on observer?

1 Like

Well, that’s what I was thinking, too. I thought runtime_tools was low level. When I open an erlang shell on this wx-less machine, and try out application:ensure_started(runtime_tools). It yields the following:



=SUPERVISOR REPORT==== 17-Jan-2023::19:34:31.523842 ===
    supervisor: {local,runtime_tools_sup}
    errorContext: start_error
    reason: {undef,[{observer_backend,ttb_resume_trace,[],[]},
                    {ttb_autostart,init,1,
                                   [{file,"ttb_autostart.erl"},{line,47}]},
                    {gen_server,init_it,2,
                                [{file,"gen_server.erl"},{line,848}]},
                    {gen_server,init_it,6,
                                [{file,"gen_server.erl"},{line,811}]},
                    {proc_lib,init_p_do_apply,3,
                              [{file,"proc_lib.erl"},{line,240}]}]}
    offender: [{pid,undefined},
               {id,ttb_autostart},
               {mfargs,{ttb_autostart,start_link,[]}},
               {restart_type,temporary},
               {significant,false},
               {shutdown,3000},
               {child_type,worker}]

=CRASH REPORT==== 17-Jan-2023::19:34:31.536932 ===
  crasher:
    initial call: application_master:init/4
    pid: <0.78.0>
    registered_name: []
    exception exit: {{shutdown,
                         {failed_to_start_child,ttb_autostart,
                             {undef,
                                 [{observer_backend,ttb_resume_trace,[],[]},
                                  {ttb_autostart,init,1,
                                      [{file,"ttb_autostart.erl"},{line,47}]},
                                  {gen_server,init_it,2,
                                      [{file,"gen_server.erl"},{line,848}]},
                                  {gen_server,init_it,6,
                                      [{file,"gen_server.erl"},{line,811}]},
                                  {proc_lib,init_p_do_apply,3,
                                      [{file,"proc_lib.erl"},{line,240}]}]}}},
                     {runtime_tools,start,[normal,[]]}}
      in function  application_master:init/4 (application_master.erl, line 142)
    ancestors: [<0.77.0>]
    message_queue_len: 1
    messages: [{'EXIT',<0.79.0>,normal}]
    links: [<0.77.0>,<0.44.0>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 376
    stack_size: 28
    reductions: 166
  neighbours:

=INFO REPORT==== 17-Jan-2023::19:34:31.616104 ===
    application: runtime_tools
    exited: {{shutdown,
                 {failed_to_start_child,ttb_autostart,
                     {undef,
                         [{observer_backend,ttb_resume_trace,[],[]},
                          {ttb_autostart,init,1,
                              [{file,"ttb_autostart.erl"},{line,47}]},
                          {gen_server,init_it,2,
                              [{file,"gen_server.erl"},{line,848}]},
                          {gen_server,init_it,6,
                              [{file,"gen_server.erl"},{line,811}]},
                          {proc_lib,init_p_do_apply,3,
                              [{file,"proc_lib.erl"},{line,240}]}]}}},
             {runtime_tools,start,[normal,[]]}}
    type: temporary
1 Like

Works for me, runtime_tools contain the observer_backend module and it contains the function
ttb_resume_trace.

Seems like a bad install or bad build?

1> application:ensure_started(runtime_tools).
ok
2> m(observer_backend).
Module: observer_backend
MD5: 7c34efd545d378de85e2a92241676ea2
Object file: /mnt/e/src/otp/lib/runtime_tools/ebin/observer_backend.beam
Compiler options:  [debug_info,
                    {i,"/mnt/e/src/otp/lib/runtime_tools/src/../include"},
                    {i,"/mnt/e/src/otp/lib/runtime_tools/src/../../et/include"},
                    {i,"/mnt/e/src/otp/lib/runtime_tools/src/../../../libraries/et/include"}]
Exports:
etop_collect/1                sys_info/0
fetch_stats/2                 ttb_fetch/2
get_port_list/0               ttb_fetch/3
get_socket_list/0             ttb_get_filenames/1
get_table/3                   ttb_init_node/3
get_table_list/2              ttb_resume_trace/0
module_info/0                 ttb_stop/1
module_info/1                 ttb_write_binary/2
procs_info/1                  ttb_write_trace_info/3
socket_info/0                 vsn/0
ok
3>
1 Like

I’ll reach out to the author of the openbsd package. Thanks all. My solution was to install the erlang-wx-25 package that is offered alongside the version that is meant for headless systems.

1 Like

A patch for this is coming to openbsd:

1 Like

This is no longer an issue with OpenBSD 7.3.

1 Like

A bit late to the party perhaps…but edbg may be an alternative: GitHub - etnt/edbg: A simple tty interface to the Erlang debugger and tracer.

Cheers

1 Like