Accepting request 265316 from home:chorler:branches:devel:gcc

Update to GDB 7.8.1

fixes https://bugzilla.opensuse.org/show_bug.cgi?id=909827

OBS-URL: https://build.opensuse.org/request/show/265316
OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=113
This commit is contained in:
Tomáš Chvátal 2014-12-24 16:27:18 +00:00 committed by Git OBS Bridge
parent a3d272cb37
commit 382191c20a
10 changed files with 296 additions and 837 deletions

3
gdb-7.8.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d7a923d876ecfa1cec4c1c79c014c9d8e58783a25855a95cf260275f61990647
size 32926653

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1cb8f2a7a79546381e9cb1dfae254f68a7935f513690d98efbba9c4f692daf41
size 25469193

View File

@ -7,60 +7,33 @@ commit b88230edf4e2da948d633c283ba0893bf22bd7ae
tromey/python
Index: gdb-7.8/README.archer
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.8/README.archer 2014-07-29 19:29:04.861982779 +0200
@@ -0,0 +1,2 @@
+This branch originally held the Python code for gdb. It still exists
+because a small amount of code here has not yet been merged upstream.
Index: gdb-7.8/gdb/Makefile.in
===================================================================
--- gdb-7.8.orig/gdb/Makefile.in 2014-07-29 19:29:02.665979655 +0200
+++ gdb-7.8/gdb/Makefile.in 2014-07-29 19:29:04.862982781 +0200
@@ -1476,6 +1476,12 @@ stamp-h: $(srcdir)/config.in config.stat
CONFIG_LINKS= \
$(SHELL) config.status
+.gdbinit: $(srcdir)/gdbinit.in config.status
+ CONFIG_FILES=".gdbinit:gdbinit.in" \
+ CONFIG_COMMANDS= \
+ CONFIG_HEADERS= \
+ $(SHELL) config.status
+
config.status: $(srcdir)/configure configure.tgt configure.host ../bfd/development.sh
$(SHELL) config.status --recheck
Index: gdb-7.8/gdb/data-directory/Makefile.in
===================================================================
--- gdb-7.8.orig/gdb/data-directory/Makefile.in 2014-07-29 19:29:02.665979655 +0200
+++ gdb-7.8/gdb/data-directory/Makefile.in 2014-07-29 19:29:33.053022486 +0200
@@ -66,6 +66,8 @@ PYTHON_FILE_LIST = \
Amended for GDB 7.8.1 - Chris Horler
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/data-directory/Makefile.in gdb-7.8.1/gdb/data-directory/Makefile.in
--- gdb-7.8.1.orig/gdb/data-directory/Makefile.in 2014-10-29 19:45:50.000000000 +0000
+++ gdb-7.8.1/gdb/data-directory/Makefile.in 2014-12-14 20:15:43.028846584 +0000
@@ -65,6 +65,8 @@
gdb/prompt.py \
gdb/xmethod.py \
gdb/command/bound_registers.py \
gdb/command/__init__.py \
+ gdb/command/ignore_errors.py \
+ gdb/command/pahole.py \
gdb/command/xmethods.py \
gdb/command/frame_filters.py \
gdb/command/type_printers.py \
@@ -73,7 +75,10 @@ PYTHON_FILE_LIST = \
gdb/command/prompt.py \
@@ -73,6 +75,8 @@
gdb/command/explore.py \
gdb/function/__init__.py \
- gdb/function/strfns.py
+ gdb/function/strfns.py \
gdb/function/strfns.py \
+ gdb/function/caller_is.py \
+ gdb/function/in_scope.py \
+ gdb/types.py
gdb/printer/__init__.py \
gdb/printer/bound_registers.py
@HAVE_PYTHON_TRUE@PYTHON_FILES = $(PYTHON_FILE_LIST)
@HAVE_PYTHON_FALSE@PYTHON_FILES =
Index: gdb-7.8/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.8.orig/gdb/doc/gdb.texinfo 2014-07-29 19:29:02.675979669 +0200
+++ gdb-7.8/gdb/doc/gdb.texinfo 2014-07-29 19:29:04.871982794 +0200
@@ -1225,6 +1225,16 @@ for remote debugging.
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/doc/gdb.texinfo gdb-7.8.1/gdb/doc/gdb.texinfo
--- gdb-7.8.1.orig/gdb/doc/gdb.texinfo 2014-10-29 19:45:50.000000000 +0000
+++ gdb-7.8.1/gdb/doc/gdb.texinfo 2014-12-14 20:13:31.604314553 +0000
@@ -1225,6 +1225,16 @@
Run using @var{device} for your program's standard input and output.
@c FIXME: kingdon thinks there is more to -tty. Investigate.
@ -77,11 +50,10 @@ Index: gdb-7.8/gdb/doc/gdb.texinfo
@c resolve the situation of these eventually
@item -tui
@cindex @code{--tui}
Index: gdb-7.8/gdb/doc/python.texi
===================================================================
--- gdb-7.8.orig/gdb/doc/python.texi 2014-07-29 19:29:02.677979672 +0200
+++ gdb-7.8/gdb/doc/python.texi 2014-07-29 19:29:04.872982795 +0200
@@ -88,8 +88,6 @@ containing @code{end}. For example:
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/doc/python.texi gdb-7.8.1/gdb/doc/python.texi
--- gdb-7.8.1.orig/gdb/doc/python.texi 2014-10-29 19:45:50.000000000 +0000
+++ gdb-7.8.1/gdb/doc/python.texi 2014-12-14 20:13:31.609314573 +0000
@@ -88,8 +88,6 @@
@smallexample
(@value{GDBP}) python
@ -90,10 +62,9 @@ Index: gdb-7.8/gdb/doc/python.texi
>print 23
>end
23
Index: gdb-7.8/gdb/gdb-gdb.gdb.in
===================================================================
--- gdb-7.8.orig/gdb/gdb-gdb.gdb.in 2014-07-29 19:29:02.677979672 +0200
+++ gdb-7.8/gdb/gdb-gdb.gdb.in 2014-07-29 19:29:04.872982795 +0200
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/gdb-gdb.gdb.in gdb-7.8.1/gdb/gdb-gdb.gdb.in
--- gdb-7.8.1.orig/gdb/gdb-gdb.gdb.in 2014-06-11 17:34:41.000000000 +0100
+++ gdb-7.8.1/gdb/gdb-gdb.gdb.in 2014-12-14 20:13:31.610314577 +0000
@@ -1,5 +1,15 @@
echo Setting up the environment for debugging gdb.\n
@ -110,10 +81,9 @@ Index: gdb-7.8/gdb/gdb-gdb.gdb.in
if !$gdb_init_done
set variable $gdb_init_done = 1
Index: gdb-7.8/gdb/main.c
===================================================================
--- gdb-7.8.orig/gdb/main.c 2014-07-29 19:29:02.678979673 +0200
+++ gdb-7.8/gdb/main.c 2014-07-29 19:29:04.872982795 +0200
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/main.c gdb-7.8.1/gdb/main.c
--- gdb-7.8.1.orig/gdb/main.c 2014-10-29 19:45:50.000000000 +0000
+++ gdb-7.8.1/gdb/main.c 2014-12-14 20:13:31.612314585 +0000
@@ -37,6 +37,7 @@
#include "interps.h"
@ -122,7 +92,7 @@ Index: gdb-7.8/gdb/main.c
#include "source.h"
#include "cli/cli-cmds.h"
#include "objfiles.h"
@@ -417,6 +418,8 @@ captured_main (void *data)
@@ -426,6 +427,8 @@
char *cdarg = NULL;
char *ttyarg = NULL;
@ -131,7 +101,7 @@ Index: gdb-7.8/gdb/main.c
/* These are static so that we can take their address in an
initializer. */
static int print_help;
@@ -624,10 +627,14 @@ captured_main (void *data)
@@ -633,10 +636,14 @@
{"args", no_argument, &set_args, 1},
{"l", required_argument, 0, 'l'},
{"return-child-result", no_argument, &return_child_result, 1},
@ -147,7 +117,7 @@ Index: gdb-7.8/gdb/main.c
{
int option_index;
@@ -645,6 +652,9 @@ captured_main (void *data)
@@ -654,6 +661,9 @@
case 0:
/* Long option that just sets a flag. */
break;
@ -157,7 +127,7 @@ Index: gdb-7.8/gdb/main.c
case OPT_SE:
symarg = optarg;
execarg = optarg;
@@ -849,7 +859,31 @@ captured_main (void *data)
@@ -858,7 +868,31 @@
/* Now that gdb_init has created the initial inferior, we're in
position to set args for that inferior. */
@ -190,7 +160,7 @@ Index: gdb-7.8/gdb/main.c
{
/* The remaining options are the command-line options for the
inferior. The first one is the sym/exec file, and the rest
@@ -1135,7 +1169,8 @@ captured_main (void *data)
@@ -1144,7 +1178,8 @@
/* Read in the old history after all the command files have been
read. */
@ -200,7 +170,7 @@ Index: gdb-7.8/gdb/main.c
if (batch_flag)
{
@@ -1146,13 +1181,25 @@ captured_main (void *data)
@@ -1155,13 +1190,25 @@
/* Show time and/or space usage. */
do_cleanups (pre_stat_chain);
@ -232,7 +202,7 @@ Index: gdb-7.8/gdb/main.c
}
/* No exit -- exit is through quit_command. */
}
@@ -1186,6 +1233,12 @@ print_gdb_help (struct ui_file *stream)
@@ -1195,6 +1242,12 @@
fputs_unfiltered (_("\
This is the GNU debugger. Usage:\n\n\
gdb [options] [executable-file [core-file or process-id]]\n\
@ -245,7 +215,7 @@ Index: gdb-7.8/gdb/main.c
gdb [options] --args executable-file [inferior-arguments ...]\n\n\
"), stream);
fputs_unfiltered (_("\
@@ -1231,6 +1284,13 @@ Output and user interface control:\n\n\
@@ -1240,6 +1293,13 @@
fputs_unfiltered (_("\
--dbx DBX compatibility mode.\n\
--xdb XDB compatibility mode.\n\
@ -259,10 +229,25 @@ Index: gdb-7.8/gdb/main.c
-q, --quiet, --silent\n\
Do not print version number on startup.\n\n\
"), stream);
Index: gdb-7.8/gdb/python/lib/gdb/command/ignore_errors.py
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.8/gdb/python/lib/gdb/command/ignore_errors.py 2014-07-29 19:29:04.872982795 +0200
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/Makefile.in gdb-7.8.1/gdb/Makefile.in
--- gdb-7.8.1.orig/gdb/Makefile.in 2014-10-29 19:45:50.000000000 +0000
+++ gdb-7.8.1/gdb/Makefile.in 2014-12-14 20:13:31.583314468 +0000
@@ -1476,6 +1476,12 @@
CONFIG_LINKS= \
$(SHELL) config.status
+.gdbinit: $(srcdir)/gdbinit.in config.status
+ CONFIG_FILES=".gdbinit:gdbinit.in" \
+ CONFIG_COMMANDS= \
+ CONFIG_HEADERS= \
+ $(SHELL) config.status
+
config.status: $(srcdir)/configure configure.tgt configure.host ../bfd/development.sh
$(SHELL) config.status --recheck
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/python/lib/gdb/command/ignore_errors.py gdb-7.8.1/gdb/python/lib/gdb/command/ignore_errors.py
--- gdb-7.8.1.orig/gdb/python/lib/gdb/command/ignore_errors.py 1970-01-01 01:00:00.000000000 +0100
+++ gdb-7.8.1/gdb/python/lib/gdb/command/ignore_errors.py 2014-12-14 20:13:31.613314589 +0000
@@ -0,0 +1,37 @@
+# Ignore errors in user commands.
+
@ -301,10 +286,9 @@ Index: gdb-7.8/gdb/python/lib/gdb/command/ignore_errors.py
+ pass
+
+IgnoreErrorsCommand ()
Index: gdb-7.8/gdb/python/lib/gdb/command/pahole.py
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.8/gdb/python/lib/gdb/command/pahole.py 2014-07-29 19:29:04.873982797 +0200
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/python/lib/gdb/command/pahole.py gdb-7.8.1/gdb/python/lib/gdb/command/pahole.py
--- gdb-7.8.1.orig/gdb/python/lib/gdb/command/pahole.py 1970-01-01 01:00:00.000000000 +0100
+++ gdb-7.8.1/gdb/python/lib/gdb/command/pahole.py 2014-12-14 20:13:31.613314589 +0000
@@ -0,0 +1,81 @@
+# pahole command for gdb
+
@ -387,10 +371,9 @@ Index: gdb-7.8/gdb/python/lib/gdb/command/pahole.py
+ self.pahole (type, 0, '')
+
+Pahole()
Index: gdb-7.8/gdb/python/lib/gdb/function/caller_is.py
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.8/gdb/python/lib/gdb/function/caller_is.py 2014-07-29 19:29:04.873982797 +0200
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/python/lib/gdb/function/caller_is.py gdb-7.8.1/gdb/python/lib/gdb/function/caller_is.py
--- gdb-7.8.1.orig/gdb/python/lib/gdb/function/caller_is.py 1970-01-01 01:00:00.000000000 +0100
+++ gdb-7.8.1/gdb/python/lib/gdb/function/caller_is.py 2014-12-14 20:13:31.614314594 +0000
@@ -0,0 +1,58 @@
+# Caller-is functions.
+
@ -450,10 +433,9 @@ Index: gdb-7.8/gdb/python/lib/gdb/function/caller_is.py
+
+CallerIs()
+CallerMatches()
Index: gdb-7.8/gdb/python/lib/gdb/function/in_scope.py
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.8/gdb/python/lib/gdb/function/in_scope.py 2014-07-29 19:29:04.873982797 +0200
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/python/lib/gdb/function/in_scope.py gdb-7.8.1/gdb/python/lib/gdb/function/in_scope.py
--- gdb-7.8.1.orig/gdb/python/lib/gdb/function/in_scope.py 1970-01-01 01:00:00.000000000 +0100
+++ gdb-7.8.1/gdb/python/lib/gdb/function/in_scope.py 2014-12-14 20:13:31.614314594 +0000
@@ -0,0 +1,47 @@
+# In-scope function.
+
@ -502,11 +484,10 @@ Index: gdb-7.8/gdb/python/lib/gdb/function/in_scope.py
+ return wanted == found
+
+InScope ()
Index: gdb-7.8/gdb/python/python.c
===================================================================
--- gdb-7.8.orig/gdb/python/python.c 2014-07-29 19:29:02.679979674 +0200
+++ gdb-7.8/gdb/python/python.c 2014-07-29 19:29:04.873982797 +0200
@@ -95,6 +95,8 @@ const struct extension_language_defn ext
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/python/python.c gdb-7.8.1/gdb/python/python.c
--- gdb-7.8.1.orig/gdb/python/python.c 2014-10-29 19:45:50.000000000 +0000
+++ gdb-7.8.1/gdb/python/python.c 2014-12-14 20:13:31.615314598 +0000
@@ -95,6 +95,8 @@
#include "linespec.h"
#include "source.h"
#include "version.h"
@ -515,7 +496,7 @@ Index: gdb-7.8/gdb/python/python.c
#include "target.h"
#include "gdbthread.h"
#include "interps.h"
@@ -1222,6 +1224,56 @@ gdbpy_print_stack (void)
@@ -1222,6 +1224,56 @@
/* Return the current Progspace.
There always is one. */
@ -572,7 +553,7 @@ Index: gdb-7.8/gdb/python/python.c
static PyObject *
gdbpy_get_current_progspace (PyObject *unused1, PyObject *unused2)
@@ -1910,6 +1962,8 @@ static PyMethodDef GdbMethods[] =
@@ -1910,6 +1962,8 @@
Evaluate command, a string, as a gdb CLI command. Optionally returns\n\
a Python String containing the output of the command if to_string is\n\
set to True." },
@ -581,10 +562,9 @@ Index: gdb-7.8/gdb/python/python.c
{ "parameter", gdbpy_parameter, METH_VARARGS,
"Return a gdb parameter's value" },
Index: gdb-7.8/gdb/python/python.h
===================================================================
--- gdb-7.8.orig/gdb/python/python.h 2014-07-29 19:29:02.679979674 +0200
+++ gdb-7.8/gdb/python/python.h 2014-07-29 19:29:04.873982797 +0200
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/python/python.h gdb-7.8.1/gdb/python/python.h
--- gdb-7.8.1.orig/gdb/python/python.h 2014-06-11 17:34:41.000000000 +0100
+++ gdb-7.8.1/gdb/python/python.h 2014-12-14 20:13:31.616314602 +0000
@@ -25,4 +25,6 @@
/* This is all that python exports to gdb. */
extern const struct extension_language_defn extension_language_python;
@ -592,11 +572,10 @@ Index: gdb-7.8/gdb/python/python.h
+extern void run_python_script (int argc, char **argv);
+
#endif /* GDB_PYTHON_H */
Index: gdb-7.8/gdb/testsuite/gdb.gdb/selftest.exp
===================================================================
--- gdb-7.8.orig/gdb/testsuite/gdb.gdb/selftest.exp 2014-07-29 19:29:02.679979674 +0200
+++ gdb-7.8/gdb/testsuite/gdb.gdb/selftest.exp 2014-07-29 19:29:04.874982798 +0200
@@ -92,6 +92,10 @@ proc do_steps_and_nexts {} {
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/testsuite/gdb.gdb/selftest.exp gdb-7.8.1/gdb/testsuite/gdb.gdb/selftest.exp
--- gdb-7.8.1.orig/gdb/testsuite/gdb.gdb/selftest.exp 2014-12-14 20:10:20.896545646 +0000
+++ gdb-7.8.1/gdb/testsuite/gdb.gdb/selftest.exp 2014-12-14 20:13:31.616314602 +0000
@@ -92,6 +92,10 @@
set description "step over cmdarg_vec initialization"
set command "step"
}
@ -607,21 +586,19 @@ Index: gdb-7.8/gdb/testsuite/gdb.gdb/selftest.exp
-re ".*pre_stat_chain = make_command_stats_cleanup.*$gdb_prompt $" {
set description "next over make_command_stats_cleanup and everything it calls"
set command "next"
Index: gdb-7.8/gdb/testsuite/gdb.python/py-frame.exp
===================================================================
--- gdb-7.8.orig/gdb/testsuite/gdb.python/py-frame.exp 2014-07-29 19:29:02.680979676 +0200
+++ gdb-7.8/gdb/testsuite/gdb.python/py-frame.exp 2014-07-29 19:29:04.874982798 +0200
@@ -94,3 +94,5 @@ gdb_test "python print ('result = %s' %
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/testsuite/gdb.python/py-frame.exp gdb-7.8.1/gdb/testsuite/gdb.python/py-frame.exp
--- gdb-7.8.1.orig/gdb/testsuite/gdb.python/py-frame.exp 2014-10-29 19:45:50.000000000 +0000
+++ gdb-7.8.1/gdb/testsuite/gdb.python/py-frame.exp 2014-12-14 20:13:31.617314606 +0000
@@ -94,3 +94,5 @@
gdb_test "python print ('result = %s' % f0.read_var ('a'))" " = 1" "test Frame.read_var - success"
gdb_test "python print ('result = %s' % (gdb.selected_frame () == f1))" " = True" "test gdb.selected_frame"
+
+gdb_test "python print ('result = %s' % (f0.block ()))" "<gdb.Block object at 0x\[\[:xdigit:\]\]+>" "test Frame.block"
Index: gdb-7.8/gdb/testsuite/gdb.python/py-value.exp
===================================================================
--- gdb-7.8.orig/gdb/testsuite/gdb.python/py-value.exp 2014-07-29 19:29:02.680979676 +0200
+++ gdb-7.8/gdb/testsuite/gdb.python/py-value.exp 2014-07-29 19:29:04.874982798 +0200
@@ -385,6 +385,15 @@ proc test_value_after_death {} {
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/testsuite/gdb.python/py-value.exp gdb-7.8.1/gdb/testsuite/gdb.python/py-value.exp
--- gdb-7.8.1.orig/gdb/testsuite/gdb.python/py-value.exp 2014-10-29 19:45:50.000000000 +0000
+++ gdb-7.8.1/gdb/testsuite/gdb.python/py-value.exp 2014-12-14 20:13:31.618314610 +0000
@@ -385,6 +385,15 @@
"print value's type"
}
@ -637,7 +614,7 @@ Index: gdb-7.8/gdb/testsuite/gdb.python/py-value.exp
# Regression test for invalid subscript operations. The bug was that
# the type of the value was not being checked before allowing a
# subscript operation to proceed.
@@ -514,6 +523,7 @@ test_value_in_inferior
@@ -514,6 +523,7 @@
test_inferior_function_call
test_lazy_strings
test_value_after_death
@ -645,3 +622,9 @@ Index: gdb-7.8/gdb/testsuite/gdb.python/py-value.exp
# Test either C or C++ values.
diff -Nur -x '*.orig' gdb-7.8.1.orig/README.archer gdb-7.8.1/README.archer
--- gdb-7.8.1.orig/README.archer 1970-01-01 01:00:00.000000000 +0100
+++ gdb-7.8.1/README.archer 2014-12-14 20:13:31.581314460 +0000
@@ -0,0 +1,2 @@
+This branch originally held the Python code for gdb. It still exists
+because a small amount of code here has not yet been merged upstream.

View File

@ -80,47 +80,13 @@ gdb/testsuite/ChangeLog:
gdb/top.h | 8 +++
4 files changed, 114 insertions(+), 47 deletions(-)
Index: gdb-7.8/gdb/main.c
===================================================================
--- gdb-7.8.orig/gdb/main.c 2014-09-07 19:12:45.066981588 +0200
+++ gdb-7.8/gdb/main.c 2014-09-07 19:14:22.613095201 +0200
@@ -47,6 +47,7 @@
#include "filenames.h"
#include "filestuff.h"
#include "event-top.h"
+#include "infrun.h"
/* The selected interpreter. This will be used as a set command
variable, so it should always be malloc'ed - since
@@ -350,7 +351,11 @@ catch_command_errors (catch_command_erro
TRY_CATCH (e, mask)
{
+ int was_sync = sync_execution;
+
command (arg, from_tty);
+
+ maybe_wait_sync_command_done (was_sync);
}
return handle_command_errors (e);
}
@@ -369,7 +374,11 @@ catch_command_errors_const (catch_comman
TRY_CATCH (e, mask)
{
+ int was_sync = sync_execution;
+
command (arg, from_tty);
+
+ maybe_wait_sync_command_done (was_sync);
}
return handle_command_errors (e);
}
Index: gdb-7.8/gdb/testsuite/gdb.base/attach.exp
===================================================================
--- gdb-7.8.orig/gdb/testsuite/gdb.base/attach.exp 2014-09-07 19:12:45.067981589 +0200
+++ gdb-7.8/gdb/testsuite/gdb.base/attach.exp 2014-09-07 19:12:48.601985706 +0200
@@ -58,6 +58,37 @@ if [get_compiler_info] {
Amended for GDB 7.8.1 - Chris Horler
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/testsuite/gdb.base/attach.exp gdb-7.8.1/gdb/testsuite/gdb.base/attach.exp
--- gdb-7.8.1.orig/gdb/testsuite/gdb.base/attach.exp 2014-10-29 19:45:50.000000000 +0000
+++ gdb-7.8.1/gdb/testsuite/gdb.base/attach.exp 2014-12-14 20:58:52.761567480 +0000
@@ -58,6 +58,37 @@
return -1
}
@ -158,193 +124,4 @@ Index: gdb-7.8/gdb/testsuite/gdb.base/attach.exp
proc do_attach_tests {} {
global gdb_prompt
global binfile
@@ -70,13 +101,7 @@ proc do_attach_tests {} {
# Start the program running and then wait for a bit, to be sure
# that it can be attached to.
- set testpid [eval exec $binfile &]
- exec sleep 2
- if { [istarget "*-*-cygwin*"] } {
- # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
- # different due to the way fork/exec works.
- set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
- }
+ set testpid [spawn_test_prog $binfile]
# Verify that we cannot attach to nonsense.
@@ -279,16 +304,7 @@ proc do_attach_tests {} {
remote_exec build "kill -9 ${testpid}"
- # Start the program running and then wait for a bit, to be sure
- # that it can be attached to.
-
- set testpid [eval exec $binfile &]
- exec sleep 2
- if { [istarget "*-*-cygwin*"] } {
- # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
- # different due to the way fork/exec works.
- set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
- }
+ set testpid [spawn_test_prog $binfile]
# Verify that we can attach to the process, and find its a.out
# when we're cd'd to some directory that doesn't contain the
@@ -335,16 +351,7 @@ proc do_call_attach_tests {} {
global gdb_prompt
global binfile2
- # Start the program running and then wait for a bit, to be sure
- # that it can be attached to.
-
- set testpid [eval exec $binfile2 &]
- exec sleep 2
- if { [istarget "*-*-cygwin*"] } {
- # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
- # different due to the way fork/exec works.
- set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
- }
+ set testpid [spawn_test_prog $binfile2]
# Attach
@@ -397,16 +404,7 @@ proc do_command_attach_tests {} {
return 0
}
- # Start the program running and then wait for a bit, to be sure
- # that it can be attached to.
-
- set testpid [eval exec $binfile &]
- exec sleep 2
- if { [istarget "*-*-cygwin*"] } {
- # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
- # different due to the way fork/exec works.
- set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
- }
+ set testpid [spawn_test_prog $binfile]
gdb_exit
if $verbose>1 then {
@@ -429,6 +427,50 @@ proc do_command_attach_tests {} {
remote_exec build "kill -9 ${testpid}"
}
+# Test ' gdb --pid PID -ex "run" '. GDB used to have a bug where
+# "run" would run before the attach finished - PR17347.
+
+proc test_command_line_attach_run {} {
+ global gdb_prompt
+ global binfile
+ global verbose
+ global GDB
+ global INTERNAL_GDBFLAGS
+
+ if ![isnative] then {
+ unsupported "commandline attach run test"
+ return 0
+ }
+
+ with_test_prefix "cmdline attach run" {
+ set testpid [spawn_test_prog $binfile]
+
+ set test "run to prompt"
+ gdb_exit
+ set res [gdb_spawn_with_cmdline_opts "--pid=$testpid -ex \"start\""]
+ if { $res != 0} {
+ fail $test
+ return $res
+ }
+ gdb_test_multiple "" $test {
+ -re {Attaching to.*Start it from the beginning\? \(y or n\) } {
+ pass $test
+ }
+ }
+
+ send_gdb "y\n"
+
+ set test "run to main"
+ gdb_test_multiple "" $test {
+ -re "Temporary breakpoint .* main .*$gdb_prompt $" {
+ pass $test
+ }
+ }
+
+ # Get rid of the process
+ remote_exec build "kill -9 ${testpid}"
+ }
+}
# Start with a fresh gdb
@@ -453,4 +495,6 @@ do_call_attach_tests
do_command_attach_tests
+test_command_line_attach_run
+
return 0
Index: gdb-7.8/gdb/top.c
===================================================================
--- gdb-7.8.orig/gdb/top.c 2014-09-07 19:12:45.067981589 +0200
+++ gdb-7.8/gdb/top.c 2014-09-07 19:12:48.601985706 +0200
@@ -375,6 +375,21 @@ check_frame_language_change (void)
}
}
+void
+maybe_wait_sync_command_done (int was_sync)
+{
+ /* If the interpreter is in sync mode (we're running a user
+ command's list, running command hooks or similars), and we
+ just ran a synchronous command that started the target, wait
+ for that command to end. */
+ if (!interpreter_async && !was_sync && sync_execution)
+ {
+ while (gdb_do_one_event () >= 0)
+ if (!sync_execution)
+ break;
+ }
+}
+
/* Execute the line P as a command, in the current user context.
Pass FROM_TTY as second argument to the defining function. */
@@ -461,16 +476,7 @@ execute_command (char *p, int from_tty)
else
cmd_func (c, arg, from_tty);
- /* If the interpreter is in sync mode (we're running a user
- command's list, running command hooks or similars), and we
- just ran a synchronous command that started the target, wait
- for that command to end. */
- if (!interpreter_async && !was_sync && sync_execution)
- {
- while (gdb_do_one_event () >= 0)
- if (!sync_execution)
- break;
- }
+ maybe_wait_sync_command_done (was_sync);
/* If this command has been post-hooked, run the hook last. */
execute_cmd_post_hook (c);
Index: gdb-7.8/gdb/top.h
===================================================================
--- gdb-7.8.orig/gdb/top.h 2014-09-07 19:12:45.068981590 +0200
+++ gdb-7.8/gdb/top.h 2014-09-07 19:12:48.601985706 +0200
@@ -42,6 +42,14 @@ extern void quit_command (char *, int);
extern void quit_cover (void);
extern void execute_command (char *, int);
+/* If the interpreter is in sync mode (we're running a user command's
+ list, running command hooks or similars), and we just ran a
+ synchronous command that started the target, wait for that command
+ to end. WAS_SYNC indicates whether sync_execution was set before
+ the command was run. */
+
+extern void maybe_wait_sync_command_done (int was_sync);
+
extern void check_frame_language_change (void);
/* Prepare for execution of a command.

View File

@ -1,216 +0,0 @@
http://sourceware.org/ml/gdb-patches/2014-09/msg00174.html
Subject: Re: Regression: GDB stopped on run with attached process (PR 17347) [Re: [pushed+7.8] Re: [PATCH] Fix "attach" command vs user input race
--a8Wt8u1KmwUX3Y2C
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Wed, 03 Sep 2014 22:11:03 +0200, Pedro Alves wrote:
> On 09/03/2014 08:58 AM, Jan Kratochvil wrote:
>
> > https://sourceware.org/bugzilla/show_bug.cgi?id=17347
>
> Thanks Jan.
>
> Here's a fix, test included. Comments?
In the testsuite run from the Fedora rpm packaging I get:
GNU gdb (GDB) Fedora 7.8-21.fc21^M
Copyright (C) 2014 Free Software Foundation, Inc.^M
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>^M
This is free software: you are free to change and redistribute it.^M
There is NO WARRANTY, to the extent permitted by law. Type "show copying"^M
and "show warranty" for details.^M
This GDB was configured as "i686-redhat-linux-gnu".^M
Type "show configuration" for configuration details.^M
For bug reporting instructions, please see:^M
<http://www.gnu.org/software/gdb/bugs/>.^M
Find the GDB manual and other documentation resources online at:^M
<http://www.gnu.org/software/gdb/documentation/>.^M
For help, type "help".^M
Type "apropos word" to search for commands related to "word".^M
Attaching to process 27028^M
Reading symbols from /unsafebuild-i686-redhat-linux-gnu/gdb/testsuite.unix.-m32/outputs/gdb.base/attach/attach...done.^M
Reading symbols from /lib/libm.so.6...Reading symbols from /usr/lib/debug/usr/lib/libm-2.19.90.so.debug...done.^M
done.^M
Loaded symbols for /lib/libm.so.6^M
Reading symbols from /lib/libc.so.6...Reading symbols from /usr/lib/debug/usr/lib/libc-2.19.90.so.debug...done.^M
done.^M
Loaded symbols for /lib/libc.so.6^M
Reading symbols from /lib/ld-linux.so.2...Reading symbols from /usr/lib/debug/usr/lib/ld-2.19.90.so.debug...done.^M
done.^M
Loaded symbols for /lib/ld-linux.so.2^M
main ()^M
at gdb/testsuite/gdb.base/attach.c:15^M
15 while (! should_exit)^M
The program being debugged has been started already.^M
Start it from the beginning? (y or n) PASS: gdb.base/attach.exp: cmdline attach run: run to prompt
y^M
^M
Temporary breakpoint 1 at 0x8048481: file gdb/testsuite/gdb.base/attach.c, line 13.^M
Starting program: /unsafe/home/jkratoch/hammock/20140907fedorarel21-f21/fedora-2---Type <return> to continue, or q <return> to quit---ERROR: Window too small.
UNRESOLVED: gdb.base/attach.exp: cmdline attach run: run to main
While I do not fully understand why that happens in every run of that Fedora
testsuite while it never happens during my reproducibility attempts by hand
I find it understandable and the Fedora testsuite issues does get fixed by the
attached patch.
> --- a/gdb/testsuite/gdb.base/attach.exp
> +++ b/gdb/testsuite/gdb.base/attach.exp
> @@ -58,6 +58,37 @@ if [get_compiler_info] {
> return -1
> }
>
> +# Start the program running and then wait for a bit, to be sure that
> +# it can be attached to. Return the process's PID.
> +
> +proc spawn_test_prog { executable } {
> + set testpid [eval exec $executable &]
> + exec sleep 2
Unrelated to this patch - this patch only moved the code. Also the code move
could be a separate patch:
I do not see why the testsuite commonly uses "exec sleep" while it also uses
"sleep" itself which also works fine.
> + if { [istarget "*-*-cygwin*"] } {
> + # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
> + # different due to the way fork/exec works.
> + set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
> + }
> +
> + return $testpid
> +}
[...]
> @@ -429,6 +427,50 @@ proc do_command_attach_tests {} {
> remote_exec build "kill -9 ${testpid}"
> }
>
> +# Test ' gdb --pid PID -ex "run" '. GDB used to have a bug where
> +# "run" would run before the attach finished - PR17347.
> +
> +proc test_command_line_attach_run {} {
> + global gdb_prompt
> + global binfile
> + global verbose
> + global GDB
> + global INTERNAL_GDBFLAGS
These 3 lines are unused.
> +
> + if ![isnative] then {
> + unsupported "commandline attach run test"
> + return 0
> + }
> +
> + with_test_prefix "cmdline attach run" {
> + set testpid [spawn_test_prog $binfile]
> +
> + set test "run to prompt"
> + gdb_exit
> + set res [gdb_spawn_with_cmdline_opts "--pid=$testpid -ex \"start\""]
Here see the attachment.
> + if { $res != 0} {
> + fail $test
> + return $res
> + }
> + gdb_test_multiple "" $test {
> + -re {Attaching to.*Start it from the beginning\? \(y or n\) } {
> + pass $test
> + }
> + }
> +
> + send_gdb "y\n"
> +
> + set test "run to main"
> + gdb_test_multiple "" $test {
> + -re "Temporary breakpoint .* main .*$gdb_prompt $" {
> + pass $test
> + }
> + }
> +
> + # Get rid of the process
> + remote_exec build "kill -9 ${testpid}"
> + }
> +}
>
> # Start with a fresh gdb
>
> @@ -453,4 +495,6 @@ do_call_attach_tests
>
> do_command_attach_tests
>
> +test_command_line_attach_run
> +
> return 0
> diff --git a/gdb/top.c b/gdb/top.c
> index fc2b84d..ba71f8f 100644
> --- a/gdb/top.c
> +++ b/gdb/top.c
> @@ -373,6 +373,21 @@ check_frame_language_change (void)
> }
> }
>
Missing:
/* See top.h. */
Unless that rule from me has been abandoned.
> +void
> +maybe_wait_sync_command_done (int was_sync)
> +{
> + /* If the interpreter is in sync mode (we're running a user
> + command's list, running command hooks or similars), and we
> + just ran a synchronous command that started the target, wait
> + for that command to end. */
> + if (!interpreter_async && !was_sync && sync_execution)
> + {
> + while (gdb_do_one_event () >= 0)
> + if (!sync_execution)
> + break;
> + }
> +}
> +
> /* Execute the line P as a command, in the current user context.
> Pass FROM_TTY as second argument to the defining function. */
>
Thanks,
Jan
--a8Wt8u1KmwUX3Y2C
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline; filename=1
diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp
index c94c127..6e566a3 100644
--- a/gdb/testsuite/gdb.base/attach.exp
+++ b/gdb/testsuite/gdb.base/attach.exp
@@ -447,7 +444,8 @@ proc test_command_line_attach_run {} {
set test "run to prompt"
gdb_exit
- set res [gdb_spawn_with_cmdline_opts "--pid=$testpid -ex \"start\""]
+ set res [gdb_spawn_with_cmdline_opts \
+ "-iex set\\ height\\ 0 -iex set\\ width\\ 0 --pid=$testpid -ex \"start\""]
if { $res != 0} {
fail $test
return $res
--a8Wt8u1KmwUX3Y2C--

View File

@ -33,10 +33,12 @@ gdb/testsuite/
gdb_breakpoint, gdb_continue_to_breakpoint.
(test_command_line_attach_run): Kill ${testpid} in one exit path.
diff --git a/gdb/testsuite/gdb.base/attach.c b/gdb/testsuite/gdb.base/attach.c
index 0041b47..91b180c 100644
--- a/gdb/testsuite/gdb.base/attach.c
+++ b/gdb/testsuite/gdb.base/attach.c
Amended for GDB 7.8.1 - Chris Horler
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/testsuite/gdb.base/attach.c gdb-7.8.1/gdb/testsuite/gdb.base/attach.c
--- gdb-7.8.1.orig/gdb/testsuite/gdb.base/attach.c 2014-10-29 19:45:50.000000000 +0000
+++ gdb-7.8.1/gdb/testsuite/gdb.base/attach.c 2014-12-14 21:19:46.689476557 +0000
@@ -5,6 +5,7 @@
exit unless/until gdb sets the variable to non-zero.)
*/
@ -45,7 +47,7 @@ index 0041b47..91b180c 100644
int should_exit = 0;
@@ -12,9 +13,11 @@ int main ()
@@ -12,9 +13,11 @@
{
int local_i = 0;
@ -58,11 +60,10 @@ index 0041b47..91b180c 100644
- return 0;
+ return 0; /* postloop */
}
diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp
index 6340496..5fb5c53 100644
--- a/gdb/testsuite/gdb.base/attach.exp
+++ b/gdb/testsuite/gdb.base/attach.exp
@@ -256,11 +256,8 @@ proc do_attach_tests {} {
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/testsuite/gdb.base/attach.exp gdb-7.8.1/gdb/testsuite/gdb.base/attach.exp
--- gdb-7.8.1.orig/gdb/testsuite/gdb.base/attach.exp 2014-12-14 21:20:42.810658051 +0000
+++ gdb-7.8.1/gdb/testsuite/gdb.base/attach.exp 2014-12-14 21:22:53.479082555 +0000
@@ -287,11 +287,8 @@
# Verify that the modification really happened.
@ -76,13 +77,11 @@ index 6340496..5fb5c53 100644
# Allow the test process to exit, to cleanup after ourselves.
@@ -451,6 +448,7 @@ proc test_command_line_attach_run {} {
"-iex set\\ height\\ 0 -iex set\\ width\\ 0 --pid=$testpid -ex \"start\""]
@@ -449,6 +446,7 @@
"-iex \"set height 0\" -iex \"set width 0\" --pid=$testpid -ex \"start\""]
if { $res != 0} {
fail $test
+ remote_exec build "kill -9 ${testpid}"
return $res
}
gdb_test_multiple "" $test {
--RnlQjJ0d97Da+TV1--

View File

@ -37,10 +37,12 @@ gdb/gdbserver/
(linux_create_inferior, linux_tracefork_child): Call it instead of
direct ptrace.
Index: gdb-7.8/gdb/common/linux-ptrace.c
===================================================================
--- gdb-7.8.orig/gdb/common/linux-ptrace.c 2014-07-29 19:31:01.893149317 +0200
+++ gdb-7.8/gdb/common/linux-ptrace.c 2014-07-29 19:31:05.806154887 +0200
Amended for GDB 7.8.1 - Chris Horler
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/common/linux-ptrace.c gdb-7.8.1/gdb/common/linux-ptrace.c
--- gdb-7.8.1.orig/gdb/common/linux-ptrace.c 2014-10-29 19:45:50.000000000 +0000
+++ gdb-7.8.1/gdb/common/linux-ptrace.c 2014-12-14 20:47:29.326550209 +0000
@@ -32,6 +32,10 @@
#include <stdint.h>
@ -52,7 +54,7 @@ Index: gdb-7.8/gdb/common/linux-ptrace.c
/* Stores the currently supported ptrace options. A value of
-1 means we did not check for features yet. A value of 0 means
there are no supported features. */
@@ -56,6 +60,8 @@ linux_ptrace_attach_fail_reason (pid_t p
@@ -56,6 +60,8 @@
buffer_xml_printf (buffer, _("process %d is a zombie "
"- the process has already terminated"),
(int) pid);
@ -61,7 +63,7 @@ Index: gdb-7.8/gdb/common/linux-ptrace.c
}
#if defined __i386__ || defined __x86_64__
@@ -551,3 +557,19 @@ linux_ptrace_init_warnings (void)
@@ -551,3 +557,19 @@
linux_ptrace_test_ret_to_nx ();
}
@ -81,11 +83,10 @@ Index: gdb-7.8/gdb/common/linux-ptrace.c
+ "(gdb) shell sudo setsebool deny_ptrace=0"));
+#endif /* HAVE_LIBSELINUX */
+}
Index: gdb-7.8/gdb/common/linux-ptrace.h
===================================================================
--- gdb-7.8.orig/gdb/common/linux-ptrace.h 2014-07-29 19:31:01.893149317 +0200
+++ gdb-7.8/gdb/common/linux-ptrace.h 2014-07-29 19:31:05.807154887 +0200
@@ -85,6 +85,7 @@ struct buffer;
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/common/linux-ptrace.h gdb-7.8.1/gdb/common/linux-ptrace.h
--- gdb-7.8.1.orig/gdb/common/linux-ptrace.h 2014-10-29 19:45:50.000000000 +0000
+++ gdb-7.8.1/gdb/common/linux-ptrace.h 2014-12-14 20:47:29.330550222 +0000
@@ -85,6 +85,7 @@
extern void linux_ptrace_attach_fail_reason (pid_t pid, struct buffer *buffer);
extern void linux_ptrace_init_warnings (void);
@ -93,153 +94,10 @@ Index: gdb-7.8/gdb/common/linux-ptrace.h
extern void linux_enable_event_reporting (pid_t pid);
extern void linux_disable_event_reporting (pid_t pid);
extern int linux_supports_tracefork (void);
Index: gdb-7.8/gdb/configure.ac
===================================================================
--- gdb-7.8.orig/gdb/configure.ac 2014-07-29 19:31:01.894149319 +0200
+++ gdb-7.8/gdb/configure.ac 2014-07-29 19:31:05.807154887 +0200
@@ -2158,6 +2158,10 @@ case $host_os in
esac
AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.])
+dnl Check security_get_boolean_active availability.
+AC_CHECK_HEADERS(selinux/selinux.h)
+AC_CHECK_LIB(selinux, security_get_boolean_active)
+
dnl Handle optional features that can be enabled.
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
Index: gdb-7.8/gdb/gdbserver/configure.ac
===================================================================
--- gdb-7.8.orig/gdb/gdbserver/configure.ac 2014-07-29 19:31:01.895149320 +0200
+++ gdb-7.8/gdb/gdbserver/configure.ac 2014-07-29 19:31:05.808154887 +0200
@@ -454,6 +454,10 @@ if $want_ipa ; then
fi
fi
+dnl Check security_get_boolean_active availability.
+AC_CHECK_HEADERS(selinux/selinux.h)
+AC_CHECK_LIB(selinux, security_get_boolean_active)
+
AC_SUBST(GDBSERVER_DEPFILES)
AC_SUBST(GDBSERVER_LIBS)
AC_SUBST(srv_xmlbuiltin)
Index: gdb-7.8/gdb/gdbserver/linux-low.c
===================================================================
--- gdb-7.8.orig/gdb/gdbserver/linux-low.c 2014-07-29 19:31:01.897149323 +0200
+++ gdb-7.8/gdb/gdbserver/linux-low.c 2014-07-29 19:31:05.809154889 +0200
@@ -541,6 +541,29 @@ add_lwp (ptid_t ptid)
return lwp;
}
+/* Execute PTRACE_TRACEME with error checking. */
+
+static void
+linux_traceme (const char *program)
+{
+ int save_errno;
+ struct buffer buffer;
+
+ errno = 0;
+ if (ptrace (PTRACE_TRACEME, 0,
+ (PTRACE_TYPE_ARG3) 0, (PTRACE_TYPE_ARG4) 0) == 0)
+ return;
+
+ save_errno = errno;
+ buffer_init (&buffer);
+ linux_ptrace_create_warnings (&buffer);
+ buffer_grow_str0 (&buffer, "");
+ fprintf (stderr, _("%sCannot trace created process %s: %s.\n"),
+ buffer_finish (&buffer), program, strerror (save_errno));
+ fflush (stderr);
+ _exit (0177);
+}
+
/* Start an inferior process and returns its pid.
ALLARGS is a vector of program-name and args. */
@@ -582,7 +605,7 @@ linux_create_inferior (char *program, ch
if (pid == 0)
{
close_most_fds ();
- ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) 0, (PTRACE_TYPE_ARG4) 0);
+ linux_traceme (program);
#ifndef __ANDROID__ /* Bionic doesn't use SIGRTMIN the way glibc does. */
signal (__SIGRTMIN + 1, SIG_DFL);
Index: gdb-7.8/gdb/inf-ptrace.c
===================================================================
--- gdb-7.8.orig/gdb/inf-ptrace.c 2014-07-29 19:31:01.898149324 +0200
+++ gdb-7.8/gdb/inf-ptrace.c 2014-07-29 19:31:05.809154889 +0200
@@ -105,7 +105,15 @@ static void
inf_ptrace_me (void)
{
/* "Trace me, Dr. Memory!" */
+ errno = 0;
ptrace (PT_TRACE_ME, 0, (PTRACE_TYPE_ARG3)0, 0);
+ if (errno != 0)
+ {
+ fprintf_unfiltered (gdb_stderr, _("Cannot create process: %s\n"),
+ safe_strerror (errno));
+ gdb_flush (gdb_stderr);
+ _exit (0177);
+ }
}
/* Start a new inferior Unix child process. EXEC_FILE is the file to
Index: gdb-7.8/gdb/linux-nat.c
===================================================================
--- gdb-7.8.orig/gdb/linux-nat.c 2014-07-29 19:31:01.899149326 +0200
+++ gdb-7.8/gdb/linux-nat.c 2014-07-29 19:31:05.811154893 +0200
@@ -1291,6 +1291,7 @@ linux_nat_create_inferior (struct target
#ifdef HAVE_PERSONALITY
int personality_orig = 0, personality_set = 0;
#endif /* HAVE_PERSONALITY */
+ volatile struct gdb_exception ex;
/* The fork_child mechanism is synchronous and calls target_wait, so
we have to mask the async mode. */
@@ -1315,7 +1316,10 @@ linux_nat_create_inferior (struct target
/* Make sure we report all signals during startup. */
linux_nat_pass_signals (ops, 0, NULL);
- linux_ops->to_create_inferior (ops, exec_file, allargs, env, from_tty);
+ TRY_CATCH (ex, RETURN_MASK_ERROR)
+ {
+ linux_ops->to_create_inferior (ops, exec_file, allargs, env, from_tty);
+ }
#ifdef HAVE_PERSONALITY
if (personality_set)
@@ -1327,6 +1331,24 @@ linux_nat_create_inferior (struct target
safe_strerror (errno));
}
#endif /* HAVE_PERSONALITY */
+
+ if (ex.reason < 0)
+ {
+ struct buffer buffer;
+ char *message, *buffer_s;
+
+ message = xstrdup (ex.message);
+ make_cleanup (xfree, message);
+
+ buffer_init (&buffer);
+ linux_ptrace_create_warnings (&buffer);
+
+ buffer_grow_str0 (&buffer, "");
+ buffer_s = buffer_finish (&buffer);
+ make_cleanup (xfree, buffer_s);
+
+ throw_error (ex.error, "%s%s", buffer_s, message);
+ }
}
static void
Index: gdb-7.8/gdb/config.in
===================================================================
--- gdb-7.8.orig/gdb/config.in 2014-07-29 19:31:01.900149327 +0200
+++ gdb-7.8/gdb/config.in 2014-07-29 19:31:44.600210090 +0200
@@ -219,6 +219,9 @@
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/config.in gdb-7.8.1/gdb/config.in
--- gdb-7.8.1.orig/gdb/config.in 2014-12-14 20:44:21.913980816 +0000
+++ gdb-7.8.1/gdb/config.in 2014-12-14 20:49:09.158856507 +0000
@@ -216,6 +216,9 @@
/* Define if librpm library is being used. */
#undef HAVE_LIBRPM
@ -249,21 +107,20 @@ Index: gdb-7.8/gdb/config.in
/* Define to 1 if you have the <libunwind-ia64.h> header file. */
#undef HAVE_LIBUNWIND_IA64_H
@@ -354,6 +357,9 @@
@@ -351,6 +354,9 @@
/* Define to 1 if you have the `scm_new_smob' function. */
#undef HAVE_SCM_NEW_SMOB
+/* Define to 1 if you have the <selinux/selinux.h> header file. */
+#undef HAVE_SELINUX_SELINUX_H
+
/* Define to 1 if you have the `setenv' function. */
#undef HAVE_SETENV
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
Index: gdb-7.8/gdb/configure
===================================================================
--- gdb-7.8.orig/gdb/configure 2014-07-29 19:31:01.903149331 +0200
+++ gdb-7.8/gdb/configure 2014-07-29 19:31:05.815154898 +0200
@@ -13392,6 +13392,64 @@ cat >>confdefs.h <<_ACEOF
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/configure gdb-7.8.1/gdb/configure
--- gdb-7.8.1.orig/gdb/configure 2014-12-14 20:44:21.925980853 +0000
+++ gdb-7.8.1/gdb/configure 2014-12-14 20:47:29.364550326 +0000
@@ -13400,6 +13400,64 @@
_ACEOF
@ -328,10 +185,23 @@ Index: gdb-7.8/gdb/configure
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
# except that the argument to --with-sysroot is optional.
Index: gdb-7.8/gdb/gdbserver/config.in
===================================================================
--- gdb-7.8.orig/gdb/gdbserver/config.in 2014-07-29 19:31:01.904149333 +0200
+++ gdb-7.8/gdb/gdbserver/config.in 2014-07-29 19:31:05.815154898 +0200
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/configure.ac gdb-7.8.1/gdb/configure.ac
--- gdb-7.8.1.orig/gdb/configure.ac 2014-12-14 20:44:21.933980877 +0000
+++ gdb-7.8.1/gdb/configure.ac 2014-12-14 20:47:29.334550234 +0000
@@ -2161,6 +2161,10 @@
esac
AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.])
+dnl Check security_get_boolean_active availability.
+AC_CHECK_HEADERS(selinux/selinux.h)
+AC_CHECK_LIB(selinux, security_get_boolean_active)
+
dnl Handle optional features that can be enabled.
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/gdbserver/config.in gdb-7.8.1/gdb/gdbserver/config.in
--- gdb-7.8.1.orig/gdb/gdbserver/config.in 2014-10-29 19:45:50.000000000 +0000
+++ gdb-7.8.1/gdb/gdbserver/config.in 2014-12-14 20:47:29.366550332 +0000
@@ -81,6 +81,9 @@
/* Define to 1 if you have the `mcheck' library (-lmcheck). */
#undef HAVE_LIBMCHECK
@ -352,11 +222,10 @@ Index: gdb-7.8/gdb/gdbserver/config.in
/* Define to 1 if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
Index: gdb-7.8/gdb/gdbserver/configure
===================================================================
--- gdb-7.8.orig/gdb/gdbserver/configure 2014-07-29 19:31:01.905149334 +0200
+++ gdb-7.8/gdb/gdbserver/configure 2014-07-29 19:31:05.817154901 +0200
@@ -6170,6 +6170,64 @@ if $want_ipa ; then
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/gdbserver/configure gdb-7.8.1/gdb/gdbserver/configure
--- gdb-7.8.1.orig/gdb/gdbserver/configure 2014-10-29 19:45:50.000000000 +0000
+++ gdb-7.8.1/gdb/gdbserver/configure 2014-12-14 20:47:29.370550344 +0000
@@ -6170,6 +6170,64 @@
fi
fi
@ -421,3 +290,126 @@ Index: gdb-7.8/gdb/gdbserver/configure
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/gdbserver/configure.ac gdb-7.8.1/gdb/gdbserver/configure.ac
--- gdb-7.8.1.orig/gdb/gdbserver/configure.ac 2014-10-29 19:45:50.000000000 +0000
+++ gdb-7.8.1/gdb/gdbserver/configure.ac 2014-12-14 20:47:29.337550243 +0000
@@ -454,6 +454,10 @@
fi
fi
+dnl Check security_get_boolean_active availability.
+AC_CHECK_HEADERS(selinux/selinux.h)
+AC_CHECK_LIB(selinux, security_get_boolean_active)
+
AC_SUBST(GDBSERVER_DEPFILES)
AC_SUBST(GDBSERVER_LIBS)
AC_SUBST(srv_xmlbuiltin)
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/gdbserver/linux-low.c gdb-7.8.1/gdb/gdbserver/linux-low.c
--- gdb-7.8.1.orig/gdb/gdbserver/linux-low.c 2014-10-29 19:45:50.000000000 +0000
+++ gdb-7.8.1/gdb/gdbserver/linux-low.c 2014-12-14 20:47:29.341550255 +0000
@@ -541,6 +541,29 @@
return lwp;
}
+/* Execute PTRACE_TRACEME with error checking. */
+
+static void
+linux_traceme (const char *program)
+{
+ int save_errno;
+ struct buffer buffer;
+
+ errno = 0;
+ if (ptrace (PTRACE_TRACEME, 0,
+ (PTRACE_TYPE_ARG3) 0, (PTRACE_TYPE_ARG4) 0) == 0)
+ return;
+
+ save_errno = errno;
+ buffer_init (&buffer);
+ linux_ptrace_create_warnings (&buffer);
+ buffer_grow_str0 (&buffer, "");
+ fprintf (stderr, _("%sCannot trace created process %s: %s.\n"),
+ buffer_finish (&buffer), program, strerror (save_errno));
+ fflush (stderr);
+ _exit (0177);
+}
+
/* Start an inferior process and returns its pid.
ALLARGS is a vector of program-name and args. */
@@ -582,7 +605,7 @@
if (pid == 0)
{
close_most_fds ();
- ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) 0, (PTRACE_TYPE_ARG4) 0);
+ linux_traceme (program);
#ifndef __ANDROID__ /* Bionic doesn't use SIGRTMIN the way glibc does. */
signal (__SIGRTMIN + 1, SIG_DFL);
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/inf-ptrace.c gdb-7.8.1/gdb/inf-ptrace.c
--- gdb-7.8.1.orig/gdb/inf-ptrace.c 2014-10-29 19:45:50.000000000 +0000
+++ gdb-7.8.1/gdb/inf-ptrace.c 2014-12-14 20:47:29.345550267 +0000
@@ -105,7 +105,15 @@
inf_ptrace_me (void)
{
/* "Trace me, Dr. Memory!" */
+ errno = 0;
ptrace (PT_TRACE_ME, 0, (PTRACE_TYPE_ARG3)0, 0);
+ if (errno != 0)
+ {
+ fprintf_unfiltered (gdb_stderr, _("Cannot create process: %s\n"),
+ safe_strerror (errno));
+ gdb_flush (gdb_stderr);
+ _exit (0177);
+ }
}
/* Start a new inferior Unix child process. EXEC_FILE is the file to
diff -Nur -x '*.orig' gdb-7.8.1.orig/gdb/linux-nat.c gdb-7.8.1/gdb/linux-nat.c
--- gdb-7.8.1.orig/gdb/linux-nat.c 2014-12-14 20:44:21.800980475 +0000
+++ gdb-7.8.1/gdb/linux-nat.c 2014-12-14 20:47:29.348550277 +0000
@@ -1291,6 +1291,7 @@
#ifdef HAVE_PERSONALITY
int personality_orig = 0, personality_set = 0;
#endif /* HAVE_PERSONALITY */
+ volatile struct gdb_exception ex;
/* The fork_child mechanism is synchronous and calls target_wait, so
we have to mask the async mode. */
@@ -1315,7 +1316,10 @@
/* Make sure we report all signals during startup. */
linux_nat_pass_signals (ops, 0, NULL);
- linux_ops->to_create_inferior (ops, exec_file, allargs, env, from_tty);
+ TRY_CATCH (ex, RETURN_MASK_ERROR)
+ {
+ linux_ops->to_create_inferior (ops, exec_file, allargs, env, from_tty);
+ }
#ifdef HAVE_PERSONALITY
if (personality_set)
@@ -1327,6 +1331,24 @@
safe_strerror (errno));
}
#endif /* HAVE_PERSONALITY */
+
+ if (ex.reason < 0)
+ {
+ struct buffer buffer;
+ char *message, *buffer_s;
+
+ message = xstrdup (ex.message);
+ make_cleanup (xfree, message);
+
+ buffer_init (&buffer);
+ linux_ptrace_create_warnings (&buffer);
+
+ buffer_grow_str0 (&buffer, "");
+ buffer_s = buffer_finish (&buffer);
+ make_cleanup (xfree, buffer_s);
+
+ throw_error (ex.error, "%s%s", buffer_s, message);
+ }
}
static void

