From 0d54228976a65cd7ade9182e4227801c9220f975 Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Sat, 27 May 2017 02:11:32 +0200 Subject: [PATCH] Fixed Debug --- README.md | 50 +++- conf.d/config.cmake | 4 +- conf.d/templates/gdb/gdb-on-target.in | 3 + nbproject/configurations.xml | 457 +++++++++------------------------- 4 files changed, 159 insertions(+), 355 deletions(-) diff --git a/README.md b/README.md index ec73e01..26bbc38 100644 --- a/README.md +++ b/README.md @@ -60,22 +60,58 @@ AFB_daemon dependency on Standard Linux Distributions ``` -``` # Compile binding ``` -source ~/.bashrc # or any other file where your have place your compilation preferences -mkdir build -cd build -cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX .. -make + source ~/.bashrc # or any other file where your have place your compilation preferences + mkdir build + cd build + cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX .. + make - afb-daemon --ldpaths=. --port=1234 --workdir=. --roothttp=./htdocs --token="" --verbose + afb-daemon --workdir=.. --ldpaths=build --port=1234 --roothttp=./htdocs --token="" --verbose speaker-test -twav -D hw:ep01 -c 2 firefox http://localhost:1234 ``` +# Local Source Debug with GDB + +Warning: technically AGL bindings are shared libraries loaded thought 'dlopen'. GDB supports source debug of dynamically +loaded libraries, but user should be warn that the actual path to sharelib symbols is directly inherited from DLOPEN. +As a result if you change your directory after binder start with --workdir=xxx then GDB will not find symbols anymore + + +``` + Examples: + + # WORK when running in direct + afb-daemon --workdir=.. --ldpaths=build --port=1234 --roothttp=./htdocs + + # FAIL when using GDB with warning: Could not load shared library .... + gdb -args afb-daemon --workdir=.. --ldpaths=build --port=1234 --roothttp=./htdocs + ... + warning: Could not load shared library symbols for ./build/ucs2-afb/afb-ucs2.so. + Do you need "set solib-search-path" or "set sysroot"? + ... +``` + +To debug sharelib symbol path: start your binder under GDB. Then break your session after the binder has +loaded its bindings. Finally use "info sharedlibrary" and check 'SymsRead'. If equal to 'No' then either you start GDB +from the wrong relative directory, either you have to use 'set solib-search-path' to force the path. + +``` + gdb -args afb-daemon --workdir=.. --ldpaths=build --port=1234 --roothttp=./htdocs + run + ... + NOTICE: API unicens added + NOTICE: Waiting port=1234 rootdir=. + NOTICE: Browser URL= http://localhost:1234 + (hit Ctrl-C to break the execution) + info sharedlibrary afb-* +``` + + # Running an debugging on a target ``` diff --git a/conf.d/config.cmake b/conf.d/config.cmake index c4d9cf6..2c5cb12 100644 --- a/conf.d/config.cmake +++ b/conf.d/config.cmake @@ -50,8 +50,8 @@ set (PKG_REQUIRED_LIST ) # LANG Specific compile flags set for all build types -set(CMAKE_C_FLAGS "") -set(CMAKE_CXX_FLAGS "") +# set(CMAKE_C_FLAGS "") +# set(CMAKE_CXX_FLAGS "") # Define CONTROL_CDEV_NAME should match MOST driver values # --------------------------------------------------------- diff --git a/conf.d/templates/gdb/gdb-on-target.in b/conf.d/templates/gdb/gdb-on-target.in index 360c860..4426dbe 100644 --- a/conf.d/templates/gdb/gdb-on-target.in +++ b/conf.d/templates/gdb/gdb-on-target.in @@ -4,6 +4,9 @@ # Author: Fulup Ar Foll (IoT.bzh) # Reference: https://blog.flameeyes.eu/2010/02/remote-debugging-with-gdb-part-2-gdb/ +# move to package dir to read binding symbols +cd @CMAKE_CURRENT_BINARY_DIR@/@PROJECT_PKG_DIR@ + # Start gdbserver on target and connect through SSH link target remote | ssh @RSYNC_TARGET@ gdbserver - afb-daemon --port=@AFB_REMPORT@ --workdir=@RSYNC_PREFIX@/@PROJECT_NAME@ --roothttp=./htdocs --ldpath=./lib --verbose --token=@AFB_TOKEN@ diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml index 08e5bbf..4ff307d 100644 --- a/nbproject/configurations.xml +++ b/nbproject/configurations.xml @@ -139,8 +139,8 @@ false - - + + @@ -193,13 +193,6 @@ - - - - @@ -207,12 +200,48 @@ + + + + ../../../opt/include + /usr/include/json-c + ucs2-interface + ucs2-lib/inc + ucs2-lib/cfg + ucs2-lib/src/ucs-xml + ucs2-vol/inc + ucs2-vol/cfg + ucs2-vol/src/ucs-xml + build/ucs2-afb + + + CONTROL_CDEV_RX="/dev/inic-usb-crx" + CONTROL_CDEV_TX="/dev/inic-usb-ctx" + _REENTRANT + _THREAD_SAFE + + + + ../../../opt/include + /usr/include/json-c ucs2-interface ucs2-lib/inc + ucs2-lib/cfg + ucs2-lib/src/ucs-xml + ucs2-vol/inc + ucs2-vol/cfg + ucs2-vol/src/ucs-xml + build/ucs2-interface + + CONTROL_CDEV_RX="/dev/inic-usb-crx" + CONTROL_CDEV_TX="/dev/inic-usb-ctx" + _REENTRANT + _THREAD_SAFE + @@ -255,64 +284,36 @@ - - - ucs2-afb - ../../../opt/include/afb - build/ucs2-afb - + + + ucs2_EXPORTS + - - - ../../../opt/include/afb - ucs2-afb - /usr/include/json-c - ucs2-lib/inc - ucs2-interface - ucs2-lib/src/ucs-xml - build/ucs2-afb - + + + ucs2_EXPORTS + - - - ../../../opt/include - /usr/include/json-c - ucs2-interface - ucs2-lib/inc - ucs2-lib/cfg - ucs2-lib/src/ucs-xml - ucs2-vol/inc - ucs2-vol/cfg - ucs2-vol/src/ucs-xml - build/ucs2-afb - + - CONTROL_CDEV_RX="/dev/inic-usb-crx" - CONTROL_CDEV_TX="/dev/inic-usb-ctx" - _REENTRANT - _THREAD_SAFE ucs2_afb_EXPORTS + + + + - - - ucs2-lib/src/ucs-xml - build/ucs2-interface - + - - - ucs2-vol/inc - build/ucs2-interface - + @@ -320,471 +321,235 @@ - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-lib/src - ucs2-lib/inc - + - - - ucs2-vol/src - ucs2-lib/inc - ucs2-vol/inc - + - - - ucs2-vol/inc - ucs2-vol/src - ucs2-lib/inc - + - - - ucs2-vol/src - ucs2-lib/inc - ucs2-vol/inc - + - - - ucs2-vol/src - ucs2-lib/inc - ucs2-vol/inc - + - - - ucs2-vol/inc - ucs2-vol/src - ucs2-lib/inc - + -- 2.16.6