mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-05 15:15:42 +00:00
gcore: add -v or --version option to show version number
Based on the work in this commit:
commit fb2ded33c1
Date: Fri Dec 20 12:46:11 2024 -0800
Add gstack script
This commit adds a '-v' or '--version' option to the existing gcore
script. This new option causes the script to print its version
number, and then exit.
I needed to adjust the getopts handling a little in order to support
the long form '--version' argument, but as this makes gcore more
consistent with gstack, then this seems like a good thing.
The usage message is now getting a little long. Don't worry, I plan
to clean that up in the next commit.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32325
Approved-By: Tom Tromey <tom@tromey.com>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
This commit is contained in:
@@ -2352,18 +2352,15 @@ run: Makefile
|
|||||||
jit-reader.h: $(srcdir)/jit-reader.in config.status
|
jit-reader.h: $(srcdir)/jit-reader.in config.status
|
||||||
$(ECHO_GEN) $(SHELL) config.status $(SILENT_FLAG) $@
|
$(ECHO_GEN) $(SHELL) config.status $(SILENT_FLAG) $@
|
||||||
|
|
||||||
gcore: $(srcdir)/gcore.in config.status
|
gstack.in gcore.in: %.in : $(srcdir)/%-1.in config.status
|
||||||
$(ECHO_GEN) $(SHELL) config.status $(SILENT_FLAG) $@
|
$(ECHO_GEN) $(SHELL) config.status $(SILENT_FLAG) $@
|
||||||
|
|
||||||
gstack: gstack.in version.c
|
gstack gcore: % : %.in version.c
|
||||||
$(ECHO_GEN) \
|
$(ECHO_GEN) \
|
||||||
vv=`grep 'version\[\] = ' version.c | grep -o '".*"' | tr -d \"`; \
|
vv=`grep 'version\[\] = ' version.c | grep -o '".*"' | tr -d \"`; \
|
||||||
sed -e "s,@VERSION@,$$vv," $< > $@
|
sed -e "s,@VERSION@,$$vv," $< > $@
|
||||||
@chmod +x $@
|
@chmod +x $@
|
||||||
|
|
||||||
gstack.in: $(srcdir)/gstack-1.in config.status
|
|
||||||
$(ECHO_GEN) $(SHELL) config.status $(SILENT_FLAG) $@
|
|
||||||
|
|
||||||
gdb-gdb.py: $(srcdir)/gdb-gdb.py.in config.status
|
gdb-gdb.py: $(srcdir)/gdb-gdb.py.in config.status
|
||||||
$(ECHO_GEN) $(SHELL) config.status $(SILENT_FLAG) $@
|
$(ECHO_GEN) $(SHELL) config.status $(SILENT_FLAG) $@
|
||||||
|
|
||||||
|
|||||||
3
gdb/NEWS
3
gdb/NEWS
@@ -26,6 +26,9 @@
|
|||||||
|
|
||||||
* Linux checkpoint code has been updated to work with multiple inferiors.
|
* Linux checkpoint code has been updated to work with multiple inferiors.
|
||||||
|
|
||||||
|
* The gcore script now has a -v or --version option, which prints the
|
||||||
|
version number, and then exits.
|
||||||
|
|
||||||
* New commands
|
* New commands
|
||||||
|
|
||||||
maintenance check psymtabs
|
maintenance check psymtabs
|
||||||
|
|||||||
5
gdb/configure
vendored
5
gdb/configure
vendored
@@ -33775,7 +33775,7 @@ fi
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
ac_config_files="$ac_config_files gcore"
|
ac_config_files="$ac_config_files gcore.in:gcore-1.in"
|
||||||
|
|
||||||
ac_config_files="$ac_config_files gstack.in:gstack-1.in"
|
ac_config_files="$ac_config_files gstack.in:gstack-1.in"
|
||||||
|
|
||||||
@@ -34878,7 +34878,7 @@ do
|
|||||||
"default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
|
"default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
|
||||||
"jit-reader.h") CONFIG_FILES="$CONFIG_FILES jit-reader.h:jit-reader.in" ;;
|
"jit-reader.h") CONFIG_FILES="$CONFIG_FILES jit-reader.h:jit-reader.in" ;;
|
||||||
"nm.h") CONFIG_LINKS="$CONFIG_LINKS nm.h:$GDB_NM_FILE" ;;
|
"nm.h") CONFIG_LINKS="$CONFIG_LINKS nm.h:$GDB_NM_FILE" ;;
|
||||||
"gcore") CONFIG_FILES="$CONFIG_FILES gcore" ;;
|
"gcore.in") CONFIG_FILES="$CONFIG_FILES gcore.in:gcore-1.in" ;;
|
||||||
"gstack.in") CONFIG_FILES="$CONFIG_FILES gstack.in:gstack-1.in" ;;
|
"gstack.in") CONFIG_FILES="$CONFIG_FILES gstack.in:gstack-1.in" ;;
|
||||||
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
|
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
|
||||||
"gdb-gdb.gdb") CONFIG_FILES="$CONFIG_FILES gdb-gdb.gdb" ;;
|
"gdb-gdb.gdb") CONFIG_FILES="$CONFIG_FILES gdb-gdb.gdb" ;;
|
||||||
@@ -36425,7 +36425,6 @@ _LT_EOF
|
|||||||
esac
|
esac
|
||||||
done ;;
|
done ;;
|
||||||
"nm.h":L) echo > stamp-nmh ;;
|
"nm.h":L) echo > stamp-nmh ;;
|
||||||
"gcore":F) chmod +x gcore ;;
|
|
||||||
|
|
||||||
esac
|
esac
|
||||||
done # for ac_tag
|
done # for ac_tag
|
||||||
|
|||||||
@@ -2278,7 +2278,7 @@ GDB_AC_SELFTEST([
|
|||||||
|
|
||||||
GDB_AC_TRANSFORM([gdb], [GDB_TRANSFORM_NAME])
|
GDB_AC_TRANSFORM([gdb], [GDB_TRANSFORM_NAME])
|
||||||
GDB_AC_TRANSFORM([gcore], [GCORE_TRANSFORM_NAME])
|
GDB_AC_TRANSFORM([gcore], [GCORE_TRANSFORM_NAME])
|
||||||
AC_CONFIG_FILES([gcore], [chmod +x gcore])
|
AC_CONFIG_FILES([gcore.in:gcore-1.in])
|
||||||
AC_CONFIG_FILES([gstack.in:gstack-1.in])
|
AC_CONFIG_FILES([gstack.in:gstack-1.in])
|
||||||
AC_CONFIG_FILES([Makefile gdb-gdb.gdb gdb-gdb.py doc/Makefile data-directory/Makefile])
|
AC_CONFIG_FILES([Makefile gdb-gdb.gdb gdb-gdb.py doc/Makefile data-directory/Makefile])
|
||||||
|
|
||||||
|
|||||||
@@ -51391,7 +51391,8 @@ Richard M. Stallman and Roland H. Pesch, July 1991.
|
|||||||
|
|
||||||
@format
|
@format
|
||||||
@c man begin SYNOPSIS gcore
|
@c man begin SYNOPSIS gcore
|
||||||
gcore [-a] [-o @var{prefix}] [-d @var{directory}] @var{pid1} [@var{pid2}...@var{pidN}]
|
gcore [-v | --version] [-a] [-o @var{prefix}] [-d @var{directory}]
|
||||||
|
@var{pid1} [@var{pid2}...@var{pidN}]
|
||||||
@c man end
|
@c man end
|
||||||
@end format
|
@end format
|
||||||
|
|
||||||
@@ -51423,6 +51424,10 @@ If not specified, @var{prefix} defaults to @var{gcore}.
|
|||||||
@item -d @var{directory}
|
@item -d @var{directory}
|
||||||
Use @var{directory} as the data directory when invoking @value{GDBN} for running
|
Use @var{directory} as the data directory when invoking @value{GDBN} for running
|
||||||
the gcore command. This argument is optional.
|
the gcore command. This argument is optional.
|
||||||
|
|
||||||
|
@item --version
|
||||||
|
@itemx -v
|
||||||
|
Print version information and then exit.
|
||||||
@end table
|
@end table
|
||||||
@c man end
|
@c man end
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,9 @@
|
|||||||
# It starts up gdb, attaches to the given PID and invokes the gcore command.
|
# It starts up gdb, attaches to the given PID and invokes the gcore command.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
PKGVERSION=@PKGVERSION@
|
||||||
|
VERSION=@VERSION@
|
||||||
|
|
||||||
# Need to check for -o option, but set default basename to "core".
|
# Need to check for -o option, but set default basename to "core".
|
||||||
prefix=core
|
prefix=core
|
||||||
|
|
||||||
@@ -29,8 +32,18 @@ dump_all_cmds=()
|
|||||||
|
|
||||||
data_directory_opt=()
|
data_directory_opt=()
|
||||||
|
|
||||||
while getopts :ao:d: opt; do
|
function print_version() {
|
||||||
case "$opt" in
|
echo "GNU gcore (${PKGVERSION}) ${VERSION}"
|
||||||
|
}
|
||||||
|
|
||||||
|
while getopts :vao:d:-: OPT; do
|
||||||
|
if [ "$OPT" = "-" ]; then
|
||||||
|
OPT="${OPTARG%%=*}"
|
||||||
|
OPTARG="${OPTARG#'$OPT'}"
|
||||||
|
OPTARG="${OPTARG#=}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$OPT" in
|
||||||
a)
|
a)
|
||||||
case "$OSTYPE" in
|
case "$OSTYPE" in
|
||||||
linux*)
|
linux*)
|
||||||
@@ -45,8 +58,12 @@ while getopts :ao:d: opt; do
|
|||||||
d)
|
d)
|
||||||
data_directory_opt=("--data-directory" "$OPTARG")
|
data_directory_opt=("--data-directory" "$OPTARG")
|
||||||
;;
|
;;
|
||||||
|
v | version)
|
||||||
|
print_version
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "usage: @GCORE_TRANSFORM_NAME@ [-a] [-o prefix] [-d data-directory] pid1 [pid2...pidN]"
|
echo "usage: @GCORE_TRANSFORM_NAME@ [-v | --version] [-a] [-o prefix] [-d data-directory] pid1 [pid2...pidN]"
|
||||||
exit 2
|
exit 2
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
Reference in New Issue
Block a user