Development

Build

Follow build instructions in the helloworld-binding documentation.

Debug

Configure the project to build in debug mode:

# Configure the build system
sh-5.2$ cmake -DCMAKE_BUILD_TYPE=DEBUG ..
-- The C compiler identification is GNU 14.2.1
-- The CXX compiler identification is GNU 14.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "2.1.0")
-- Checking for modules 'json-c;afb-binding>=4.1.0'
--   Found json-c, version 0.18
--   Found afb-binding, version 4.3.0
-- Configuring done (0.5s)
-- Generating done (0.0s)
-- Build files have been written to: /home/marqui/project/helloworld-binding/build

# Build the project
sh-5.2$ make
[ 25%] Generating info_verb.c
[ 50%] Building C object CMakeFiles/helloworld-binding.dir/src/helloworld.c.o
[ 75%] Building C object CMakeFiles/helloworld-binding.dir/info_verb.c.o
[100%] Linking C shared library helloworld-binding.so
[100%] Built target helloworld-binding

The configuration GDB helloworld-binding.so from the launch.json file is of type cppdbg, thus look for @category:debuggers cppdbg in your IDE marketplace.

Once installed, set a breakpoint in hello verb process, launch the debug configuration and run in an other terminal:

sh-5.2$ afb-client -H localhost:1234/api helloworld hello
implicit null in arguments is deprecated and will be removed soon.
ON-EVENT helloworld/verb_called:
{
  "jtype":"afb-event",
  "event":"helloworld/verb_called",
  "data":"hello"
}

building-and running-service-natively-debug

Framework debug packages are available.

sh-5.2$ sudo dnf debuginfo-install afb-binder
enabling redpesk-middleware-update-debuginfo repository
enabling epel-debuginfo repository
enabling redpesk-third-party-debuginfo repository
RedPesk Middleware corn-3.0 Update - x86_64                                                                                                      187 kB/s |  36 kB     00:00    
Extra Packages for Enterprise Linux corn - x86_64                                                                                                 14 MB/s | 6.8 MB     00:00    
Extra Packages for Enterprise Linux corn - x86_64 - Debug                                                                                        4.0 MB/s | 1.4 MB     00:00    
RedPesk Config                                                                                                                                   3.6 kB/s | 639  B     00:00    
RedPesk Middleware corn-3.0 Update - x86_64 - Debug                                                                                               90 kB/s |  20 kB     00:00    
RedPesk Third Party corn-3.0 Update - x86_64                                                                                                     812 kB/s | 240 kB     00:00    
RedPesk Third Party corn-3.0 Update - x86_64 - Debug                                                                                             100 kB/s |  20 kB     00:00    
Dependencies resolved.
=================================================================================================================================================================================
 Package                                  Architecture             Version                                           Repository                                             Size
=================================================================================================================================================================================
Installing:
 afb-binder-debuginfo                     x86_64                   5.3.1-44.redpesk.core.rpcorn                      redpesk-middleware-update-debuginfo                    75 k
 afb-binder-debugsource                   x86_64                   5.3.1-44.redpesk.core.rpcorn                      redpesk-middleware-update-debuginfo                    41 k

Transaction Summary
=================================================================================================================================================================================
Install  2 Packages

Total download size: 116 k
Installed size: 347 k
Downloading Packages:
(1/2): afb-binder-debuginfo-5.3.1-44.redpesk.core.rpcorn.x86_64.rpm                                                                              469 kB/s |  75 kB     00:00    
(2/2): afb-binder-debugsource-5.3.1-44.redpesk.core.rpcorn.x86_64.rpm                                                                            247 kB/s |  41 kB     00:00    
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                            691 kB/s | 116 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                         1/1 
  Installing       : afb-binder-debugsource-5.3.1-44.redpesk.core.rpcorn.x86_64                                                                                              1/2 
  Installing       : afb-binder-debuginfo-5.3.1-44.redpesk.core.rpcorn.x86_64                                                                                                2/2 
  Running scriptlet: afb-binder-debuginfo-5.3.1-44.redpesk.core.rpcorn.x86_64                                                                                                2/2 

Installed:
  afb-binder-debuginfo-5.3.1-44.redpesk.core.rpcorn.x86_64                               afb-binder-debugsource-5.3.1-44.redpesk.core.rpcorn.x86_64                              

Complete!

Test

The packages afb-test-py & python-unversioned-command are required to execute helloworld-binding tests:

sh-5.2$ sudo dnf install afb-test-py python-unversioned-command
Dependencies resolved.
================================================================================================================================================================================================
 Package                                           Architecture                  Version                                                 Repository                                        Size
================================================================================================================================================================================================
Installing:
 afb-test-py                                       noarch                        0.3.0-4.redpesk.common.rpcorn                           redpesk-middleware-update                         16 k
 python-unversioned-command                        noarch                        3.12.9-2.el10_0                                         redpesk-baseos-update                             12 k
Installing dependencies:
 afb-libpython                                     x86_64                        2.2.2-22.redpesk.common.rpcorn                          redpesk-middleware-update                         33 k
 libafb-binder5                                    x86_64                        5.3.1-44.redpesk.core.rpcorn                            redpesk-middleware-update                         22 k

Transaction Summary
================================================================================================================================================================================================
Install  4 Packages

Total download size: 82 k
Installed size: 141 k
Downloading Packages:
(1/4): afb-libpython-2.2.2-22.redpesk.common.rpcorn.x86_64.rpm                                                                                                  224 kB/s |  33 kB     00:00    
(2/4): afb-test-py-0.3.0-4.redpesk.common.rpcorn.noarch.rpm                                                                                                     105 kB/s |  16 kB     00:00    
(3/4): libafb-binder5-5.3.1-44.redpesk.core.rpcorn.x86_64.rpm                                                                                                   137 kB/s |  22 kB     00:00    
(4/4): python-unversioned-command-3.12.9-2.el10_0.noarch.rpm                                                                                                    351 kB/s |  12 kB     00:00    
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                           449 kB/s |  82 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                        1/1 
  Installing       : libafb-binder5-5.3.1-44.redpesk.core.rpcorn.x86_64                                                                                                                     1/4 
  Running scriptlet: libafb-binder5-5.3.1-44.redpesk.core.rpcorn.x86_64                                                                                                                     1/4 
  Installing       : afb-libpython-2.2.2-22.redpesk.common.rpcorn.x86_64                                                                                                                    2/4 
  Running scriptlet: afb-libpython-2.2.2-22.redpesk.common.rpcorn.x86_64                                                                                                                    2/4 
  Installing       : afb-test-py-0.3.0-4.redpesk.common.rpcorn.noarch                                                                                                                       3/4 
  Installing       : python-unversioned-command-3.12.9-2.el10_0.noarch                                                                                                                      4/4 
  Running scriptlet: python-unversioned-command-3.12.9-2.el10_0.noarch                                                                                                                      4/4 

Installed:
  afb-libpython-2.2.2-22.redpesk.common.rpcorn.x86_64              afb-test-py-0.3.0-4.redpesk.common.rpcorn.noarch              libafb-binder5-5.3.1-44.redpesk.core.rpcorn.x86_64             
  python-unversioned-command-3.12.9-2.el10_0.noarch               

Complete!

All is set to follow test instructions in the helloworld-binding documentation.