Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-gstack-20050411.patch
-FileName: gdb-6.3-gstack-20050411.patch
-
;; Add a wrapper script to GDB that implements pstack using the
;; --readnever option.
;;=push
* Makefile.in (uninstall-gstack, install-gstack): New rules, add
to install and uninstall.
* gstack.sh, gstack.1: New files.
----
- gdb/Makefile.in | 34 ++++++++++++++++++--
- gdb/gstack.sh | 43 +++++++++++++++++++++++++
- gdb/testsuite/gdb.base/gstack.c | 43 +++++++++++++++++++++++++
- gdb/testsuite/gdb.base/gstack.exp | 66 +++++++++++++++++++++++++++++++++++++++
- 4 files changed, 184 insertions(+), 2 deletions(-)
- create mode 100644 gdb/gstack.sh
- create mode 100644 gdb/testsuite/gdb.base/gstack.c
- create mode 100644 gdb/testsuite/gdb.base/gstack.exp
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
-index 17b71c6e7c..e77d6a5c03 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
-@@ -1744,7 +1744,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
+@@ -1768,7 +1768,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
install: all
@$(MAKE) $(FLAGS_TO_PASS) install-only
transformed_name=`t='$(program_transform_name)'; \
echo gdb | sed -e "$$t"` ; \
if test "x$$transformed_name" = x; then \
-@@ -1784,7 +1784,25 @@ install-guile:
+@@ -1817,7 +1817,25 @@ install-guile:
install-python:
$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
transformed_name=`t='$(program_transform_name)'; \
echo gdb | sed -e $$t` ; \
if test "x$$transformed_name" = x; then \
-@@ -1807,6 +1825,18 @@ uninstall: force $(CONFIG_UNINSTALL)
+@@ -1840,6 +1858,18 @@ uninstall: force $(CONFIG_UNINSTALL)
fi
@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
$(COMPILE) -DTEST_CPNAMES cp-name-parser.c
diff --git a/gdb/gstack.sh b/gdb/gstack.sh
new file mode 100644
-index 0000000000..f7f07248f7
--- /dev/null
+++ b/gdb/gstack.sh
@@ -0,0 +1,43 @@
+ -e '/^Thread/p'
diff --git a/gdb/testsuite/gdb.base/gstack.c b/gdb/testsuite/gdb.base/gstack.c
new file mode 100644
-index 0000000000..dc10813f04
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gstack.c
@@ -0,0 +1,43 @@
+}
diff --git a/gdb/testsuite/gdb.base/gstack.exp b/gdb/testsuite/gdb.base/gstack.exp
new file mode 100644
-index 0000000000..1186ec57bc
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gstack.exp
-@@ -0,0 +1,66 @@
+@@ -0,0 +1,84 @@
+# Copyright (C) 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+ fail $test
+ return
+}
++
++# The spawn id of the test inferior.
++set test_spawn_id $res
++
+set use_gdb_stub 1
+set pid [exp_pid -i $res]
+gdb_expect {
+ return
+ }
+}
-+gdb_exit
+
+# Testcase uses the most simple notification not to get caught by attach on
+# exiting the function. Still we could retry the gstack command if we fail.
+ perror "Spawning $command failed."
+ fail $test
+}
-+set pid [exp_pid -i $res]
++
++set gdb_spawn_id $res
++
+gdb_test_multiple "" $test {
+ -re "^#0 +(0x\[0-9a-f\]+ in )?\\.?func \\(\\) at \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in \\.?main \\(\\) at \[^\r\n\]*\r\nGSTACK-END\r\n\$" {
+ pass $test
+ }
+}
-+gdb_exit
+
-+remote_exec host "kill -9 $pid"
---
-2.14.3
-
++gdb_test_multiple "" "gstack exits" {
++ eof {
++ set result [wait -i $gdb_spawn_id]
++ verbose $result
++
++ gdb_assert { [lindex $result 2] == 0 } "gstack exits with no error"
++ gdb_assert { [lindex $result 3] == 0 } "gstack's exit status is 0"
++
++ remote_close host
++ clear_gdb_spawn_id
++ }
++}
++
++# Kill the test inferior.
++kill_wait_spawned_process $test_spawn_id