View File

@ -1,85 +0,0 @@
http://sourceware.org/ml/gdb-patches/2014-08/msg00045.html
Subject: [patch] Fix --with-babeltrace with gcc-4.9.1
--qMm9M+Fa2AknHoGS
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
when I tried to use --with-babeltrace on Fedora Rawhide x86_64
using gcc-4.9.1-3.fc22.x86_64 I got:
checking for libbabeltrace... no
configure: error: babeltrace is missing or unusable
Makefile:7973: recipe for target 'configure-gdb' failed
configure:15890: checking for libbabeltrace
configure:15918: gcc -o conftest -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Werror -static-libstdc++ -static-libgcc -Wl,-z,relro conftest.c -lselinux -lncurses -lz -lm -ldl /usr/lib64/libbabeltrace.so /usr/lib64/libbabeltrace-ctf.so >&5
conftest.c: In function 'main':
conftest.c:198:21: error: unused variable 'pos' [-Werror=unused-variable]
struct bt_iter_pos *pos = bt_iter_get_pos (bt_ctf_get_iter (NULL));
^
cc1: all warnings being treated as errors
configure:15918: $? = 1
configure: failed program was:
The patch below fixes it for me.
In configure.ac there is above this check:
# Append -Werror to CFLAGS so that configure can catch the warning
# "assignment from incompatible pointer type", which is related to
# the babeltrace change from 1.0.3 to 1.1.0. Babeltrace 1.1.0 works
# in GDB, while babeltrace 1.0.3 is broken.
# AC_LIB_HAVE_LINKFLAGS may modify CPPFLAGS in it, so it should be
# safe to save and restore CFLAGS here.
saved_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror"
Maybe it would be easier to use there:
CFLAGS="$CFLAGS -Werror -Wno-unused-variable"
But maybe -Werror is cross-compiler compatible while -Wno-unused-variable is
not, I have no idea.
Jan
--qMm9M+Fa2AknHoGS
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline; filename="gdb-babeltrace-configure.patch"
gdb/
2014-08-04 Jan Kratochvil <jan.kratochvil@redhat.com>
* configure.ac (--with-babeltrace): Use 'pos'.
* configure: Regenerate.
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 70d0964..07d2f00 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -2437,6 +2437,7 @@ else
struct bt_ctf_event *event = NULL;
const struct bt_definition *scope;
+ (void) pos; /* Prevent -Werror=unused-variable. */
scope = bt_ctf_get_top_level_scope (event,
BT_STREAM_EVENT_HEADER);
bt_ctf_get_uint64 (bt_ctf_get_field (event, scope, "id"));
diff --git a/gdb/configure b/gdb/configure
index 809326a..b983d16 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -15344,6 +15344,7 @@ struct bt_iter_pos *pos = bt_iter_get_pos (bt_ctf_get_iter (NULL));
struct bt_ctf_event *event = NULL;
const struct bt_definition *scope;
+ (void) pos; /* Prevent -Werror=unused-variable. */
scope = bt_ctf_get_top_level_scope (event,
BT_STREAM_EVENT_HEADER);
bt_ctf_get_uint64 (bt_ctf_get_field (event, scope, "id"));
--qMm9M+Fa2AknHoGS--

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Mon Dec 15 07:33:31 UTC 2014 - cshorler@googlemail.com
- Update for GDB 7.8.1
* removed (already in upstream):
gdb-babeltrace-configure.patch
gdb-async-stopped-on-pid-arg-2of2.patch
* amended (partially in upstream):
gdb-archer.patch
gdb-attach-fail-reasons-5of5.patch
gdb-async-stopped-on-pid-arg-1of2.patch
gdb-async-stopped-on-pid-arg-testsuite.patch
-------------------------------------------------------------------
Fri Oct 10 10:01:27 UTC 2014 - hrvoje.senjan@gmail.com

