From f9898d97e8d0c6051d9c36cba2af83d87c60ac42 Mon Sep 17 00:00:00 2001 From: Michael Cook <michael@episci.com> Date: Tue, 29 Dec 2020 16:04:21 -0500 Subject: [PATCH] gdb.txt: Refine Based on issues discovered by Zaid --- cmake_targets/gdb.txt | 33 +++++++++++++++++++++++++++++++-- cmake_targets/sudo-gdb | 2 +- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/cmake_targets/gdb.txt b/cmake_targets/gdb.txt index 33d9bd6d5fe..54e47c27e98 100644 --- a/cmake_targets/gdb.txt +++ b/cmake_targets/gdb.txt @@ -1,3 +1,6 @@ +------------------------------------------------------------------------------- +Build. + Make sure you've built with debug info: cd ~/openairinterface5g # or wherever @@ -6,6 +9,9 @@ Make sure you've built with debug info: ./build_oai --UE --eNB --verbose-compile --run-with-gdb RelWithDebInfo make -C ran_build/build -j4 lte-softmodem lte-uesoftmodem +------------------------------------------------------------------------------- +Verify. + Verify the build was done correctly: $ ./gdb-helper @@ -46,9 +52,32 @@ the build as above. (gdb) b main -Using Vscode +------------------------------------------------------------------------------- +Password-less sudo. + +Vscode launches lte-softmodem via sudo. Make sure sudo does not prompt you +for a password: + + sudo -n id + +If that command fails, do the following: + + echo "$USER ALL=(ALL) NOPASSWD: ALL" | sudo tee -a /etc/sudoers + +Then verify: + + sudo -n id + +------------------------------------------------------------------------------- +Vscode. + +Launch Vscode: cd ~/openairinterface5g # or wherever code . targets/RT/USER/lte-softmodem.c .vscode/launch.json -See launch.json for details about how lte-softmodem is launched. +See launch.json for details about how vscode launches lte-softmodem for debugging. + +For example, in lte-softmodem.c, scroll to main() and click the line number to +the left of main to add a breakpoint. then do Run => Start debugging (F5) to +run lte-softmodem in the debugger diff --git a/cmake_targets/sudo-gdb b/cmake_targets/sudo-gdb index d660a774830..7c4005e19b3 100755 --- a/cmake_targets/sudo-gdb +++ b/cmake_targets/sudo-gdb @@ -3,4 +3,4 @@ cd "$(dirname "$0")/.." || exit source oaienv cd cmake_targets || exit -exec sudo -E gdb "$@" +exec sudo -nE gdb "$@" -- GitLab