aboutsummaryrefslogtreecommitdiff
path: root/gdb/gcore.in
diff options
context:
space:
mode:
authorAlexandra Hájková <ahajkova@redhat.com>2024-02-02 11:13:47 +0100
committerAlexandra Hájková <ahajkova@redhat.com>2024-07-29 16:33:22 +0200
commit7e42bbed5b11c30330b722d78eec3b2004f1a918 (patch)
tree6b54b81c7917e478a8d957f9c6c20e20524997d8 /gdb/gcore.in
parent5dd825c15dcdf0278a37c7d8581019a4ace56c8f (diff)
downloadgdb-7e42bbed5b11c30330b722d78eec3b2004f1a918.zip
gdb-7e42bbed5b11c30330b722d78eec3b2004f1a918.tar.gz
gdb-7e42bbed5b11c30330b722d78eec3b2004f1a918.tar.bz2
Add a test for the gcore script
It also tests the gcore script being run without its accessible terminal. This test was written by Jan Kratochvil a long time ago. I modernized the test making it use various procs from lib/gdb.exp, reorganizing it and added some comments. Modify the gcore script to make it possible to pass the --data-directory to it. This prevents a lot of these warnings: Python Exception <class 'AttributeError'>: module 'gdb' has no attribute '_handle_missing_debuginfo' Tested by using make check-all-boards. Co-Authored-By: Jan Kratochvil <jan.kratochvil@redhat.com> Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Diffstat (limited to 'gdb/gcore.in')
-rw-r--r--gdb/gcore.in12
1 files changed, 9 insertions, 3 deletions
diff --git a/gdb/gcore.in b/gdb/gcore.in
index 982c854..0c40e5a 100644
--- a/gdb/gcore.in
+++ b/gdb/gcore.in
@@ -27,7 +27,9 @@ prefix=core
# to ensure gdb dumps all mappings (OS dependent).
dump_all_cmds=()
-while getopts :ao: opt; do
+data_directory_opt=()
+
+while getopts :ao:d: opt; do
case "$opt" in
a)
case "$OSTYPE" in
@@ -40,8 +42,11 @@ while getopts :ao: opt; do
o)
prefix=$OPTARG
;;
+ d)
+ data_directory_opt=("--data-directory" "$OPTARG")
+ ;;
*)
- echo "usage: @GCORE_TRANSFORM_NAME@ [-a] [-o prefix] pid1 [pid2...pidN]"
+ echo "usage: @GCORE_TRANSFORM_NAME@ [-a] [-o prefix] [-d data-directory] pid1 [pid2...pidN]"
exit 2
;;
esac
@@ -51,7 +56,7 @@ shift $((OPTIND-1))
if [ "$#" -eq "0" ]
then
- echo "usage: @GCORE_TRANSFORM_NAME@ [-a] [-o prefix] pid1 [pid2...pidN]"
+ echo "usage: @GCORE_TRANSFORM_NAME@ [-a] [-o prefix] [-d data-directory] pid1 [pid2...pidN]"
exit 2
fi
@@ -98,6 +103,7 @@ do
# `</dev/null' to avoid touching interactive terminal if it is
# available but not accessible as GDB would get stopped on SIGTTIN.
"$binary_path/@GDB_TRANSFORM_NAME@" </dev/null \
+ "${data_directory_opt[@]}" \
--nx --batch --readnever -iex 'set debuginfod enabled off' \
-ex "set pagination off" -ex "set height 0" -ex "set width 0" \
"${dump_all_cmds[@]}" \