View File

@ -27,7 +27,7 @@ Name: gdb
%global snap 20130731
# See timestamp of source gnulib installed into gdb/gnulib/ .
%global snapgnulib 20121213
Version: 7.8
Version: 7.8.1
Release: 0
# The release always contains a leading reserved number, start it at 1.
@ -35,8 +35,8 @@ Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# Do not provide URL for snapshots as the file lasts there only for 2 days.
# ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.bz2
Source: gdb-%{version}.tar.bz2
# ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.gz
Source: gdb-%{version}.tar.gz
Url: http://gnu.org/software/gdb/
%if "%{scl}" == "devtoolset-1.1"
@ -199,7 +199,6 @@ Patch105: gdb-btrobust.patch
Patch106: gdb-python-completer-1of2.patch
Patch107: gdb-python-completer-2of2.patch
Patch108: gdb-fortran-frame-string.patch
Patch109: gdb-babeltrace-configure.patch
Patch110: gdb-dts-rhel6-python-compat.patch
Patch111: gdb-6.6-buildid-locate-rpm-scl.patch
Patch112: gdb-readline62-ask-more-rh.patch
@ -211,7 +210,6 @@ Patch115: gdb-rhel5-compat.patch
# Upstream patch to fix gcc -Werror
Patch1002: gdb-6.6-buildid-locate-rpm-suse.patch
Patch1003: gdb-async-stopped-on-pid-arg-1of2.patch
Patch1004: gdb-async-stopped-on-pid-arg-2of2.patch
Patch1005: gdb-async-stopped-on-pid-arg-testsuite.patch
BuildRequires: bison
@ -455,7 +453,6 @@ find -name "*.info*"|xargs rm -f
%patch106 -p1
%patch107 -p1
%patch108 -p1
%patch109 -p1
%patch110 -p1
%patch110 -p1 -R
%patch111 -p1
@ -472,7 +469,6 @@ find -name "*.info*"|xargs rm -f
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
find -name "*.orig" | xargs rm -f