Re: [ptxdist] [PATCH] ptxdist: add cgdb command

2020-10-28 Thread Michael Olbrich
On Mon, Oct 26, 2020 at 07:18:39PM +0100, Marian Cichy wrote:
> cgdb is a curses-frontend for gdb with some
> visual conveniences for debugging. ptxdist already
> has a 'ptxdist gdb' command to invoke gdb with
> configured sysroot etc., and it would be nice
> to have when we can also use cgdb.
> 
> Signed-off-by: Marian Cichy 
> ---
>  bin/ptxdist | 15 +++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/bin/ptxdist b/bin/ptxdist
> index 0d5e4328e..91af19cc3 100755
> --- a/bin/ptxdist
> +++ b/bin/ptxdist
> @@ -765,6 +765,8 @@ Misc:
>   use 'newpackage help' for a longer description
>nfsrootrun a userspace NFS server and export the 
> nfsroot
>gdbrun cross gdb with configured sysroot 
> etc.
> +  cgdb   run cross gdb with configured sysroot 
> etc.
> + with cgdb as frontend
>bsp-info   print some basic information about the BSP
>package-info  print some basic information about the package
>print print the contents of a variable, in 
> the way
> @@ -1706,6 +1708,19 @@ EOF
>   check_deps &&
>   ptxd_make_log bsp-info
>   ;;
> + cgdb)

Please merge this with the 'gdb' section:

gdb|cgdb)
local -a prefix
if [ "${cmd}" = "cgdb" ]; then
prefix=( cgdb -d )

> + if ! command -v cgdb &>/dev/null

We use 'which' for stuff like that.

> + then

Keep it in the same line, seprated with ';'.

> + echo
> + echo "error: cgdb is required to be installed 
> on your host-machine."
> + echo

Use ptxd_bailout

> + exit 1
> + fi
> + check_premake_compiler &&
> + compiler_prefix="$(ptxd_get_ptxconf 
> PTXCONF_COMPILER_PREFIX)" &&
> + ptxdist_trap_exit_handler &&
> + exec cgdb -d 
> "${PTXDIST_PLATFORMDIR}/sysroot-host/lib/wrapper/${compiler_prefix}gdb" "${@}"

exec "${prefix[@]}" 
"${PTXDIST_PLATFORMDIR}/sysroot-host/lib/wrapper/${compiler_prefix}gdb" "${@}"

Michael

> + ;;
>   clean)
>   check_config &&
>   check_deps &&
> -- 
> 2.20.1
> 
> 
> ___
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to 
> ptxdist-requ...@pengutronix.de
> 

-- 
Pengutronix e.K.   | |
Steuerwalder Str. 21   | http://www.pengutronix.de/  |
31137 Hildesheim, Germany  | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to 
ptxdist-requ...@pengutronix.de


[ptxdist] [PATCH] ptxdist: add cgdb command

2020-10-26 Thread Marian Cichy
cgdb is a curses-frontend for gdb with some
visual conveniences for debugging. ptxdist already
has a 'ptxdist gdb' command to invoke gdb with
configured sysroot etc., and it would be nice
to have when we can also use cgdb.

Signed-off-by: Marian Cichy 
---
 bin/ptxdist | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/bin/ptxdist b/bin/ptxdist
index 0d5e4328e..91af19cc3 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -765,6 +765,8 @@ Misc:
use 'newpackage help' for a longer description
   nfsroot  run a userspace NFS server and export the 
nfsroot
   gdb  run cross gdb with configured sysroot etc.
+  cgdb run cross gdb with configured sysroot etc.
+   with cgdb as frontend
   bsp-info print some basic information about the BSP
   package-infoprint some basic information about the package
   print   print the contents of a variable, in the way
@@ -1706,6 +1708,19 @@ EOF
check_deps &&
ptxd_make_log bsp-info
;;
+   cgdb)
+   if ! command -v cgdb &>/dev/null
+   then
+   echo
+   echo "error: cgdb is required to be installed 
on your host-machine."
+   echo
+   exit 1
+   fi
+   check_premake_compiler &&
+   compiler_prefix="$(ptxd_get_ptxconf 
PTXCONF_COMPILER_PREFIX)" &&
+   ptxdist_trap_exit_handler &&
+   exec cgdb -d 
"${PTXDIST_PLATFORMDIR}/sysroot-host/lib/wrapper/${compiler_prefix}gdb" "${@}"
+   ;;
clean)
check_config &&
check_deps &&
-- 
2.20.1


___
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to 
ptxdist-requ...@pengutronix.de