Rebase to FSF GDB 7.4.50.20120602.

- [testsuite] BuildRequire gcc-go.
- Drop printing 2D C++ vectors as matrices which no longer worked (BZ 562763).
- Fix dejagnu-1.5-4.fc17 compatibility for Go (for BZ 635651).
- Use librpm.so.3 for rpm-4.10.0 in Fedora 18.
- Revert recent breakage of UNIX objfiles order for symbols lookup.
This commit is contained in:
Jan Kratochvil 2012-06-03 19:40:44 +02:00
parent 0c6cb6731e
commit f8eee05550
75 changed files with 1926 additions and 18161 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
/libstdc++-v3-python-r155978.tar.bz2
/gdb-7.4.50.20120120.tar.bz2
/gdb-7.4.50.20120602.tar.bz2

View File

@ -11,11 +11,11 @@
* gdb.texinfo (File Options): Document --readnever.
Index: gdb-7.4.50.20111218/gdb/doc/gdb.texinfo
Index: gdb-7.4.50.20120602/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/doc/gdb.texinfo 2011-12-19 02:52:23.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/doc/gdb.texinfo 2011-12-19 02:52:25.765407434 +0100
@@ -1005,6 +1005,12 @@ Read each symbol file's entire symbol ta
--- gdb-7.4.50.20120602.orig/gdb/doc/gdb.texinfo 2012-06-02 18:16:36.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/doc/gdb.texinfo 2012-06-02 18:25:20.300254019 +0200
@@ -1020,6 +1020,12 @@ Read each symbol file's entire symbol ta
the default, which is to read it incrementally as it is needed.
This makes startup slower, but makes future operations faster.
@ -28,11 +28,11 @@ Index: gdb-7.4.50.20111218/gdb/doc/gdb.texinfo
@end table
@node Mode Options
Index: gdb-7.4.50.20111218/gdb/main.c
Index: gdb-7.4.50.20120602/gdb/main.c
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/main.c 2011-12-19 02:52:23.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/main.c 2011-12-19 02:52:36.925364438 +0100
@@ -406,6 +406,7 @@ captured_main (void *data)
--- gdb-7.4.50.20120602.orig/gdb/main.c 2012-06-02 18:16:36.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/main.c 2012-06-02 18:25:20.302254019 +0200
@@ -414,6 +414,7 @@ captured_main (void *data)
{"xdb", no_argument, &xdb_commands, 1},
{"dbx", no_argument, &dbx_commands, 1},
{"readnow", no_argument, &readnow_symbol_files, 1},
@ -40,7 +40,7 @@ Index: gdb-7.4.50.20111218/gdb/main.c
{"r", no_argument, &readnow_symbol_files, 1},
{"quiet", no_argument, &quiet, 1},
{"q", no_argument, &quiet, 1},
@@ -1072,6 +1073,7 @@ Options:\n\n\
@@ -1131,6 +1132,7 @@ Options:\n\n\
fputs_unfiltered (_("\
--quiet Do not print version number on startup.\n\
--readnow Fully read symbol files on first access.\n\
@ -48,11 +48,11 @@ Index: gdb-7.4.50.20111218/gdb/main.c
"), stream);
fputs_unfiltered (_("\
--se=FILE Use FILE as symbol file and executable file.\n\
Index: gdb-7.4.50.20111218/gdb/symfile.c
Index: gdb-7.4.50.20120602/gdb/symfile.c
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/symfile.c 2011-12-15 16:36:55.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/symfile.c 2011-12-19 02:52:25.767407426 +0100
@@ -82,6 +82,7 @@ static void clear_symtab_users_cleanup (
--- gdb-7.4.50.20120602.orig/gdb/symfile.c 2012-05-31 20:44:49.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/symfile.c 2012-06-02 18:25:20.334254013 +0200
@@ -80,6 +80,7 @@ static void clear_symtab_users_cleanup (
/* Global variables owned by this file. */
int readnow_symbol_files; /* Read full symbols immediately. */
@ -60,19 +60,19 @@ Index: gdb-7.4.50.20111218/gdb/symfile.c
/* External variables and functions referenced. */
Index: gdb-7.4.50.20111218/gdb/dwarf2read.c
Index: gdb-7.4.50.20120602/gdb/dwarf2read.c
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/dwarf2read.c 2011-12-19 02:52:23.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/dwarf2read.c 2011-12-19 02:52:25.769407418 +0100
@@ -59,6 +59,7 @@
#include "c-lang.h"
--- gdb-7.4.50.20120602.orig/gdb/dwarf2read.c 2012-06-02 18:16:36.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/dwarf2read.c 2012-06-02 18:25:32.837250535 +0200
@@ -63,6 +63,7 @@
#include "valprint.h"
#include "gdbcore.h" /* for gnutarget */
#include <ctype.h>
+#include "top.h"
#include <fcntl.h>
#include "gdb_string.h"
@@ -1405,8 +1406,9 @@ dwarf2_has_info (struct objfile *objfile
@@ -1514,8 +1515,9 @@ dwarf2_has_info (struct objfile *objfile
(void *) names);
dwarf2_per_objfile->objfile = objfile;
}
@ -84,11 +84,11 @@ Index: gdb-7.4.50.20111218/gdb/dwarf2read.c
}
/* When loading sections, we look either for uncompressed section or for
Index: gdb-7.4.50.20111218/gdb/top.h
Index: gdb-7.4.50.20120602/gdb/top.h
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/top.h 2011-12-16 21:29:28.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/top.h 2011-12-19 02:52:25.769407418 +0100
@@ -61,6 +61,7 @@ extern void set_prompt (const char *s);
--- gdb-7.4.50.20120602.orig/gdb/top.h 2012-01-23 18:12:30.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/top.h 2012-06-02 18:25:20.367254001 +0200
@@ -60,6 +60,7 @@ extern void set_prompt (const char *s);
/* From random places. */
extern int readnow_symbol_files;

View File

@ -1,8 +1,8 @@
Index: gdb-7.4.50.20111219/gdb/testsuite/configure.ac
Index: gdb-7.4.50.20120602/gdb/testsuite/configure.ac
===================================================================
--- gdb-7.4.50.20111219.orig/gdb/testsuite/configure.ac 2011-12-19 21:07:02.178472157 +0100
+++ gdb-7.4.50.20111219/gdb/testsuite/configure.ac 2011-12-19 22:05:02.704432213 +0100
@@ -97,6 +97,6 @@ AC_OUTPUT([Makefile \
--- gdb-7.4.50.20120602.orig/gdb/testsuite/configure.ac 2012-04-25 16:07:22.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/configure.ac 2012-06-02 18:24:38.456266545 +0200
@@ -96,6 +96,6 @@ AC_OUTPUT([Makefile \
gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile \
gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile \
gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile \
@ -10,20 +10,20 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/configure.ac
+ gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile \
gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile \
gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile])
Index: gdb-7.4.50.20111219/gdb/testsuite/configure
Index: gdb-7.4.50.20120602/gdb/testsuite/configure
===================================================================
--- gdb-7.4.50.20111219.orig/gdb/testsuite/configure 2011-12-19 21:07:02.179472153 +0100
+++ gdb-7.4.50.20111219/gdb/testsuite/configure 2011-12-19 22:05:02.735432090 +0100
--- gdb-7.4.50.20120602.orig/gdb/testsuite/configure 2012-04-25 16:07:21.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/configure 2012-06-02 18:25:06.200258240 +0200
@@ -3448,7 +3448,7 @@ done
-ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
+ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
-ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.go/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
+ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.go/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -4174,6 +4174,7 @@ do
@@ -4175,6 +4175,7 @@ do
"gdb.opencl/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.opencl/Makefile" ;;
"gdb.opt/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.opt/Makefile" ;;
"gdb.pascal/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.pascal/Makefile" ;;
@ -31,10 +31,10 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/configure
"gdb.python/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.python/Makefile" ;;
"gdb.reverse/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.reverse/Makefile" ;;
"gdb.stabs/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.stabs/Makefile" ;;
Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach.c
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach.c 2011-12-19 22:05:02.782431905 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach.c 2012-06-02 18:24:38.497266532 +0200
@@ -0,0 +1,20 @@
+/* This program is intended to be started outside of gdb, and then
+ attached to by gdb. Thus, it simply spins in a loop. The loop
@ -56,10 +56,10 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach.c
+ }
+ return 0;
+}
Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach2.c
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach2.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach2.c 2011-12-19 22:05:02.786431889 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach2.c 2012-06-02 18:24:38.504266529 +0200
@@ -0,0 +1,24 @@
+/* This program is intended to be started outside of gdb, and then
+ attached to by gdb. Thus, it simply spins in a loop. The loop
@ -85,10 +85,10 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach2.c
+ }
+ return (0);
+}
Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break.c
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break.c 2011-12-19 22:05:02.787431885 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break.c 2012-06-02 18:24:38.505266529 +0200
@@ -0,0 +1,146 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -236,10 +236,10 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break.c
+ }
+ return 0;
+}
Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break1.c
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break1.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break1.c 2011-12-19 22:05:02.787431885 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break1.c 2012-06-02 18:24:38.506266530 +0200
@@ -0,0 +1,44 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -285,10 +285,10 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break1.c
+void marker3 (a, b) char *a, *b; {} /* set breakpoint 18 here */
+void marker4 (d) long d; {} /* set breakpoint 13 here */
+#endif
Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/coremaker.c
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/coremaker.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/coremaker.c 2011-12-19 22:05:02.787431885 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/coremaker.c 2012-06-02 18:24:38.506266530 +0200
@@ -0,0 +1,142 @@
+/* Copyright 1992, 1993, 1994, 1995, 1996, 1999
+ Free Software Foundation, Inc.
@ -432,10 +432,10 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/coremaker.c
+ return 0;
+}
+
Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach.exp 2011-12-19 22:05:02.787431885 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach.exp 2012-06-02 18:24:38.508266531 +0200
@@ -0,0 +1,417 @@
+# Copyright 1997, 1999, 2002 Free Software Foundation, Inc.
+
@ -854,10 +854,10 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach.exp
+do_call_attach_tests
+
+return 0
Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break.exp 2011-12-19 23:11:51.092333080 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break.exp 2012-06-02 18:24:38.510266529 +0200
@@ -0,0 +1,962 @@
+# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2002, 2003, 2004
@ -1374,7 +1374,7 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break.exp
+#
+send_gdb "break $bp_location12 foo\n"
+gdb_expect {
+ -re "Junk at end of arguments..*$gdb_prompt $"\
+ -re "malformed linespec error: unexpected string, \"foo\"\r\n$gdb_prompt $"\
+ {pass "breakpoint with trailing garbage disallowed"}
+ -re "$gdb_prompt $"\
+ {fail "breakpoint with trailing garbage disallowed"}
@ -1821,10 +1821,10 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break.exp
+ send_gdb "set args main\n"
+ gdb_expect -re ".*$gdb_prompt $" {}
+}
Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/corefile.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/corefile.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/corefile.exp 2011-12-19 22:05:02.788431881 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/corefile.exp 2012-06-02 18:24:38.511266528 +0200
@@ -0,0 +1,233 @@
+# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+# Free Software Foundation, Inc.
@ -2059,10 +2059,10 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/corefile.exp
+gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp (reinit)"
+
+gdb_test "core" "No core file now."
Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/Makefile.in
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/Makefile.in
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/Makefile.in 2011-12-19 22:05:02.788431881 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/Makefile.in 2012-06-02 18:24:38.512266527 +0200
@@ -0,0 +1,19 @@
+VPATH = @srcdir@
+srcdir = @srcdir@

View File

@ -1,14 +1,14 @@
Index: gdb-7.0.90.20100306/gdb/symfile.c
Index: gdb-7.4.50.20120602/gdb/symfile.c
===================================================================
--- gdb-7.0.90.20100306.orig/gdb/symfile.c 2010-03-06 23:20:35.000000000 +0100
+++ gdb-7.0.90.20100306/gdb/symfile.c 2010-03-06 23:26:25.000000000 +0100
@@ -3642,6 +3642,12 @@ default_symfile_relocate (struct objfile
{
bfd *abfd = objfile->obfd;
--- gdb-7.4.50.20120602.orig/gdb/symfile.c 2012-06-02 18:25:20.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/symfile.c 2012-06-02 18:26:36.145232057 +0200
@@ -3630,6 +3630,12 @@ default_symfile_relocate (struct objfile
DWO file. */
bfd *abfd = sectp->owner;
+ /* Executable files have all the relocations already resolved.
+ * Handle files linked with --emit-relocs.
+ * http://sources.redhat.com/ml/gdb/2006-08/msg00137.html */
+ Handle files linked with --emit-relocs.
+ http://sources.redhat.com/ml/gdb/2006-08/msg00137.html */
+ if ((abfd->flags & EXEC_P) != 0)
+ return NULL;
+

View File

@ -23,11 +23,11 @@ instead.
Port to GDB-6.7.
Index: gdb-7.4.50.20120120/gdb/amd64-linux-tdep.c
Index: gdb-7.4.50.20120602/gdb/amd64-linux-tdep.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/amd64-linux-tdep.c 2012-03-02 22:15:48.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/amd64-linux-tdep.c 2012-03-02 22:16:13.526569163 +0100
@@ -268,6 +268,80 @@ amd64_linux_register_reggroup_p (struct
--- gdb-7.4.50.20120602.orig/gdb/amd64-linux-tdep.c 2012-06-02 21:05:45.352280128 +0200
+++ gdb-7.4.50.20120602/gdb/amd64-linux-tdep.c 2012-06-02 21:06:25.536265325 +0200
@@ -271,6 +271,80 @@ amd64_linux_register_reggroup_p (struct
/* Set the program counter for process PTID to PC. */
@ -87,7 +87,7 @@ Index: gdb-7.4.50.20120120/gdb/amd64-linux-tdep.c
+amd64_linux_outermost_frame (struct frame_info *this_frame)
+{
+ CORE_ADDR pc = get_frame_pc (this_frame);
+ char *name;
+ const char *name;
+
+ find_pc_partial_function (pc, &name, NULL, NULL);
+
@ -108,7 +108,7 @@ Index: gdb-7.4.50.20120120/gdb/amd64-linux-tdep.c
static void
amd64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
@@ -1321,6 +1395,8 @@ amd64_linux_init_abi (struct gdbarch_inf
@@ -1330,6 +1404,8 @@ amd64_linux_init_abi (struct gdbarch_inf
tdep->xsave_xcr0_offset = I386_LINUX_XSAVE_XCR0_OFFSET;
@ -117,11 +117,11 @@ Index: gdb-7.4.50.20120120/gdb/amd64-linux-tdep.c
/* GNU/Linux uses SVR4-style shared libraries. */
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_lp64_fetch_link_map_offsets);
Index: gdb-7.4.50.20120120/gdb/amd64-tdep.c
Index: gdb-7.4.50.20120602/gdb/amd64-tdep.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/amd64-tdep.c 2012-01-04 09:16:56.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/amd64-tdep.c 2012-03-02 22:17:39.133287571 +0100
@@ -2108,6 +2108,7 @@ amd64_frame_unwind_stop_reason (struct f
--- gdb-7.4.50.20120602.orig/gdb/amd64-tdep.c 2012-06-02 21:05:45.352280128 +0200
+++ gdb-7.4.50.20120602/gdb/amd64-tdep.c 2012-06-02 21:06:00.437274574 +0200
@@ -2138,6 +2138,7 @@ amd64_frame_unwind_stop_reason (struct f
{
struct amd64_frame_cache *cache =
amd64_frame_cache (this_frame, this_cache);
@ -129,7 +129,7 @@ Index: gdb-7.4.50.20120120/gdb/amd64-tdep.c
if (!cache->base_p)
return UNWIND_UNAVAILABLE;
@@ -2116,6 +2117,10 @@ amd64_frame_unwind_stop_reason (struct f
@@ -2146,6 +2147,10 @@ amd64_frame_unwind_stop_reason (struct f
if (cache->base == 0)
return UNWIND_OUTERMOST;
@ -140,7 +140,7 @@ Index: gdb-7.4.50.20120120/gdb/amd64-tdep.c
return UNWIND_NO_REASON;
}
@@ -2125,6 +2130,7 @@ amd64_frame_this_id (struct frame_info *
@@ -2155,6 +2160,7 @@ amd64_frame_this_id (struct frame_info *
{
struct amd64_frame_cache *cache =
amd64_frame_cache (this_frame, this_cache);
@ -148,7 +148,7 @@ Index: gdb-7.4.50.20120120/gdb/amd64-tdep.c
if (!cache->base_p)
return;
@@ -2133,6 +2139,10 @@ amd64_frame_this_id (struct frame_info *
@@ -2163,6 +2169,10 @@ amd64_frame_this_id (struct frame_info *
if (cache->base == 0)
return;
@ -159,11 +159,11 @@ Index: gdb-7.4.50.20120120/gdb/amd64-tdep.c
(*this_id) = frame_id_build (cache->base + 16, cache->pc);
}
Index: gdb-7.4.50.20120120/gdb/i386-tdep.c
Index: gdb-7.4.50.20120602/gdb/i386-tdep.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/i386-tdep.c 2012-03-02 22:15:48.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/i386-tdep.c 2012-03-02 22:16:13.528569157 +0100
@@ -7613,6 +7613,9 @@ i386_gdbarch_init (struct gdbarch_info i
--- gdb-7.4.50.20120602.orig/gdb/i386-tdep.c 2012-06-02 21:05:45.352280128 +0200
+++ gdb-7.4.50.20120602/gdb/i386-tdep.c 2012-06-02 21:06:00.466274562 +0200
@@ -7639,6 +7639,9 @@ i386_gdbarch_init (struct gdbarch_info i
tdep->xsave_xcr0_offset = -1;
@ -173,10 +173,10 @@ Index: gdb-7.4.50.20120120/gdb/i386-tdep.c
tdep->record_regmap = i386_record_regmap;
set_gdbarch_long_long_align_bit (gdbarch, 32);
Index: gdb-7.4.50.20120120/gdb/i386-tdep.h
Index: gdb-7.4.50.20120602/gdb/i386-tdep.h
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/i386-tdep.h 2012-03-02 22:15:48.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/i386-tdep.h 2012-03-02 22:16:13.529569154 +0100
--- gdb-7.4.50.20120602.orig/gdb/i386-tdep.h 2012-06-02 21:05:45.352280128 +0200
+++ gdb-7.4.50.20120602/gdb/i386-tdep.h 2012-06-02 21:06:00.486274568 +0200
@@ -219,6 +219,9 @@ struct gdbarch_tdep
int (*i386_sysenter_record) (struct regcache *regcache);
/* Parse syscall args. */
@ -187,11 +187,11 @@ Index: gdb-7.4.50.20120120/gdb/i386-tdep.h
};
/* Floating-point registers. */
Index: gdb-7.4.50.20120120/gdb/ia64-tdep.c
Index: gdb-7.4.50.20120602/gdb/ia64-tdep.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/ia64-tdep.c 2012-03-02 22:15:48.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/ia64-tdep.c 2012-03-02 22:16:13.529569154 +0100
@@ -2181,6 +2181,138 @@ static const struct frame_unwind ia64_fr
--- gdb-7.4.50.20120602.orig/gdb/ia64-tdep.c 2012-06-02 21:05:45.352280128 +0200
+++ gdb-7.4.50.20120602/gdb/ia64-tdep.c 2012-06-02 21:06:00.490274552 +0200
@@ -2176,6 +2176,138 @@ static const struct frame_unwind ia64_fr
default_frame_sniffer
};
@ -330,7 +330,7 @@ Index: gdb-7.4.50.20120120/gdb/ia64-tdep.c
/* Signal trampolines. */
static void
@@ -4153,6 +4285,7 @@ ia64_gdbarch_init (struct gdbarch_info i
@@ -4146,6 +4278,7 @@ ia64_gdbarch_init (struct gdbarch_info i
set_gdbarch_dummy_id (gdbarch, ia64_dummy_id);
set_gdbarch_unwind_pc (gdbarch, ia64_unwind_pc);
@ -338,10 +338,10 @@ Index: gdb-7.4.50.20120120/gdb/ia64-tdep.c
#ifdef HAVE_LIBUNWIND_IA64_H
frame_unwind_append_unwinder (gdbarch,
&ia64_libunwind_sigtramp_frame_unwind);
Index: gdb-7.4.50.20120120/gdb/testsuite/gdb.threads/bt-clone-stop.c
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/bt-clone-stop.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20120120/gdb/testsuite/gdb.threads/bt-clone-stop.c 2012-03-02 22:16:13.530569151 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/bt-clone-stop.c 2012-06-02 21:06:00.514274544 +0200
@@ -0,0 +1,39 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -382,10 +382,10 @@ Index: gdb-7.4.50.20120120/gdb/testsuite/gdb.threads/bt-clone-stop.c
+ for (;;)
+ pause();
+}
Index: gdb-7.4.50.20120120/gdb/testsuite/gdb.threads/bt-clone-stop.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/bt-clone-stop.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20120120/gdb/testsuite/gdb.threads/bt-clone-stop.exp 2012-03-02 22:16:13.530569151 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/bt-clone-stop.exp 2012-06-02 21:06:00.515274547 +0200
@@ -0,0 +1,61 @@
+# Copyright 2006 Free Software Foundation, Inc.
+

View File

@ -58,11 +58,11 @@ Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html
* exec.c (exec_file_attach): Print a more useful error message if the
user did "gdb core".
Index: gdb-7.4.50.20111218/gdb/exceptions.h
Index: gdb-7.4.50.20120602/gdb/exceptions.h
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/exceptions.h 2011-10-09 21:21:38.000000000 +0200
+++ gdb-7.4.50.20111218/gdb/exceptions.h 2011-12-19 01:41:20.900509347 +0100
@@ -88,6 +88,9 @@ enum errors {
--- gdb-7.4.50.20120602.orig/gdb/exceptions.h 2012-01-04 09:17:01.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/exceptions.h 2012-06-02 19:59:22.195114052 +0200
@@ -86,6 +86,9 @@ enum errors {
/* DW_OP_GNU_entry_value resolving failed. */
NO_ENTRY_VALUE_ERROR,
@ -72,11 +72,11 @@ Index: gdb-7.4.50.20111218/gdb/exceptions.h
/* Add more errors here. */
NR_ERRORS
};
Index: gdb-7.4.50.20111218/gdb/exec.c
Index: gdb-7.4.50.20120602/gdb/exec.c
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/exec.c 2011-03-23 19:23:54.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/exec.c 2011-12-19 01:41:04.863568846 +0100
@@ -35,6 +35,7 @@
--- gdb-7.4.50.20120602.orig/gdb/exec.c 2012-05-29 16:23:39.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/exec.c 2012-06-02 19:59:22.196114052 +0200
@@ -33,6 +33,7 @@
#include "arch-utils.h"
#include "gdbthread.h"
#include "progspace.h"
@ -84,7 +84,7 @@ Index: gdb-7.4.50.20111218/gdb/exec.c
#include <fcntl.h>
#include "readline/readline.h"
@@ -254,12 +255,27 @@ exec_file_attach (char *filename, int fr
@@ -251,12 +252,27 @@ exec_file_attach (char *filename, int fr
if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching))
{
@ -115,13 +115,13 @@ Index: gdb-7.4.50.20111218/gdb/exec.c
}
/* FIXME - This should only be run for RS6000, but the ifdef is a poor
Index: gdb-7.4.50.20111218/gdb/main.c
Index: gdb-7.4.50.20120602/gdb/main.c
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/main.c 2011-12-19 00:28:01.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/main.c 2011-12-19 01:41:04.863568846 +0100
@@ -248,6 +248,36 @@ captured_command_loop (void *data)
return 1;
}
--- gdb-7.4.50.20120602.orig/gdb/main.c 2012-06-02 19:11:55.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/main.c 2012-06-02 19:59:42.082107499 +0200
@@ -266,6 +266,36 @@ typedef struct cmdarg {
/* Define type VEC (cmdarg_s). */
DEF_VEC_O (cmdarg_s);
+/* Call exec_file_attach. If it detected FILENAME is a core file call
+ core_file_command. Print the original exec_file_attach error only if
@ -156,7 +156,7 @@ Index: gdb-7.4.50.20111218/gdb/main.c
static int
captured_main (void *data)
{
@@ -704,6 +734,8 @@ captured_main (void *data)
@@ -764,6 +794,8 @@ captured_main (void *data)
{
symarg = argv[optind];
execarg = argv[optind];
@ -165,7 +165,7 @@ Index: gdb-7.4.50.20111218/gdb/main.c
optind++;
}
@@ -845,11 +877,25 @@ captured_main (void *data)
@@ -919,11 +951,25 @@ captured_main (void *data)
&& symarg != NULL
&& strcmp (execarg, symarg) == 0)
{

View File

@ -1,6 +1,8 @@
--- ./gdb/elfread.c 2010-10-14 17:07:45.000000000 +0200
+++ ./gdb/elfread.c 2010-10-14 17:06:30.000000000 +0200
@@ -1382,6 +1382,18 @@ build_id_to_filename (struct build_id *b
Index: gdb-7.4.50.20120602/gdb/elfread.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/elfread.c 2012-06-02 21:35:09.669510757 +0200
+++ gdb-7.4.50.20120602/gdb/elfread.c 2012-06-02 21:35:31.106502660 +0200
@@ -1658,6 +1658,19 @@ build_id_to_filename (struct build_id *b
#include <dlfcn.h>
#endif
@ -10,6 +12,7 @@
+ Enable or disable a signal handler. SIGNUM: signal to enable (or disable
+ if negative). HANDLER: sa_sigaction handler (or NULL to use
+ rpmsqHandler()). Returns: no. of refs, -1 on error. */
+extern int rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler);
+int
+rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler)
+{
@ -19,8 +22,10 @@
/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
and avoid their duplicities during a single inferior run. */
--- ./gdb/proc-service.list 2010-05-28 20:50:30.000000000 +0200
+++ ./gdb/proc-service.list 2010-10-14 17:06:30.000000000 +0200
Index: gdb-7.4.50.20120602/gdb/proc-service.list
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/proc-service.list 2012-06-02 21:35:09.669510757 +0200
+++ gdb-7.4.50.20120602/gdb/proc-service.list 2012-06-02 21:35:14.296508989 +0200
@@ -37,4 +37,7 @@
ps_pstop;
ps_ptread;

View File

@ -1,7 +1,7 @@
Index: gdb-7.4.50.20111218/gdb/event-top.c
Index: gdb-7.4.50.20120602/gdb/event-top.c
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/event-top.c 2011-09-21 17:21:28.000000000 +0200
+++ gdb-7.4.50.20111218/gdb/event-top.c 2011-12-19 01:18:56.087539251 +0100
--- gdb-7.4.50.20120602.orig/gdb/event-top.c 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/event-top.c 2012-06-02 21:08:23.479221885 +0200
@@ -36,6 +36,7 @@
#include "observer.h"
#include "continuations.h"
@ -28,11 +28,11 @@ Index: gdb-7.4.50.20111218/gdb/event-top.c
/* Each interpreter has its own rules on displaying the command
prompt. */
if (!current_interp_display_prompt_p ())
Index: gdb-7.4.50.20111218/gdb/elfread.c
Index: gdb-7.4.50.20120602/gdb/elfread.c
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/elfread.c 2011-12-19 00:54:09.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/elfread.c 2011-12-19 01:16:15.248455897 +0100
@@ -47,6 +47,7 @@
--- gdb-7.4.50.20120602.orig/gdb/elfread.c 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/elfread.c 2012-06-02 21:08:23.482221882 +0200
@@ -48,6 +48,7 @@
#include "gdbcore.h"
#include "gdbcmd.h"
#include "observer.h"
@ -40,7 +40,7 @@ Index: gdb-7.4.50.20111218/gdb/elfread.c
#include <sys/stat.h>
extern void _initialize_elfread (void);
@@ -1622,8 +1623,361 @@ build_id_to_filename (struct build_id *b
@@ -1647,8 +1648,361 @@ build_id_to_filename (struct build_id *b
return retval;
}
@ -403,7 +403,7 @@ Index: gdb-7.4.50.20111218/gdb/elfread.c
avoidance. */
struct missing_filepair
@@ -1677,11 +2031,17 @@ missing_filepair_change (void)
@@ -1702,11 +2056,17 @@ missing_filepair_change (void)
/* All their memory came just from missing_filepair_OBSTACK. */
missing_filepair_hash = NULL;
}
@ -421,7 +421,7 @@ Index: gdb-7.4.50.20111218/gdb/elfread.c
missing_filepair_change ();
}
@@ -1748,14 +2108,35 @@ debug_print_missing (const char *binary,
@@ -1773,14 +2133,35 @@ debug_print_missing (const char *binary,
*slot = missing_filepair;
@ -464,11 +464,11 @@ Index: gdb-7.4.50.20111218/gdb/elfread.c
}
static char *
Index: gdb-7.4.50.20111218/gdb/symfile.h
Index: gdb-7.4.50.20120602/gdb/symfile.h
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/symfile.h 2011-12-19 00:54:09.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/symfile.h 2011-12-19 01:16:15.249455893 +0100
@@ -568,6 +568,8 @@ extern struct build_id *build_id_addr_ge
--- gdb-7.4.50.20120602.orig/gdb/symfile.h 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/symfile.h 2012-06-02 21:08:23.499221877 +0200
@@ -621,6 +621,8 @@ extern struct build_id *build_id_addr_ge
extern char *build_id_to_filename (struct build_id *build_id,
char **link_return, int add_debug_suffix);
extern void debug_print_missing (const char *binary, const char *debug);
@ -477,11 +477,11 @@ Index: gdb-7.4.50.20111218/gdb/symfile.h
/* From dwarf2read.c */
Index: gdb-7.4.50.20111218/gdb/testsuite/lib/gdb.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/lib/gdb.exp
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/testsuite/lib/gdb.exp 2011-12-19 00:54:09.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/testsuite/lib/gdb.exp 2011-12-19 01:16:15.250455889 +0100
@@ -1387,7 +1387,7 @@ proc default_gdb_start { } {
--- gdb-7.4.50.20120602.orig/gdb/testsuite/lib/gdb.exp 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/lib/gdb.exp 2012-06-02 21:08:23.510221873 +0200
@@ -1388,7 +1388,7 @@ proc default_gdb_start { } {
warning "Couldn't set the width to 0."
}
}
@ -490,11 +490,11 @@ Index: gdb-7.4.50.20111218/gdb/testsuite/lib/gdb.exp
send_gdb "set build-id-verbose 0\n"
gdb_expect 10 {
-re "$gdb_prompt $" {
Index: gdb-7.4.50.20111218/gdb/testsuite/lib/mi-support.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/lib/mi-support.exp
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/testsuite/lib/mi-support.exp 2011-12-19 00:54:49.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/testsuite/lib/mi-support.exp 2011-12-19 01:20:34.921163977 +0100
@@ -212,7 +212,7 @@ proc default_mi_gdb_start { args } {
--- gdb-7.4.50.20120602.orig/gdb/testsuite/lib/mi-support.exp 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/lib/mi-support.exp 2012-06-02 21:08:23.523221869 +0200
@@ -213,7 +213,7 @@ proc default_mi_gdb_start { args } {
warning "Couldn't set the width to 0."
}
}
@ -503,11 +503,11 @@ Index: gdb-7.4.50.20111218/gdb/testsuite/lib/mi-support.exp
send_gdb "190-gdb-set build-id-verbose 0\n"
gdb_expect 10 {
-re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" {
Index: gdb-7.4.50.20111218/gdb/tui/tui-interp.c
Index: gdb-7.4.50.20120602/gdb/tui/tui-interp.c
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/tui/tui-interp.c 2011-09-12 23:24:51.000000000 +0200
+++ gdb-7.4.50.20111218/gdb/tui/tui-interp.c 2011-12-19 01:16:15.252455883 +0100
@@ -31,6 +31,7 @@
--- gdb-7.4.50.20120602.orig/gdb/tui/tui-interp.c 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/tui/tui-interp.c 2012-06-02 21:08:23.524221869 +0200
@@ -30,6 +30,7 @@
#include "tui/tui.h"
#include "tui/tui-io.h"
#include "exceptions.h"
@ -515,15 +515,16 @@ Index: gdb-7.4.50.20111218/gdb/tui/tui-interp.c
/* Set to 1 when the TUI mode must be activated when we first start
gdb. */
Index: gdb-7.4.50.20111218/gdb/aclocal.m4
Index: gdb-7.4.50.20120602/gdb/aclocal.m4
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/aclocal.m4 2011-02-15 22:05:53.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/aclocal.m4 2011-12-19 01:16:15.252455883 +0100
@@ -19,6 +19,162 @@ You have another version of autoconf. I
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
--- gdb-7.4.50.20120602.orig/gdb/aclocal.m4 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/aclocal.m4 2012-06-02 21:08:23.545221858 +0200
@@ -11,6 +11,164 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
+#
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
@ -551,7 +552,10 @@ Index: gdb-7.4.50.20111218/gdb/aclocal.m4
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
@ -564,7 +568,6 @@ Index: gdb-7.4.50.20111218/gdb/aclocal.m4
+ AC_MSG_RESULT([no])
+ PKG_CONFIG=""
+ fi
+
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
@ -573,21 +576,20 @@ Index: gdb-7.4.50.20111218/gdb/aclocal.m4
+# Check to see whether a particular set of modules exists. Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+#
+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
+# this or PKG_CHECK_MODULES is called, or make sure to call
+# PKG_CHECK_EXISTS manually
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+# only at the first occurence in configure.ac, so if the first place
+# it's called might be skipped (such as if it is within an "if", you
+# have to call PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+ m4_ifval([$2], [$2], [:])
+ m4_default([$2], [:])
+m4_ifvaln([$3], [else
+ $3])dnl
+fi])
+
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
@ -640,6 +642,7 @@ Index: gdb-7.4.50.20111218/gdb/aclocal.m4
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+ AC_MSG_RESULT([no])
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
@ -649,7 +652,7 @@ Index: gdb-7.4.50.20111218/gdb/aclocal.m4
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+ ifelse([$4], , [AC_MSG_ERROR(dnl
+ m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
@ -657,36 +660,35 @@ Index: gdb-7.4.50.20111218/gdb/aclocal.m4
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT
+])],
+ [AC_MSG_RESULT([no])
+ $4])
+_PKG_TEXT])
+ ])
+elif test $pkg_failed = untried; then
+ ifelse([$4], , [AC_MSG_FAILURE(dnl
+ AC_MSG_RESULT([no])
+ m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
+ [$4])
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])
+ ])
+else
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ AC_MSG_RESULT([yes])
+ ifelse([$3], , :, [$3])
+ $3
+fi[]dnl
+])# PKG_CHECK_MODULES
+
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
Index: gdb-7.4.50.20111218/gdb/config.in
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
Index: gdb-7.4.50.20120602/gdb/config.in
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/config.in 2011-11-20 09:59:56.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/config.in 2011-12-19 01:16:15.253455879 +0100
@@ -46,6 +46,9 @@
--- gdb-7.4.50.20120602.orig/gdb/config.in 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/config.in 2012-06-02 21:08:23.546221859 +0200
@@ -36,6 +36,9 @@
/* Define to BFD's default target vector. */
#undef DEFAULT_BFD_VEC
@ -696,70 +698,78 @@ Index: gdb-7.4.50.20111218/gdb/config.in
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
@@ -233,6 +236,9 @@
@@ -216,6 +219,9 @@
/* Define if Python 2.7 is being used. */
#undef HAVE_LIBPYTHON2_7
+/* Define if librpm library is being used. */
+#undef HAVE_LIBRPM
+
/* Define if libunwind library is being used. */
#undef HAVE_LIBUNWIND
/* Define to 1 if you have the <libunwind-ia64.h> header file. */
#undef HAVE_LIBUNWIND_IA64_H
Index: gdb-7.4.50.20111218/gdb/configure
Index: gdb-7.4.50.20120602/gdb/configure
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/configure 2011-11-20 09:59:56.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/configure 2011-12-19 01:16:15.256455867 +0100
@@ -684,6 +684,9 @@ REPORT_BUGS_TO
--- gdb-7.4.50.20120602.orig/gdb/configure 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/configure 2012-06-02 21:20:53.245838121 +0200
@@ -680,6 +680,11 @@ REPORT_BUGS_TO
PKGVERSION
TARGET_OBS
subdirs
+RPM_LIBS
+RPM_CFLAGS
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
GDB_DATADIR
DEBUGDIR
am__fastdepCC_FALSE
@@ -952,6 +955,7 @@ enable_dependency_tracking
with_separate_debug_dir
with_gdb_datadir
MAKEINFO_EXTRA_FLAGS
@@ -780,6 +785,7 @@ with_gdb_datadir
with_relocated_sources
with_auto_load_dir
with_auto_load_safe_path
+with_rpm
enable_targets
enable_64_bit_bfd
enable_gdbcli
@@ -995,6 +999,9 @@ LDFLAGS
LIBS
CPPFLAGS
@@ -825,6 +831,11 @@ CPPFLAGS
CPP
MAKEINFO
MAKEINFOFLAGS
+PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR
+RPM_CFLAGS
+RPM_LIBS
YACC
YFLAGS
XMKMF'
@@ -1658,6 +1665,8 @@ Optional Packages:
[DATADIR/gdb]
--with-relocated-sources=PATH
automatically relocate this path for source files
@@ -1494,6 +1505,8 @@ Optional Packages:
[--with-auto-load-dir]
--without-auto-load-safe-path
do not restrict auto-loaded files locations
+ --with-rpm query rpm database for missing debuginfos (yes/no,
+ def. auto=librpm.so)
--with-libunwind use libunwind frame unwinding support
--with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
--with-curses use the curses library instead of the termcap
library
@@ -1696,6 +1705,9 @@ Some influential environment variables:
CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
@@ -1535,6 +1548,13 @@ Some influential environment variables:
MAKEINFO Parent configure detects if it is of sufficient version.
MAKEINFOFLAGS
Parameters for MAKEINFO.
+ PKG_CONFIG path to pkg-config utility
+ PKG_CONFIG_PATH
+ directories to add to pkg-config's search path
+ PKG_CONFIG_LIBDIR
+ path overriding pkg-config's built-in search path
+ RPM_CFLAGS C compiler flags for RPM, overriding pkg-config
+ RPM_LIBS linker flags for RPM, overriding pkg-config
YACC The `Yet Another C Compiler' implementation to use. Defaults to
the first program found out of: `bison -y', `byacc', `yacc'.
YFLAGS The list of arguments that will be passed by default to $YACC.
@@ -7968,6 +7980,486 @@ _ACEOF
fi
@@ -5015,6 +5035,491 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
$as_echo "$with_auto_load_safe_path" >&6; }
+# Integration with rpm library to support missing debuginfo suggestions.
+# --without-rpm: Disable any rpm support.
@ -988,6 +998,10 @@ Index: gdb-7.4.50.20111218/gdb/configure
+ fi
+
+
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
@ -1100,7 +1114,6 @@ Index: gdb-7.4.50.20111218/gdb/configure
+$as_echo "no" >&6; }
+ PKG_CONFIG=""
+ fi
+
+fi
+
+pkg_failed=no
@ -1143,6 +1156,8 @@ Index: gdb-7.4.50.20111218/gdb/configure
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
@ -1157,10 +1172,10 @@ Index: gdb-7.4.50.20111218/gdb/configure
+ # Put the nasty error message in config.log where it belongs
+ echo "$RPM_PKG_ERRORS" >&5
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ HAVE_LIBRPM=false
+ HAVE_LIBRPM=false
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ HAVE_LIBRPM=false
+else
+ RPM_CFLAGS=$pkg_cv_RPM_CFLAGS
@ -1244,13 +1259,13 @@ Index: gdb-7.4.50.20111218/gdb/configure
subdirs="$subdirs testsuite"
Index: gdb-7.4.50.20111218/gdb/configure.ac
Index: gdb-7.4.50.20120602/gdb/configure.ac
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/configure.ac 2011-11-20 09:59:56.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/configure.ac 2011-12-19 01:16:15.257455863 +0100
@@ -140,6 +140,199 @@ AS_HELP_STRING([--with-relocated-sources
[Relocated directory for source files. ])
])
--- gdb-7.4.50.20120602.orig/gdb/configure.ac 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/configure.ac 2012-06-02 21:08:23.560221855 +0200
@@ -166,6 +166,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escap
[Directories safe to hold auto-loaded files.])
AC_MSG_RESULT([$with_auto_load_safe_path])
+# Integration with rpm library to support missing debuginfo suggestions.
+# --without-rpm: Disable any rpm support.
@ -1448,30 +1463,11 @@ Index: gdb-7.4.50.20111218/gdb/configure.ac
AC_CONFIG_SUBDIRS(testsuite)
# Check whether to support alternative target configurations
Index: gdb-7.4.50.20111218/gdb/acinclude.m4
Index: gdb-7.4.50.20120602/gdb/corelow.c
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/acinclude.m4 2010-05-27 05:40:45.000000000 +0200
+++ gdb-7.4.50.20111218/gdb/acinclude.m4 2011-12-19 01:16:15.257455863 +0100
@@ -1,3 +1,5 @@
+# serial 1
+
dnl written by Rob Savoye <rob@cygnus.com> for Cygnus Support
dnl major rewriting for Tcl 7.5 by Don Libes <libes@nist.gov>
@@ -81,8 +83,6 @@ AC_MSG_RESULT(yes)
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
-# serial 1
-
# @defmac AC_PROG_CC_STDC
# @maindex PROG_CC_STDC
# @ovindex CC
Index: gdb-7.4.50.20111218/gdb/corelow.c
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/corelow.c 2011-12-19 00:54:09.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/corelow.c 2011-12-19 01:16:15.258455859 +0100
@@ -321,7 +321,7 @@ build_id_locate_exec (int from_tty)
--- gdb-7.4.50.20120602.orig/gdb/corelow.c 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/corelow.c 2012-06-02 21:08:23.561221855 +0200
@@ -317,7 +317,7 @@ build_id_locate_exec (int from_tty)
symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
}
else

View File

@ -1,7 +1,7 @@
Index: gdb-7.4.50.20120120/gdb/corelow.c
Index: gdb-7.4.50.20120602/gdb/corelow.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/corelow.c 2012-01-10 17:30:44.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/corelow.c 2012-01-21 00:02:58.720401792 +0100
--- gdb-7.4.50.20120602.orig/gdb/corelow.c 2012-06-02 21:07:03.695251272 +0200
+++ gdb-7.4.50.20120602/gdb/corelow.c 2012-06-02 21:07:16.464246569 +0200
@@ -46,6 +46,9 @@
#include "filenames.h"
#include "progspace.h"
@ -12,7 +12,7 @@ Index: gdb-7.4.50.20120120/gdb/corelow.c
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
@@ -273,6 +276,52 @@ add_to_thread_list (bfd *abfd, asection
@@ -275,6 +278,52 @@ add_to_thread_list (bfd *abfd, asection
inferior_ptid = ptid; /* Yes, make it current. */
}
@ -65,7 +65,7 @@ Index: gdb-7.4.50.20120120/gdb/corelow.c
/* This routine opens and sets up the core file bfd. */
static void
@@ -375,6 +424,12 @@ core_open (char *filename, int from_tty)
@@ -377,6 +426,12 @@ core_open (char *filename, int from_tty)
push_target (&core_ops);
discard_cleanups (old_chain);
@ -78,7 +78,7 @@ Index: gdb-7.4.50.20120120/gdb/corelow.c
/* Do this before acknowledging the inferior, so if
post_create_inferior throws (can happen easilly if you're loading
a core file with the wrong exec), we aren't left with threads
@@ -934,4 +989,11 @@ _initialize_corelow (void)
@@ -935,4 +990,11 @@ _initialize_corelow (void)
init_core_ops ();
add_target (&core_ops);
@ -90,11 +90,11 @@ Index: gdb-7.4.50.20120120/gdb/corelow.c
+ NULL, NULL, NULL,
+ &setlist, &showlist);
}
Index: gdb-7.4.50.20120120/gdb/doc/gdb.texinfo
Index: gdb-7.4.50.20120602/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/doc/gdb.texinfo 2012-01-21 00:02:36.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/doc/gdb.texinfo 2012-01-21 00:02:41.619463607 +0100
@@ -16015,6 +16015,27 @@ information files.
--- gdb-7.4.50.20120602.orig/gdb/doc/gdb.texinfo 2012-06-02 21:07:03.695251272 +0200
+++ gdb-7.4.50.20120602/gdb/doc/gdb.texinfo 2012-06-02 21:07:16.480246563 +0200
@@ -16502,6 +16502,27 @@ information files.
@end table
@ -122,10 +122,10 @@ Index: gdb-7.4.50.20120120/gdb/doc/gdb.texinfo
@cindex @code{.gnu_debuglink} sections
@cindex debug link sections
A debug link is a special section of the executable file named
Index: gdb-7.4.50.20120120/gdb/solib-svr4.c
Index: gdb-7.4.50.20120602/gdb/solib-svr4.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/solib-svr4.c 2012-01-04 09:17:11.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/solib-svr4.c 2012-01-21 00:02:41.620463603 +0100
--- gdb-7.4.50.20120602.orig/gdb/solib-svr4.c 2012-06-02 21:07:03.695251272 +0200
+++ gdb-7.4.50.20120602/gdb/solib-svr4.c 2012-06-02 21:07:16.510246552 +0200
@@ -1227,9 +1227,52 @@ svr4_read_so_list (CORE_ADDR lm, struct
continue;
}
@ -182,10 +182,10 @@ Index: gdb-7.4.50.20120120/gdb/solib-svr4.c
xfree (buffer);
/* If this entry has no name, or its name matches the name
Index: gdb-7.4.50.20120120/gdb/elfread.c
Index: gdb-7.4.50.20120602/gdb/elfread.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/elfread.c 2012-01-21 00:02:33.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/elfread.c 2012-01-21 00:02:41.621463599 +0100
--- gdb-7.4.50.20120602.orig/gdb/elfread.c 2012-06-02 21:07:03.695251272 +0200
+++ gdb-7.4.50.20120602/gdb/elfread.c 2012-06-02 21:07:56.264232049 +0200
@@ -44,6 +44,11 @@
#include "gdbthread.h"
#include "regcache.h"
@ -198,7 +198,7 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
extern void _initialize_elfread (void);
@@ -1076,16 +1081,65 @@ elf_gnu_ifunc_resolver_return_stop (stru
@@ -1072,16 +1077,65 @@ elf_gnu_ifunc_resolver_return_stop (stru
update_breakpoint_locations (b, sals, sals_end);
}
@ -223,8 +223,9 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
-/* Locate NT_GNU_BUILD_ID from ABFD and return its content. */
+/* Locate NT_GNU_BUILD_ID and return its matching debug filename.
+ FIXME: NOTE decoding should be unified with the BFD core notes decoding. */
+
+struct build_id *
static struct build_id *
-build_id_bfd_get (bfd *abfd)
+build_id_buf_get (bfd *templ, gdb_byte *buf, bfd_size_type size)
+{
+ bfd_byte *p;
@ -259,14 +260,13 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
+
+/* Separate debuginfo files have corrupted PHDR but SHDR is correct there.
+ Locate NT_GNU_BUILD_ID from ABFD and return its content. */
static struct build_id *
-build_id_bfd_get (bfd *abfd)
+
+static struct build_id *
+build_id_bfd_shdr_get (bfd *abfd)
{
struct build_id *retval;
@@ -1101,6 +1155,348 @@ build_id_bfd_get (bfd *abfd)
@@ -1097,6 +1151,348 @@ build_id_bfd_get (bfd *abfd)
return retval;
}
@ -362,7 +362,7 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
+/* Translate an ELF program header table entry in external format into an
+ ELF program header table entry in internal format. */
+
+void
+static void
+elf_swap_phdr_in (bfd *abfd,
+ const Elf64_External_Phdr *src64,
+ Elf_Internal_Phdr *dst)
@ -615,7 +615,7 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
/* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */
static int
@@ -1115,7 +1511,7 @@ build_id_verify (const char *filename, s
@@ -1111,7 +1507,7 @@ build_id_verify (const char *filename, s
if (abfd == NULL)
return 0;
@ -624,7 +624,7 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
if (found == NULL)
warning (_("File \"%s\" has no build-id, file skipped"), filename);
@@ -1133,14 +1529,15 @@ build_id_verify (const char *filename, s
@@ -1129,17 +1525,18 @@ build_id_verify (const char *filename, s
return retval;
}
@ -636,6 +636,9 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
{
char *link, *debugdir, *retval = NULL;
+ char *link_all = NULL;
VEC (char_ptr) *debugdir_vec;
struct cleanup *back_to;
int ix;
/* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */
- link = alloca (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
@ -644,30 +647,26 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
/* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
cause "/.build-id/..." lookups. */
@@ -1151,6 +1548,8 @@ build_id_to_debug_filename (struct build
char *s, *debugdir_end;
@@ -1152,6 +1549,8 @@ build_id_to_debug_filename (struct build
size_t debugdir_len = strlen (debugdir);
gdb_byte *data = build_id->data;
size_t size = build_id->size;
+ unsigned seqno;
+ struct stat statbuf_trash;
char *s;
while (*debugdir == DIRNAME_SEPARATOR)
debugdir++;
@@ -1171,39 +1570,242 @@ build_id_to_debug_filename (struct build
memcpy (link, debugdir, debugdir_len);
@@ -1166,37 +1565,240 @@ build_id_to_debug_filename (struct build
*s++ = '/';
while (size-- > 0)
s += sprintf (s, "%02x", (unsigned) *data++);
- strcpy (s, ".debug");
-
- /* lrealpath() is expensive even for the usually non-existent files. */
- if (access (link, F_OK) == 0)
- retval = lrealpath (link);
- if (retval != NULL && !build_id_verify (retval, build_id))
+ for (seqno = 0;; seqno++)
{
- xfree (retval);
- retval = NULL;
+ {
+ char *s2;
+
+ if (seqno)
@ -685,7 +684,8 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
+ strcpy (s2, ".debug");
+ else
+ *s2 = 0;
+
- if (retval != NULL && !build_id_verify (retval, build_id))
+ /* `access' automatically dereferences LINK. */
+ if (lstat (link, &statbuf_trash) != 0)
+ {
@ -703,15 +703,16 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
+
+ if (retval)
+ break;
}
if (retval != NULL)
- break;
+ {
+ /* LINK_ALL is not used below in this non-NULL RETVAL case. */
+ break;
+ }
+
+ if (retval != NULL)
{
- xfree (retval);
- retval = NULL;
+ /* LINK_ALL is not used below in this non-NULL RETVAL case. */
+ break;
}
+ if (link_all == NULL)
+ link_all = xstrdup (link);
+ else
@ -726,14 +727,12 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
+
+ strcpy (&link_all[len_orig + 1], link);
+ }
debugdir = debugdir_end;
}
while (*debugdir != 0);
+ }
+
+ if (link_return != NULL)
+ {
+ if (retval != NULL)
if (retval != NULL)
- break;
+ {
+ *link_return = link;
+ link = NULL;
@ -743,13 +742,14 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
+ *link_return = link_all;
+ link_all = NULL;
+ }
+ }
}
+ xfree (link);
+ xfree (link_all);
+
+ return retval;
+}
+
do_cleanups (back_to);
return retval;
}
+/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
+ Try to install the hash file ...
+ avoidance. */
@ -772,9 +772,9 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
+
+ retval = obstack_alloc (&missing_filepair_obstack, size);
+ memset (retval, 0, size);
return retval;
}
+ return retval;
+}
+
+static hashval_t
+missing_filepair_hash_func (const struct missing_filepair *elem)
+{
@ -908,7 +908,7 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
xfree (build_id);
/* Prevent looping on a stripped .debug file. */
if (build_id_name != NULL
@@ -1214,7 +1816,7 @@ find_separate_debug_file_by_buildid (str
@@ -1207,7 +1809,7 @@ find_separate_debug_file_by_buildid (str
xfree (build_id_name);
}
else if (build_id_name != NULL)
@ -917,7 +917,7 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
}
return NULL;
}
@@ -1434,9 +2036,10 @@ elf_symfile_read (struct objfile *objfil
@@ -1427,9 +2029,10 @@ elf_symfile_read (struct objfile *objfil
`.note.gnu.build-id'. */
else if (!objfile_has_partial_symbols (objfile))
{
@ -930,7 +930,7 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
if (debugfile == NULL)
debugfile = find_separate_debug_file_by_debuglink (objfile);
@@ -1448,6 +2051,12 @@ elf_symfile_read (struct objfile *objfil
@@ -1441,6 +2044,12 @@ elf_symfile_read (struct objfile *objfil
symbol_file_add_separate (abfd, symfile_flags, objfile);
xfree (debugfile);
}
@ -943,7 +943,7 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
}
}
@@ -1931,4 +2540,16 @@ _initialize_elfread (void)
@@ -1770,4 +2379,16 @@ _initialize_elfread (void)
elf_objfile_gnu_ifunc_cache_data = register_objfile_data ();
gnu_ifunc_fns_p = &elf_gnu_ifunc_fns;
@ -960,11 +960,11 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
+
+ observer_attach_executable_changed (debug_print_executable_changed);
}
Index: gdb-7.4.50.20120120/gdb/symfile.h
Index: gdb-7.4.50.20120602/gdb/symfile.h
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/symfile.h 2012-01-21 00:02:33.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/symfile.h 2012-01-21 00:02:41.621463599 +0100
@@ -614,6 +614,13 @@ void free_symfile_segment_data (struct s
--- gdb-7.4.50.20120602.orig/gdb/symfile.h 2012-06-02 21:07:03.695251272 +0200
+++ gdb-7.4.50.20120602/gdb/symfile.h 2012-06-02 21:07:16.524246547 +0200
@@ -615,6 +615,13 @@ void free_symfile_segment_data (struct s
extern struct cleanup *increment_reading_symtab (void);
@ -978,11 +978,11 @@ Index: gdb-7.4.50.20120120/gdb/symfile.h
/* From dwarf2read.c */
/* Names for a dwarf2 debugging section. The field NORMAL is the normal
Index: gdb-7.4.50.20120120/gdb/testsuite/lib/gdb.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/lib/gdb.exp
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/testsuite/lib/gdb.exp 2012-01-21 00:02:36.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/testsuite/lib/gdb.exp 2012-01-21 00:02:41.622463596 +0100
@@ -1385,6 +1385,16 @@ proc default_gdb_start { } {
--- gdb-7.4.50.20120602.orig/gdb/testsuite/lib/gdb.exp 2012-06-02 21:07:03.695251272 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/lib/gdb.exp 2012-06-02 21:07:16.526246546 +0200
@@ -1388,6 +1388,16 @@ proc default_gdb_start { } {
warning "Couldn't set the width to 0."
}
}
@ -999,11 +999,11 @@ Index: gdb-7.4.50.20120120/gdb/testsuite/lib/gdb.exp
return 0;
}
Index: gdb-7.4.50.20120120/gdb/testsuite/lib/mi-support.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/lib/mi-support.exp
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/testsuite/lib/mi-support.exp 2012-01-12 23:28:34.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/testsuite/lib/mi-support.exp 2012-01-21 00:02:41.622463596 +0100
@@ -212,6 +212,16 @@ proc default_mi_gdb_start { args } {
--- gdb-7.4.50.20120602.orig/gdb/testsuite/lib/mi-support.exp 2012-06-02 21:07:03.695251272 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/lib/mi-support.exp 2012-06-02 21:07:16.535246544 +0200
@@ -213,6 +213,16 @@ proc default_mi_gdb_start { args } {
warning "Couldn't set the width to 0."
}
}
@ -1020,11 +1020,11 @@ Index: gdb-7.4.50.20120120/gdb/testsuite/lib/mi-support.exp
# If allowing the inferior to have its own PTY then assign the inferior
# its own terminal device here.
if { $separate_inferior_pty } {
Index: gdb-7.4.50.20120120/gdb/objfiles.h
Index: gdb-7.4.50.20120602/gdb/objfiles.h
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/objfiles.h 2012-01-04 09:17:09.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/objfiles.h 2012-01-21 00:02:41.623463593 +0100
@@ -433,6 +433,10 @@ struct objfile
--- gdb-7.4.50.20120602.orig/gdb/objfiles.h 2012-06-02 21:07:03.695251272 +0200
+++ gdb-7.4.50.20120602/gdb/objfiles.h 2012-06-02 21:07:16.539246541 +0200
@@ -432,6 +432,10 @@ struct objfile
#define OBJF_MAINLINE (1 << 5)

View File

@ -21,15 +21,15 @@
Port to GDB-6.8pre.
Index: gdb-7.4.50.20111218/gdb/inferior.h
Index: gdb-7.4.50.20120602/gdb/inferior.h
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/inferior.h 2011-10-07 14:06:46.000000000 +0200
+++ gdb-7.4.50.20111218/gdb/inferior.h 2011-12-18 23:40:59.257300451 +0100
@@ -162,7 +162,15 @@ extern void reopen_exec_file (void);
--- gdb-7.4.50.20120602.orig/gdb/inferior.h 2012-05-24 18:39:09.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/inferior.h 2012-06-02 18:24:12.875274179 +0200
@@ -159,7 +159,15 @@ extern void reopen_exec_file (void);
/* The `resume' routine should only be called in special circumstances.
Normally, use `proceed', which handles a lot of bookkeeping. */
-extern void resume (int, enum target_signal);
-extern void resume (int, enum gdb_signal);
+enum resume_step
+ {
+ /* currently_stepping () should return non-zero for non-continue. */
@ -38,14 +38,14 @@ Index: gdb-7.4.50.20111218/gdb/inferior.h
+ RESUME_STEP_NEEDED /* Stepping only for software watchpoints. */
+ };
+
+extern void resume (enum resume_step, enum target_signal);
+extern void resume (enum resume_step, enum gdb_signal);
extern ptid_t user_visible_resume_ptid (int step);
Index: gdb-7.4.50.20111218/gdb/infrun.c
Index: gdb-7.4.50.20120602/gdb/infrun.c
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/infrun.c 2011-11-22 22:25:17.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/infrun.c 2011-12-19 00:12:34.470854218 +0100
--- gdb-7.4.50.20120602.orig/gdb/infrun.c 2012-05-28 22:43:26.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/infrun.c 2012-06-02 18:23:59.339278268 +0200
@@ -79,7 +79,7 @@ static int follow_fork (void);
static void set_schedlock_func (char *args, int from_tty,
struct cmd_list_element *c);
@ -55,7 +55,7 @@ Index: gdb-7.4.50.20111218/gdb/infrun.c
static int currently_stepping_or_nexting_callback (struct thread_info *tp,
void *data);
@@ -1668,7 +1668,8 @@ user_visible_resume_ptid (int step)
@@ -1687,7 +1687,8 @@ user_visible_resume_ptid (int step)
}
else if ((scheduler_mode == schedlock_on)
|| (scheduler_mode == schedlock_step
@ -65,16 +65,16 @@ Index: gdb-7.4.50.20111218/gdb/infrun.c
{
/* User-settable 'scheduler' mode requires solo thread resume. */
resume_ptid = inferior_ptid;
@@ -1686,7 +1687,7 @@ user_visible_resume_ptid (int step)
@@ -1705,7 +1706,7 @@ user_visible_resume_ptid (int step)
STEP nonzero if we should step (zero to continue instead).
SIG is the signal to give the inferior (zero for none). */
void
-resume (int step, enum target_signal sig)
+resume (enum resume_step step, enum target_signal sig)
-resume (int step, enum gdb_signal sig)
+resume (enum resume_step step, enum gdb_signal sig)
{
int should_resume = 1;
struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
@@ -1719,9 +1720,13 @@ resume (int step, enum target_signal sig
@@ -1738,9 +1739,13 @@ resume (int step, enum gdb_signal sig)
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
@ -90,7 +90,7 @@ Index: gdb-7.4.50.20111218/gdb/infrun.c
target_pid_to_str (inferior_ptid),
paddress (gdbarch, pc));
@@ -2094,7 +2099,7 @@ proceed (CORE_ADDR addr, enum target_sig
@@ -2117,7 +2122,7 @@ proceed (CORE_ADDR addr, enum gdb_signal
struct thread_info *tp;
CORE_ADDR pc;
struct address_space *aspace;
@ -99,7 +99,7 @@ Index: gdb-7.4.50.20111218/gdb/infrun.c
/* If we're stopped at a fork/vfork, follow the branch set by the
"set follow-fork-mode" command; otherwise, we'll just proceed
@@ -2134,13 +2139,13 @@ proceed (CORE_ADDR addr, enum target_sig
@@ -2157,13 +2162,13 @@ proceed (CORE_ADDR addr, enum gdb_signal
actually be executing the breakpoint insn anyway.
We'll be (un-)executing the previous instruction. */
@ -115,7 +115,7 @@ Index: gdb-7.4.50.20111218/gdb/infrun.c
}
else
{
@@ -2171,13 +2176,13 @@ proceed (CORE_ADDR addr, enum target_sig
@@ -2194,13 +2199,13 @@ proceed (CORE_ADDR addr, enum gdb_signal
is required it returns TRUE and sets the current thread to
the old thread. */
if (prepare_to_proceed (step))
@ -131,7 +131,7 @@ Index: gdb-7.4.50.20111218/gdb/infrun.c
{
tp->control.trap_expected = 1;
/* If displaced stepping is enabled, we can step over the
@@ -2264,8 +2269,13 @@ proceed (CORE_ADDR addr, enum target_sig
@@ -2287,8 +2292,13 @@ proceed (CORE_ADDR addr, enum gdb_signal
/* Reset to normal state. */
init_infwait_state ();
@ -146,7 +146,7 @@ Index: gdb-7.4.50.20111218/gdb/infrun.c
/* Wait for it to stop (if not standalone)
and in any case decode why it stopped, and act accordingly. */
@@ -5223,13 +5233,18 @@ process_event_stop_test:
@@ -5249,13 +5259,18 @@ process_event_stop_test:
/* Is thread TP in the middle of single-stepping? */
@ -170,11 +170,11 @@ Index: gdb-7.4.50.20111218/gdb/infrun.c
}
/* Returns true if any thread *but* the one passed in "data" is in the
Index: gdb-7.4.50.20111218/gdb/linux-nat.c
Index: gdb-7.4.50.20120602/gdb/linux-nat.c
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/linux-nat.c 2011-12-18 23:35:23.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/linux-nat.c 2011-12-19 00:08:41.824855353 +0100
@@ -3036,7 +3036,11 @@ static int
--- gdb-7.4.50.20120602.orig/gdb/linux-nat.c 2012-05-24 18:51:34.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/linux-nat.c 2012-06-02 18:23:07.409293800 +0200
@@ -3051,7 +3051,11 @@ static int
select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
{
if (lp->last_resume_kind == resume_step
@ -187,11 +187,11 @@ Index: gdb-7.4.50.20111218/gdb/linux-nat.c
return 1;
else
return 0;
Index: gdb-7.4.50.20111218/gdb/linux-nat.h
Index: gdb-7.4.50.20120602/gdb/linux-nat.h
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/linux-nat.h 2011-12-18 23:35:23.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/linux-nat.h 2011-12-18 23:40:59.262300431 +0100
@@ -74,8 +74,8 @@ struct lwp_info
--- gdb-7.4.50.20120602.orig/gdb/linux-nat.h 2012-03-21 14:43:54.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/linux-nat.h 2012-06-02 18:23:07.411293798 +0200
@@ -73,8 +73,8 @@ struct lwp_info
/* If non-zero, a pending wait status. */
int status;

View File

@ -1,26 +1,26 @@
Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.base/annota1.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.base/annota1.exp
===================================================================
--- gdb-7.4.50.20111219.orig/gdb/testsuite/gdb.base/annota1.exp 2011-12-13 18:22:08.000000000 +0100
+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.base/annota1.exp 2011-12-20 00:01:36.518847033 +0100
@@ -50,6 +50,8 @@ gdb_start
--- gdb-7.4.50.20120602.orig/gdb/testsuite/gdb.base/annota1.exp 2012-03-16 17:47:33.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.base/annota1.exp 2012-06-02 18:27:46.623210711 +0200
@@ -45,6 +45,8 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
+gdb_test "set breakpoint pending off" "" "Avoid lockup on nonexisting functions"
+
#
# the line at which break main will put the breakpoint
#
Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.base/annota3.exp
# The commands we test here produce many lines of output; disable "press
# <return> to continue" prompts.
gdb_test_no_output "set height 0"
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.base/annota3.exp
===================================================================
--- gdb-7.4.50.20111219.orig/gdb/testsuite/gdb.base/annota3.exp 2011-12-13 18:22:08.000000000 +0100
+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.base/annota3.exp 2011-12-20 00:01:36.518847033 +0100
@@ -50,6 +50,8 @@ gdb_start
--- gdb-7.4.50.20120602.orig/gdb/testsuite/gdb.base/annota3.exp 2012-02-28 23:40:48.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.base/annota3.exp 2012-06-02 18:28:00.375206457 +0200
@@ -45,6 +45,8 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
+gdb_test "set breakpoint pending off" "" "Avoid lockup on nonexisting functions"
+
#
# the line at which break main will put the breakpoint
#
# The commands we test here produce many lines of output; disable "press
# <return> to continue" prompts.
gdb_test_no_output "set height 0"

View File

@ -1,8 +1,8 @@
Index: gdb-7.0.50.20100115/gdb/linux-nat.c
Index: gdb-7.4.50.20120602/gdb/linux-nat.c
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/linux-nat.c 2010-01-15 11:53:34.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/linux-nat.c 2010-01-15 12:13:53.000000000 +0100
@@ -175,6 +175,9 @@ blocked. */
--- gdb-7.4.50.20120602.orig/gdb/linux-nat.c 2012-06-02 20:51:58.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/linux-nat.c 2012-06-02 20:54:30.127529159 +0200
@@ -180,6 +180,9 @@ blocked. */
static struct target_ops *linux_ops;
static struct target_ops linux_ops_saved;
@ -12,7 +12,7 @@ Index: gdb-7.0.50.20100115/gdb/linux-nat.c
/* The method to call, if any, when a new thread is attached. */
static void (*linux_nat_new_thread) (struct lwp_info *);
@@ -933,7 +936,14 @@ Attaching after process %d fork to child
@@ -909,7 +912,14 @@ holding the child stopped. Try \"set de
parent_inf->waiting_for_vfork_done = 0;
}
else if (detach_fork)
@ -28,7 +28,7 @@ Index: gdb-7.0.50.20100115/gdb/linux-nat.c
/* Note that the detach above makes PARENT_INF dangling. */
@@ -1427,6 +1437,7 @@ linux_nat_post_attach_wait (ptid_t ptid,
@@ -1377,6 +1387,7 @@ linux_nat_post_attach_wait (ptid_t ptid,
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LNPAW: Attaching to a stopped process\n");
@ -36,8 +36,8 @@ Index: gdb-7.0.50.20100115/gdb/linux-nat.c
/* The process is definitely stopped. It is in a job control
stop, unless the kernel predates the TASK_STOPPED /
@@ -1757,6 +1768,9 @@ GPT: lwp %s had signal %s, but it is in
target_signal_to_string (signo));
@@ -1805,6 +1816,9 @@ get_pending_status (struct lwp_info *lp,
gdb_signal_to_string (signo));
}
+ if (*status == 0 && GET_PID (lp->ptid) == pid_was_stopped)
@ -46,7 +46,7 @@ Index: gdb-7.0.50.20100115/gdb/linux-nat.c
return 0;
}
@@ -1866,6 +1880,8 @@ linux_nat_detach (struct target_ops *ops
@@ -1918,6 +1932,8 @@ linux_nat_detach (struct target_ops *ops
}
else
linux_ops->to_detach (ops, args, from_tty);
@ -55,7 +55,7 @@ Index: gdb-7.0.50.20100115/gdb/linux-nat.c
}
/* Resume LP. */
@@ -2031,6 +2047,14 @@ linux_nat_resume (struct target_ops *ops
@@ -2083,6 +2099,14 @@ linux_nat_resume (struct target_ops *ops
resume_callback. */
lp->stopped = 0;
@ -70,7 +70,7 @@ Index: gdb-7.0.50.20100115/gdb/linux-nat.c
if (resume_many)
iterate_over_lwps (ptid, resume_callback, NULL);
@@ -3923,6 +3947,8 @@ linux_nat_mourn_inferior (struct target_
@@ -4132,6 +4156,8 @@ linux_nat_mourn_inferior (struct target_
there are other viable forks to debug. Delete the exiting
one and context-switch to the first available. */
linux_fork_mourn_inferior ();
@ -79,11 +79,11 @@ Index: gdb-7.0.50.20100115/gdb/linux-nat.c
}
/* Convert a native/host siginfo object, into/from the siginfo in the
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/attach-stopped.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/attach-stopped.exp
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.threads/attach-stopped.exp 2010-01-01 08:32:06.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/attach-stopped.exp 2010-01-15 11:54:57.000000000 +0100
@@ -62,7 +62,65 @@ proc corefunc { threadtype } {
--- gdb-7.4.50.20120602.orig/gdb/testsuite/gdb.threads/attach-stopped.exp 2012-01-04 09:27:55.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/attach-stopped.exp 2012-06-02 20:52:08.893505403 +0200
@@ -63,7 +63,65 @@ proc corefunc { threadtype } {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}

View File

@ -1,8 +1,8 @@
Index: gdb-7.2.50.20110320/bfd/elf-bfd.h
Index: gdb-7.4.50.20120602/bfd/elf-bfd.h
===================================================================
--- gdb-7.2.50.20110320.orig/bfd/elf-bfd.h 2011-03-20 15:17:42.000000000 +0100
+++ gdb-7.2.50.20110320/bfd/elf-bfd.h 2011-03-20 15:24:02.000000000 +0100
@@ -2193,8 +2193,10 @@ extern Elf_Internal_Phdr * _bfd_elf_find
--- gdb-7.4.50.20120602.orig/bfd/elf-bfd.h 2012-06-02 21:26:09.928717069 +0200
+++ gdb-7.4.50.20120602/bfd/elf-bfd.h 2012-06-02 21:27:21.727689625 +0200
@@ -2221,8 +2221,10 @@ extern Elf_Internal_Phdr * _bfd_elf_find
/* Exported interface for writing elf corefile notes. */
extern char *elfcore_write_note
(bfd *, char *, int *, const char *, int, const void *, int);
@ -14,17 +14,11 @@ Index: gdb-7.2.50.20110320/bfd/elf-bfd.h
extern char *elfcore_write_prstatus
(bfd *, char *, int *, long, int, const void *);
extern char * elfcore_write_pstatus
Index: gdb-7.2.50.20110320/bfd/elf.c
Index: gdb-7.4.50.20120602/bfd/elf.c
===================================================================
--- gdb-7.2.50.20110320.orig/bfd/elf.c 2011-03-20 15:17:42.000000000 +0100
+++ gdb-7.2.50.20110320/bfd/elf.c 2011-03-20 15:24:02.000000000 +0100
@@ -8814,13 +8814,12 @@ elfcore_write_note (bfd *abfd,
return buf;
}
-#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
+#if defined (HAVE_PRPSINFO_T)
char *
--- gdb-7.4.50.20120602.orig/bfd/elf.c 2012-06-02 21:26:09.928717069 +0200
+++ gdb-7.4.50.20120602/bfd/elf.c 2012-06-02 21:27:21.732689623 +0200
@@ -8917,56 +8917,61 @@ char *
elfcore_write_prpsinfo (bfd *abfd,
char *buf,
int *bufsiz,
@ -32,9 +26,8 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
- const char *psargs)
+ const prpsinfo_t *input)
{
const char *note_name = "CORE";
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
@@ -8828,48 +8827,55 @@ elfcore_write_prpsinfo (bfd *abfd,
if (bed->elf_backend_write_core_note != NULL)
{
char *ret;
@ -52,7 +45,9 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
return ret;
}
-#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
-#if defined (HAVE_PRPSINFO32_T) || defined (HAVE_PSINFO32_T)
+#if defined (HAVE_PRPSINFO_T)
+#if defined (HAVE_PRPSINFO32_T)
if (bed->s->elfclass == ELFCLASS32)
{
@ -64,7 +59,7 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
int note_type = NT_PRPSINFO;
-#endif
memset (&data, 0, sizeof (data));
- memset (&data, 0, sizeof (data));
- strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
- strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
+ data.pr_state = input->pr_state;
@ -83,7 +78,7 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
+ BFD_ASSERT (sizeof (data.pr_psargs) == sizeof (input->pr_psargs));
+ memcpy (data.pr_psargs, input->pr_psargs, sizeof (data.pr_psargs));
return elfcore_write_note (abfd, buf, bufsiz,
note_name, note_type, &data, sizeof (data));
"CORE", note_type, &data, sizeof (data));
}
else
#endif
@ -100,21 +95,40 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
- strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
- strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
return elfcore_write_note (abfd, buf, bufsiz,
- note_name, note_type, &data, sizeof (data));
+ note_name, note_type, input, sizeof (*input));
- "CORE", note_type, &data, sizeof (data));
+ "CORE", note_type, input, sizeof (*input));
}
}
-#endif /* PSINFO_T or PRPSINFO_T */
+#endif /* PRPSINFO_T */
#if defined (HAVE_PRSTATUS_T)
char *
Index: gdb-7.2.50.20110320/gdb/linux-nat.c
free (buf);
return NULL;
Index: gdb-7.4.50.20120602/gdb/procfs.c
===================================================================
--- gdb-7.2.50.20110320.orig/gdb/linux-nat.c 2011-03-20 15:17:46.000000000 +0100
+++ gdb-7.2.50.20110320/gdb/linux-nat.c 2011-03-20 15:25:36.000000000 +0100
@@ -4603,6 +4603,131 @@ linux_spu_make_corefile_notes (bfd *obfd
return args.note_data;
--- gdb-7.4.50.20120602.orig/gdb/procfs.c 2012-06-02 21:26:09.928717069 +0200
+++ gdb-7.4.50.20120602/gdb/procfs.c 2012-06-02 21:27:21.745689618 +0200
@@ -5541,6 +5541,7 @@ procfs_make_note_section (bfd *obfd, int
note_data = (char *) elfcore_write_prpsinfo (obfd,
note_data,
note_size,
+ NULL,
fname,
psargs);
Index: gdb-7.4.50.20120602/gdb/linux-tdep.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/linux-tdep.c 2012-06-02 21:26:09.928717069 +0200
+++ gdb-7.4.50.20120602/gdb/linux-tdep.c 2012-06-02 21:31:12.051601510 +0200
@@ -30,6 +30,7 @@
#include "elf-bfd.h" /* for elfcore_write_* */
#include "inferior.h"
#include "cli/cli-utils.h"
+#include <sys/procfs.h>
#include <ctype.h>
@@ -769,6 +770,131 @@ linux_corefile_thread_callback (struct t
return !args->note_data;
}
+/* Should be always true for Linux */
@ -245,45 +259,22 @@ Index: gdb-7.2.50.20110320/gdb/linux-nat.c
/* Fills the "to_make_corefile_note" target vector. Builds the note
section for a corefile, and returns it in a malloc buffer. */
@@ -4621,26 +4746,11 @@ linux_nat_make_corefile_notes (bfd *obfd
@@ -784,16 +910,9 @@ linux_make_corefile_notes (struct gdbarc
/* Process information. */
if (get_exec_file (0))
{
- strncpy (fname, lbasename (get_exec_file (0)), sizeof (fname));
- strncpy (psargs, get_exec_file (0), sizeof (psargs));
- if (get_inferior_args ())
- {
- char *string_end;
- char *psargs_end = psargs + sizeof (psargs);
-
- /* linux_elfcore_write_prpsinfo () handles zero unterminated
- strings fine. */
- string_end = memchr (psargs, 0, sizeof (psargs));
- if (string_end != NULL)
- {
- *string_end++ = ' ';
- strncpy (string_end, get_inferior_args (),
- psargs_end - string_end);
- }
- }
- const char *fname = lbasename (get_exec_file (0));
- char *psargs = xstrdup (fname);
+ const prpsinfo_t *data = fill_prpsinfo ();
+
note_data = (char *) elfcore_write_prpsinfo (obfd,
note_data,
- note_size, fname, psargs);
+ note_size, data);
}
/* Dump information for threads. */
Index: gdb-7.2.50.20110320/gdb/procfs.c
===================================================================
--- gdb-7.2.50.20110320.orig/gdb/procfs.c 2011-03-09 13:48:55.000000000 +0100
+++ gdb-7.2.50.20110320/gdb/procfs.c 2011-03-20 15:24:02.000000000 +0100
@@ -5752,6 +5752,7 @@ procfs_make_note_section (bfd *obfd, int
note_data = (char *) elfcore_write_prpsinfo (obfd,
note_data,
note_size,
+ NULL,
fname,
psargs);
- if (get_inferior_args ())
- psargs = reconcat (psargs, psargs, " ", get_inferior_args (),
- (char *) NULL);
-
- note_data = elfcore_write_prpsinfo (obfd, note_data, note_size,
- fname, psargs);
- xfree (psargs);
+ note_data = elfcore_write_prpsinfo (obfd, note_data, note_size, data);
if (!note_data)
return NULL;

View File

@ -1,8 +1,8 @@
Index: gdb-7.4.50.20120103/gdb/breakpoint.c
Index: gdb-7.4.50.20120602/gdb/breakpoint.c
===================================================================
--- gdb-7.4.50.20120103.orig/gdb/breakpoint.c 2012-01-03 05:52:15.000000000 +0100
+++ gdb-7.4.50.20120103/gdb/breakpoint.c 2012-01-03 15:22:56.105405559 +0100
@@ -13724,6 +13724,50 @@ initialize_breakpoint_ops (void)
--- gdb-7.4.50.20120602.orig/gdb/breakpoint.c 2012-06-02 19:11:54.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/breakpoint.c 2012-06-02 19:52:58.161226506 +0200
@@ -15495,6 +15495,50 @@ initialize_breakpoint_ops (void)
}
void
@ -53,23 +53,23 @@ Index: gdb-7.4.50.20120103/gdb/breakpoint.c
_initialize_breakpoint (void)
{
struct cmd_list_element *c;
Index: gdb-7.4.50.20120103/gdb/breakpoint.h
Index: gdb-7.4.50.20120602/gdb/breakpoint.h
===================================================================
--- gdb-7.4.50.20120103.orig/gdb/breakpoint.h 2012-01-03 05:52:15.000000000 +0100
+++ gdb-7.4.50.20120103/gdb/breakpoint.h 2012-01-03 15:23:09.444356484 +0100
@@ -1393,4 +1393,7 @@ extern struct gdbarch *get_sal_arch (str
--- gdb-7.4.50.20120602.orig/gdb/breakpoint.h 2012-05-16 16:35:03.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/breakpoint.h 2012-06-02 19:53:09.268223263 +0200
@@ -1503,4 +1503,7 @@ extern struct gdbarch *get_sal_arch (str
extern void modify_semaphore (struct bp_location *location, int set);
extern void handle_solib_event (void);
+extern void breakpoints_relocate (struct objfile *objfile,
+ struct section_offsets *delta);
+
#endif /* !defined (BREAKPOINT_H) */
Index: gdb-7.4.50.20120103/gdb/objfiles.c
Index: gdb-7.4.50.20120602/gdb/objfiles.c
===================================================================
--- gdb-7.4.50.20120103.orig/gdb/objfiles.c 2012-01-03 05:52:15.000000000 +0100
+++ gdb-7.4.50.20120103/gdb/objfiles.c 2012-01-03 15:23:28.141287697 +0100
@@ -818,6 +818,11 @@ objfile_relocate1 (struct objfile *objfi
--- gdb-7.4.50.20120602.orig/gdb/objfiles.c 2012-05-10 21:50:08.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/objfiles.c 2012-06-02 19:52:58.202226502 +0200
@@ -802,6 +802,11 @@ objfile_relocate1 (struct objfile *objfi
objfile->sf->sym_probe_fns->sym_relocate_probe (objfile,
new_offsets, delta);

View File

@ -1,8 +1,8 @@
Index: gdb-7.4.50.20111218/gdb/dwarf2read.c
Index: gdb-7.4.50.20120602/gdb/dwarf2read.c
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/dwarf2read.c 2011-12-19 01:31:24.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/dwarf2read.c 2011-12-19 01:33:25.263238972 +0100
@@ -8347,7 +8347,12 @@ read_common_block (struct die_info *die,
--- gdb-7.4.50.20120602.orig/gdb/dwarf2read.c 2012-06-02 19:14:38.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/dwarf2read.c 2012-06-02 19:51:29.977252338 +0200
@@ -9746,7 +9746,12 @@ read_common_block (struct die_info *die,
{
struct attribute *attr;
struct symbol *sym;
@ -16,7 +16,7 @@ Index: gdb-7.4.50.20111218/gdb/dwarf2read.c
attr = dwarf2_attr (die, DW_AT_location, cu);
if (attr)
@@ -8356,6 +8361,7 @@ read_common_block (struct die_info *die,
@@ -9755,6 +9760,7 @@ read_common_block (struct die_info *die,
if (attr_form_is_block (attr))
{
base = decode_locdesc (DW_BLOCK (attr), cu);
@ -24,7 +24,7 @@ Index: gdb-7.4.50.20111218/gdb/dwarf2read.c
}
else if (attr_form_is_section_offset (attr))
{
@@ -8408,12 +8414,15 @@ read_common_block (struct die_info *die,
@@ -9807,12 +9813,15 @@ read_common_block (struct die_info *die,
if (sym != NULL
&& handle_data_member_location (child_die, cu, &offset))
{
@ -42,7 +42,7 @@ Index: gdb-7.4.50.20111218/gdb/dwarf2read.c
else
SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym));
FIELD_TYPE (*field) = SYMBOL_TYPE (sym);
@@ -8427,7 +8436,7 @@ read_common_block (struct die_info *die,
@@ -9826,7 +9835,7 @@ read_common_block (struct die_info *die,
sym = new_symbol (die, type, cu);
/* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static. */
@ -51,19 +51,19 @@ Index: gdb-7.4.50.20111218/gdb/dwarf2read.c
set_die_type (die, type, cu);
}
Index: gdb-7.4.50.20111218/gdb/gdbtypes.h
Index: gdb-7.4.50.20120602/gdb/gdbtypes.h
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/gdbtypes.h 2011-12-18 23:35:23.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/gdbtypes.h 2011-12-19 01:34:21.448025620 +0100
@@ -396,6 +396,7 @@ enum type_instance_flag_value
enum field_loc_kind
--- gdb-7.4.50.20120602.orig/gdb/gdbtypes.h 2012-06-02 19:11:54.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/gdbtypes.h 2012-06-02 19:52:44.990230200 +0200
@@ -401,6 +401,7 @@ enum field_loc_kind
{
FIELD_LOC_KIND_BITPOS, /* bitpos */
FIELD_LOC_KIND_ENUMVAL, /* enumval */
+ /* This address is unrelocated by the objfile's ANOFFSET. */
FIELD_LOC_KIND_PHYSADDR, /* physaddr */
FIELD_LOC_KIND_PHYSNAME, /* physname */
FIELD_LOC_KIND_DWARF_BLOCK /* dwarf_block */
@@ -581,6 +582,7 @@ struct main_type
@@ -595,6 +596,7 @@ struct main_type
is the location (in the target) of the static field.
Otherwise, physname is the mangled label of the static field. */
@ -71,15 +71,15 @@ Index: gdb-7.4.50.20111218/gdb/gdbtypes.h
CORE_ADDR physaddr;
const char *physname;
@@ -1194,6 +1196,7 @@ extern void allocate_gnat_aux_type (stru
#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
#define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
@@ -1200,6 +1202,7 @@ extern void allocate_gnat_aux_type (stru
#define FIELD_ENUMVAL_LVAL(thisfld) ((thisfld).loc.enumval)
#define FIELD_ENUMVAL(thisfld) (FIELD_ENUMVAL_LVAL (thisfld) + 0)
#define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
+/* This address is unrelocated by the objfile's ANOFFSET. */
#define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
#define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block)
#define SET_FIELD_BITPOS(thisfld, bitpos) \
@@ -1202,6 +1205,7 @@ extern void allocate_gnat_aux_type (stru
@@ -1211,6 +1214,7 @@ extern void allocate_gnat_aux_type (stru
#define SET_FIELD_PHYSNAME(thisfld, name) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \
FIELD_STATIC_PHYSNAME (thisfld) = (name))
@ -87,19 +87,19 @@ Index: gdb-7.4.50.20111218/gdb/gdbtypes.h
#define SET_FIELD_PHYSADDR(thisfld, addr) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \
FIELD_STATIC_PHYSADDR (thisfld) = (addr))
@@ -1217,6 +1221,7 @@ extern void allocate_gnat_aux_type (stru
#define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n))
@@ -1227,6 +1231,7 @@ extern void allocate_gnat_aux_type (stru
#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
+/* This address is unrelocated by the objfile's ANOFFSET. */
#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
Index: gdb-7.4.50.20111218/gdb/jv-lang.c
Index: gdb-7.4.50.20120602/gdb/jv-lang.c
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/jv-lang.c 2011-12-06 19:54:39.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/jv-lang.c 2011-12-19 01:33:25.280238908 +0100
@@ -430,7 +430,8 @@ java_link_class_type (struct gdbarch *gd
--- gdb-7.4.50.20120602.orig/gdb/jv-lang.c 2012-05-10 21:59:12.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/jv-lang.c 2012-06-02 19:51:53.286245280 +0200
@@ -431,7 +431,8 @@ java_link_class_type (struct gdbarch *gd
fields = NULL;
nfields--; /* First set up dummy "class" field. */
@ -109,7 +109,7 @@ Index: gdb-7.4.50.20111218/gdb/jv-lang.c
TYPE_FIELD_NAME (type, nfields) = "class";
TYPE_FIELD_TYPE (type, nfields) = value_type (clas);
SET_TYPE_FIELD_PRIVATE (type, nfields);
@@ -478,7 +479,8 @@ java_link_class_type (struct gdbarch *gd
@@ -479,7 +480,8 @@ java_link_class_type (struct gdbarch *gd
SET_TYPE_FIELD_PROTECTED (type, i);
}
if (accflags & 0x0008) /* ACC_STATIC */
@ -117,13 +117,13 @@ Index: gdb-7.4.50.20111218/gdb/jv-lang.c
+ SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset
+ - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
else
TYPE_FIELD_BITPOS (type, i) = 8 * boffset;
SET_FIELD_BITPOS (TYPE_FIELD (type, i), 8 * boffset);
if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */
Index: gdb-7.4.50.20111218/gdb/value.c
Index: gdb-7.4.50.20120602/gdb/value.c
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/value.c 2011-12-18 23:35:23.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/value.c 2011-12-19 01:33:25.283238896 +0100
@@ -2481,7 +2481,8 @@ value_static_field (struct type *type, i
--- gdb-7.4.50.20120602.orig/gdb/value.c 2012-06-02 19:11:55.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/value.c 2012-06-02 19:51:30.031252317 +0200
@@ -2592,7 +2592,8 @@ value_static_field (struct type *type, i
{
case FIELD_LOC_KIND_PHYSADDR:
retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),

View File

@ -1,34 +0,0 @@
commit a999ae2c722b366b94987941f0ce899f95e8d679
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Fri Mar 2 22:08:49 2012 +0100
Fix crash for gdb.fortran/dynamic.exp with gcc-gfortran-4.1.2-51.el5.x86_64.
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1037,7 +1037,8 @@ int
value_fetch_lazy (struct value *val)
{
gdb_assert (value_lazy (val));
- allocate_value_contents (val);
+ if (VALUE_LVAL (val) != lval_memory)
+ allocate_value_contents (val);
if (value_bitsize (val))
{
/* To read a lazy bitfield, read the entire enclosing value. This
@@ -1080,11 +1081,15 @@ value_fetch_lazy (struct value *val)
if (length)
{
+ /* Delay it after object_address_get_data above. */
+ allocate_value_contents (val);
addr += value_offset (val);
read_value_memory (val, 0, value_stack (val),
addr, value_contents_all_raw (val), length);
}
}
+ /* Just to be sure it has been called. */
+ allocate_value_contents (val);
}
else if (VALUE_LVAL (val) == lval_register)
{

File diff suppressed because it is too large Load Diff

View File

@ -1,88 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-02/msg00180.html
### src/gdb/gdbserver/ChangeLog 2012/02/25 19:54:50 1.556
### src/gdb/gdbserver/ChangeLog 2012/02/27 16:19:19 1.557
## -1,3 +1,9 @@
+2012-02-27 Pedro Alves <palves@redhat.com>
+
+ PR server/9684
+ * linux-low.c (pid_is_stopped): New.
+ (linux_attach_lwp_1): Handle attaching to 'T (stopped)' processes.
+
2012-02-25 Luis Machado <lgustavo@codesourcery.com>
* mem-break.c (clear_gdb_breakpoint_conditions): Fix de-allocation
--- src/gdb/gdbserver/linux-low.c 2012/02/24 15:15:56 1.193
+++ src/gdb/gdbserver/linux-low.c 2012/02/27 16:19:19 1.194
@@ -598,6 +598,37 @@
return pid;
}
+/* Detect `T (stopped)' in `/proc/PID/status'.
+ Other states including `T (tracing stop)' are reported as false. */
+
+static int
+pid_is_stopped (pid_t pid)
+{
+ FILE *status_file;
+ char buf[100];
+ int retval = 0;
+
+ snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
+ status_file = fopen (buf, "r");
+ if (status_file != NULL)
+ {
+ int have_state = 0;
+
+ while (fgets (buf, sizeof (buf), status_file))
+ {
+ if (strncmp (buf, "State:", 6) == 0)
+ {
+ have_state = 1;
+ break;
+ }
+ }
+ if (have_state && strstr (buf, "T (stopped)") != NULL)
+ retval = 1;
+ fclose (status_file);
+ }
+ return retval;
+}
+
/* Attach to an inferior process. */
static void
@@ -643,6 +674,33 @@
ptrace call on this LWP. */
new_lwp->must_set_ptrace_flags = 1;
+ if (pid_is_stopped (lwpid))
+ {
+ if (debug_threads)
+ fprintf (stderr,
+ "Attached to a stopped process\n");
+
+ /* The process is definitely stopped. It is in a job control
+ stop, unless the kernel predates the TASK_STOPPED /
+ TASK_TRACED distinction, in which case it might be in a
+ ptrace stop. Make sure it is in a ptrace stop; from there we
+ can kill it, signal it, et cetera.
+
+ First make sure there is a pending SIGSTOP. Since we are
+ already attached, the process can not transition from stopped
+ to running without a PTRACE_CONT; so we know this signal will
+ go into the queue. The SIGSTOP generated by PTRACE_ATTACH is
+ probably already in the queue (unless this kernel is old
+ enough to use TASK_STOPPED for ptrace stops); but since
+ SIGSTOP is not an RT signal, it can only be queued once. */
+ kill_lwp (lwpid, SIGSTOP);
+
+ /* Finally, resume the stopped process. This will deliver the
+ SIGSTOP (or a higher priority signal, just like normal
+ PTRACE_ATTACH), which we'll catch later on. */
+ ptrace (PTRACE_CONT, lwpid, 0, 0);
+ }
+
/* The next time we wait for this LWP we'll see a SIGSTOP as PTRACE_ATTACH
brings it to a halt.

View File

@ -1,178 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-02/msg00181.html
### src/gdb/ChangeLog 2012/02/24 23:48:37 1.13869
### src/gdb/ChangeLog 2012/02/27 16:22:06 1.13870
## -1,3 +1,13 @@
+2012-02-27 Pedro Alves <palves@redhat.com>
+
+ * linux-nat.c (pid_is_stopped): Delete, moved to common/.
+ (linux_nat_post_attach_wait): Adjust to use
+ linux_proc_pid_is_stopped.
+ * common/linux-procfs.h (linux_proc_pid_is_stopped): Declare.
+ * common/linux-procfs.c (linux_proc_pid_is_stopped): New function,
+ based on pid_is_stopped from both linux-nat.c and
+ gdbserver/linux-low.c, and renamed.
+
2012-02-24 Maciej W. Rozycki <macro@codesourcery.com>
* remote.c (remote_watchpoint_addr_within_range): New function.
--- src/gdb/linux-nat.c 2012/02/16 21:07:20 1.239
+++ src/gdb/linux-nat.c 2012/02/27 16:22:13 1.240
@@ -1356,37 +1356,6 @@
delete_lwp (lp->ptid);
}
-/* Detect `T (stopped)' in `/proc/PID/status'.
- Other states including `T (tracing stop)' are reported as false. */
-
-static int
-pid_is_stopped (pid_t pid)
-{
- FILE *status_file;
- char buf[100];
- int retval = 0;
-
- snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
- status_file = fopen (buf, "r");
- if (status_file != NULL)
- {
- int have_state = 0;
-
- while (fgets (buf, sizeof (buf), status_file))
- {
- if (strncmp (buf, "State:", 6) == 0)
- {
- have_state = 1;
- break;
- }
- }
- if (have_state && strstr (buf, "T (stopped)") != NULL)
- retval = 1;
- fclose (status_file);
- }
- return retval;
-}
-
/* Wait for the LWP specified by LP, which we have just attached to.
Returns a wait status for that LWP, to cache. */
@@ -1397,7 +1366,7 @@
pid_t new_pid, pid = GET_LWP (ptid);
int status;
- if (pid_is_stopped (pid))
+ if (linux_proc_pid_is_stopped (pid))
{
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
--- src/gdb/common/linux-procfs.c 2012/01/04 08:17:18 1.2
+++ src/gdb/common/linux-procfs.c 2012/02/27 16:22:14 1.3
@@ -53,3 +53,34 @@
return tgid;
}
+
+/* Detect `T (stopped)' in `/proc/PID/status'.
+ Other states including `T (tracing stop)' are reported as false. */
+
+int
+linux_proc_pid_is_stopped (pid_t pid)
+{
+ FILE *status_file;
+ char buf[100];
+ int retval = 0;
+
+ snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
+ status_file = fopen (buf, "r");
+ if (status_file != NULL)
+ {
+ int have_state = 0;
+
+ while (fgets (buf, sizeof (buf), status_file))
+ {
+ if (strncmp (buf, "State:", 6) == 0)
+ {
+ have_state = 1;
+ break;
+ }
+ }
+ if (have_state && strstr (buf, "T (stopped)") != NULL)
+ retval = 1;
+ fclose (status_file);
+ }
+ return retval;
+}
--- src/gdb/common/linux-procfs.h 2012/01/04 08:17:18 1.2
+++ src/gdb/common/linux-procfs.h 2012/02/27 16:22:15 1.3
@@ -26,4 +26,9 @@
extern int linux_proc_get_tgid (int lwpid);
+/* Detect `T (stopped)' in `/proc/PID/status'.
+ Other states including `T (tracing stop)' are reported as false. */
+
+extern int linux_proc_pid_is_stopped (pid_t pid);
+
#endif /* COMMON_LINUX_PROCFS_H */
### src/gdb/gdbserver/ChangeLog 2012/02/27 16:19:19 1.557
### src/gdb/gdbserver/ChangeLog 2012/02/27 16:22:15 1.558
## -1,5 +1,10 @@
2012-02-27 Pedro Alves <palves@redhat.com>
+ * linux-low.c (pid_is_stopped): Delete, moved to common/.
+ (linux_attach_lwp_1): Adjust to use linux_proc_pid_is_stopped.
+
+2012-02-27 Pedro Alves <palves@redhat.com>
+
PR server/9684
* linux-low.c (pid_is_stopped): New.
(linux_attach_lwp_1): Handle attaching to 'T (stopped)' processes.
--- src/gdb/gdbserver/linux-low.c 2012/02/27 16:19:19 1.194
+++ src/gdb/gdbserver/linux-low.c 2012/02/27 16:22:16 1.195
@@ -598,37 +598,6 @@
return pid;
}
-/* Detect `T (stopped)' in `/proc/PID/status'.
- Other states including `T (tracing stop)' are reported as false. */
-
-static int
-pid_is_stopped (pid_t pid)
-{
- FILE *status_file;
- char buf[100];
- int retval = 0;
-
- snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
- status_file = fopen (buf, "r");
- if (status_file != NULL)
- {
- int have_state = 0;
-
- while (fgets (buf, sizeof (buf), status_file))
- {
- if (strncmp (buf, "State:", 6) == 0)
- {
- have_state = 1;
- break;
- }
- }
- if (have_state && strstr (buf, "T (stopped)") != NULL)
- retval = 1;
- fclose (status_file);
- }
- return retval;
-}
-
/* Attach to an inferior process. */
static void
@@ -674,7 +643,7 @@
ptrace call on this LWP. */
new_lwp->must_set_ptrace_flags = 1;
- if (pid_is_stopped (lwpid))
+ if (linux_proc_pid_is_stopped (lwpid))
{
if (debug_threads)
fprintf (stderr,

View File

@ -1,583 +0,0 @@
http://sourceware.org/ml/gdb-patches/2012-03/msg00169.html
Subject: [patch 1/3] attach-fail-reasons: Reshuffle code
Hi,
this patch does not make sense on its own but it contains all the
uninteresting code moves / reconfigurations.
Thanks,
Jan
gdb/
2012-03-06 Jan Kratochvil <jan.kratochvil@redhat.com>
* Makefile.in (linux-ptrace.o): New.
* common/linux-procfs.c (linux_proc_pid_is_zombie): New,
from linux-nat.c.
* common/linux-procfs.h (linux_proc_pid_is_zombie): New declaration.
* common/linux-ptrace.c: New file.
* config/alpha/alpha-linux.mh (NATDEPFILES): Add linux-ptrace.o.
* config/arm/linux.mh: Likewise.
* config/i386/linux.mh: Likewise.
* config/i386/linux64.mh: Likewise.
* config/ia64/linux.mh: Likewise.
* config/m32r/linux.mh: Likewise.
* config/m68k/linux.mh: Likewise.
* config/mips/linux.mh: Likewise.
* config/pa/linux.mh: Likewise.
* config/powerpc/linux.mh: Likewise.
* config/powerpc/ppc64-linux.mh: Likewise.
* config/powerpc/spu-linux.mh: Likewise.
* config/s390/s390.mh: Likewise.
* config/sparc/linux.mh: Likewise.
* config/sparc/linux64.mh: Likewise.
* config/xtensa/linux.mh: Likewise.
* linux-nat.c (linux_lwp_is_zombie): Remove, move it to
common/linux-procfs.c.
(wait_lwp): Rename linux_lwp_is_zombie to linux_proc_pid_is_zombie.
gdb/gdbserver/
2012-03-06 Jan Kratochvil <jan.kratochvil@redhat.com>
* Makefile.in (linux-ptrace.o): New.
* configure.srv (arm*-*-linux*, bfin-*-*linux*, crisv32-*-linux*)
(cris-*-linux*, i[34567]86-*-linux*, ia64-*-linux*, m32r*-*-linux*)
(m68*-*-linux*, m68*-*-uclinux*, mips*-*-linux*, powerpc*-*-linux*)
(s390*-*-linux*, sh*-*-linux*, sparc*-*-linux*, tic6x-*-uclinux)
(x86_64-*-linux*, xtensa*-*-linux*): Add linux-ptrace.o to SRV_TGTOBJ
of these targets.
* linux-low.c (linux_attach_lwp_1): Remove redundent else clause.
Index: gdb-7.4.50.20120120/gdb/Makefile.in
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/Makefile.in 2012-03-06 07:39:41.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/Makefile.in 2012-03-06 07:39:50.771713128 +0100
@@ -1968,6 +1968,10 @@ linux-procfs.o: $(srcdir)/common/linux-p
$(COMPILE) $(srcdir)/common/linux-procfs.c
$(POSTCOMPILE)
+linux-ptrace.o: $(srcdir)/common/linux-ptrace.c
+ $(COMPILE) $(srcdir)/common/linux-ptrace.c
+ $(POSTCOMPILE)
+
#
# gdb/tui/ dependencies
#
Index: gdb-7.4.50.20120120/gdb/common/linux-procfs.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/common/linux-procfs.c 2012-03-06 07:39:41.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/common/linux-procfs.c 2012-03-06 07:39:50.771713128 +0100
@@ -84,3 +84,34 @@ linux_proc_pid_is_stopped (pid_t pid)
}
return retval;
}
+
+/* See linux-procfs.h declaration. */
+
+int
+linux_proc_pid_is_zombie (pid_t pid)
+{
+ char buffer[100];
+ FILE *procfile;
+ int retval;
+ int have_state;
+
+ xsnprintf (buffer, sizeof (buffer), "/proc/%d/status", (int) pid);
+ procfile = fopen (buffer, "r");
+ if (procfile == NULL)
+ {
+ warning (_("unable to open /proc file '%s'"), buffer);
+ return 0;
+ }
+
+ have_state = 0;
+ while (fgets (buffer, sizeof (buffer), procfile) != NULL)
+ if (strncmp (buffer, "State:", 6) == 0)
+ {
+ have_state = 1;
+ break;
+ }
+ retval = (have_state
+ && strcmp (buffer, "State:\tZ (zombie)\n") == 0);
+ fclose (procfile);
+ return retval;
+}
Index: gdb-7.4.50.20120120/gdb/common/linux-procfs.h
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/common/linux-procfs.h 2012-03-06 07:39:41.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/common/linux-procfs.h 2012-03-06 07:39:50.771713128 +0100
@@ -31,4 +31,8 @@ extern int linux_proc_get_tgid (int lwpi
extern int linux_proc_pid_is_stopped (pid_t pid);
+/* Return non-zero if PID is a zombie. */
+
+extern int linux_proc_pid_is_zombie (pid_t pid);
+
#endif /* COMMON_LINUX_PROCFS_H */
Index: gdb-7.4.50.20120120/gdb/common/linux-ptrace.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20120120/gdb/common/linux-ptrace.c 2012-03-06 07:39:50.771713128 +0100
@@ -0,0 +1,26 @@
+/* Linux-specific ptrace manipulation routines.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef GDBSERVER
+#include "server.h"
+#else
+#include "defs.h"
+#include "gdb_string.h"
+#endif
+
+#include "linux-ptrace.h"
Index: gdb-7.4.50.20120120/gdb/config/alpha/alpha-linux.mh
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/config/alpha/alpha-linux.mh 2012-01-10 17:30:44.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/config/alpha/alpha-linux.mh 2012-03-06 07:39:50.771713128 +0100
@@ -2,7 +2,7 @@
NAT_FILE= config/nm-linux.h
NATDEPFILES= inf-ptrace.o alpha-linux-nat.o \
fork-child.o proc-service.o linux-thread-db.o \
- linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
+ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
NAT_CDEPS = $(srcdir)/proc-service.list
# The dynamically loaded libthread_db needs access to symbols in the
Index: gdb-7.4.50.20120120/gdb/config/arm/linux.mh
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/config/arm/linux.mh 2011-08-24 14:07:25.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/config/arm/linux.mh 2012-03-06 07:39:50.772713125 +0100
@@ -3,7 +3,7 @@
NAT_FILE= config/nm-linux.h
NATDEPFILES= inf-ptrace.o fork-child.o arm-linux-nat.o \
proc-service.o linux-thread-db.o \
- linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
+ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
NAT_CDEPS = $(srcdir)/proc-service.list
LOADLIBES= -ldl $(RDYNAMIC)
Index: gdb-7.4.50.20120120/gdb/config/i386/linux.mh
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/config/i386/linux.mh 2012-03-06 07:39:41.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/config/i386/linux.mh 2012-03-06 07:39:50.772713125 +0100
@@ -4,7 +4,7 @@ NAT_FILE= nm-linux.h
NATDEPFILES= inf-ptrace.o fork-child.o \
i386-nat.o i386-linux-nat.o \
proc-service.o linux-thread-db.o \
- linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
+ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
NAT_CDEPS = $(srcdir)/proc-service.list
# The dynamically loaded libthread_db needs access to symbols in the
Index: gdb-7.4.50.20120120/gdb/config/i386/linux64.mh
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/config/i386/linux64.mh 2012-03-06 07:39:41.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/config/i386/linux64.mh 2012-03-06 07:39:50.772713125 +0100
@@ -3,7 +3,7 @@ NATDEPFILES= inf-ptrace.o fork-child.o \
i386-nat.o amd64-nat.o amd64-linux-nat.o \
linux-nat.o linux-osdata.o \
proc-service.o linux-thread-db.o linux-fork.o \
- linux-procfs.o
+ linux-procfs.o linux-ptrace.o
NAT_FILE= nm-linux64.h
NAT_CDEPS = $(srcdir)/proc-service.list
Index: gdb-7.4.50.20120120/gdb/config/ia64/linux.mh
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/config/ia64/linux.mh 2012-01-10 17:30:44.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/config/ia64/linux.mh 2012-03-06 07:39:50.772713125 +0100
@@ -5,7 +5,7 @@ NATDEPFILES= inf-ptrace.o fork-child.o \
core-regset.o ia64-linux-nat.o \
proc-service.o linux-thread-db.o \
linux-nat.o linux-osdata.o linux-fork.o \
- linux-procfs.o
+ linux-procfs.o linux-ptrace.o
NAT_CDEPS = $(srcdir)/proc-service.list
LOADLIBES = -ldl $(RDYNAMIC)
Index: gdb-7.4.50.20120120/gdb/config/m32r/linux.mh
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/config/m32r/linux.mh 2012-01-10 17:30:44.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/config/m32r/linux.mh 2012-03-06 07:39:50.773713122 +0100
@@ -3,7 +3,7 @@
NAT_FILE= config/nm-linux.h
NATDEPFILES= inf-ptrace.o fork-child.o \
m32r-linux-nat.o proc-service.o linux-thread-db.o \
- linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
+ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
NAT_CDEPS = $(srcdir)/proc-service.list
LOADLIBES= -ldl $(RDYNAMIC)
Index: gdb-7.4.50.20120120/gdb/config/m68k/linux.mh
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/config/m68k/linux.mh 2012-01-10 17:30:45.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/config/m68k/linux.mh 2012-03-06 07:39:50.773713122 +0100
@@ -4,7 +4,7 @@ NAT_FILE= config/nm-linux.h
NATDEPFILES= inf-ptrace.o fork-child.o \
m68klinux-nat.o \
proc-service.o linux-thread-db.o \
- linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
+ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
NAT_CDEPS = $(srcdir)/proc-service.list
# The dynamically loaded libthread_db needs access to symbols in the
Index: gdb-7.4.50.20120120/gdb/config/mips/linux.mh
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/config/mips/linux.mh 2011-08-24 14:07:26.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/config/mips/linux.mh 2012-03-06 07:39:50.773713122 +0100
@@ -3,7 +3,7 @@ NAT_FILE= config/nm-linux.h
NATDEPFILES= inf-ptrace.o fork-child.o mips-linux-nat.o \
linux-thread-db.o proc-service.o \
linux-nat.o linux-osdata.o linux-fork.o \
- linux-procfs.o
+ linux-procfs.o linux-ptrace.o
NAT_CDEPS = $(srcdir)/proc-service.list
LOADLIBES = -ldl $(RDYNAMIC)
Index: gdb-7.4.50.20120120/gdb/config/pa/linux.mh
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/config/pa/linux.mh 2012-01-10 17:30:45.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/config/pa/linux.mh 2012-03-06 07:39:50.773713122 +0100
@@ -3,7 +3,7 @@ NAT_FILE= config/nm-linux.h
NATDEPFILES= inf-ptrace.o fork-child.o \
hppa-linux-nat.o proc-service.o linux-thread-db.o \
linux-nat.o linux-osdata.o linux-fork.o \
- linux-procfs.o
+ linux-procfs.o linux-ptrace.o
NAT_CDEPS = $(srcdir)/proc-service.list
LOADLIBES = -ldl $(RDYNAMIC)
Index: gdb-7.4.50.20120120/gdb/config/powerpc/linux.mh
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/config/powerpc/linux.mh 2011-08-24 14:07:27.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/config/powerpc/linux.mh 2012-03-06 07:39:50.773713122 +0100
@@ -5,7 +5,7 @@ XM_CLIBS=
NAT_FILE= config/nm-linux.h
NATDEPFILES= inf-ptrace.o fork-child.o \
ppc-linux-nat.o proc-service.o linux-thread-db.o \
- linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
+ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
NAT_CDEPS = $(srcdir)/proc-service.list
LOADLIBES = -ldl $(RDYNAMIC)
Index: gdb-7.4.50.20120120/gdb/config/powerpc/ppc64-linux.mh
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/config/powerpc/ppc64-linux.mh 2011-08-24 14:07:27.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/config/powerpc/ppc64-linux.mh 2012-03-06 07:39:50.774713118 +0100
@@ -5,7 +5,7 @@ XM_CLIBS=
NAT_FILE= config/nm-linux.h
NATDEPFILES= inf-ptrace.o fork-child.o \
ppc-linux-nat.o proc-service.o linux-thread-db.o \
- linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
+ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
NAT_CDEPS = $(srcdir)/proc-service.list
# The PowerPC has severe limitations on TOC size, and uses them even
Index: gdb-7.4.50.20120120/gdb/config/powerpc/spu-linux.mh
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/config/powerpc/spu-linux.mh 2011-08-24 14:07:27.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/config/powerpc/spu-linux.mh 2012-03-06 07:39:50.774713118 +0100
@@ -4,5 +4,5 @@
# PPU side of the Cell BE and debugging the SPU side.
NATDEPFILES = spu-linux-nat.o fork-child.o inf-ptrace.o \
- linux-procfs.o
+ linux-procfs.o linux-ptrace.o
Index: gdb-7.4.50.20120120/gdb/config/s390/s390.mh
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/config/s390/s390.mh 2012-01-05 18:07:05.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/config/s390/s390.mh 2012-03-06 07:39:50.774713118 +0100
@@ -2,6 +2,6 @@
NAT_FILE= config/nm-linux.h
NATDEPFILES= inf-ptrace.o fork-child.o s390-nat.o \
linux-thread-db.o proc-service.o \
- linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
+ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
NAT_CDEPS = $(srcdir)/proc-service.list
LOADLIBES = -ldl $(RDYNAMIC)
Index: gdb-7.4.50.20120120/gdb/config/sparc/linux.mh
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/config/sparc/linux.mh 2012-01-10 17:30:49.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/config/sparc/linux.mh 2012-03-06 07:39:50.774713118 +0100
@@ -4,7 +4,7 @@ NATDEPFILES= sparc-nat.o sparc-linux-nat
core-regset.o fork-child.o inf-ptrace.o \
proc-service.o linux-thread-db.o \
linux-nat.o linux-osdata.o linux-fork.o \
- linux-procfs.o
+ linux-procfs.o linux-ptrace.o
NAT_CDEPS = $(srcdir)/proc-service.list
# The dynamically loaded libthread_db needs access to symbols in the
Index: gdb-7.4.50.20120120/gdb/config/sparc/linux64.mh
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/config/sparc/linux64.mh 2012-01-10 17:30:49.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/config/sparc/linux64.mh 2012-03-06 07:39:50.775713114 +0100
@@ -5,7 +5,7 @@ NATDEPFILES= sparc-nat.o sparc64-nat.o s
fork-child.o inf-ptrace.o \
proc-service.o linux-thread-db.o \
linux-nat.o linux-osdata.o linux-fork.o \
- linux-procfs.o
+ linux-procfs.o linux-ptrace.o
NAT_CDEPS = $(srcdir)/proc-service.list
# The dynamically loaded libthread_db needs access to symbols in the
Index: gdb-7.4.50.20120120/gdb/config/xtensa/linux.mh
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/config/xtensa/linux.mh 2011-08-24 14:07:27.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/config/xtensa/linux.mh 2012-03-06 07:39:50.775713114 +0100
@@ -4,7 +4,7 @@ NAT_FILE= config/nm-linux.h
NATDEPFILES= inf-ptrace.o fork-child.o xtensa-linux-nat.o \
linux-thread-db.o proc-service.o \
- linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
+ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
NAT_CDEPS = $(srcdir)/proc-service.list
LOADLIBES = -ldl $(RDYNAMIC)
Index: gdb-7.4.50.20120120/gdb/gdbserver/Makefile.in
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/gdbserver/Makefile.in 2012-01-04 09:17:23.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/gdbserver/Makefile.in 2012-03-06 07:39:50.775713114 +0100
@@ -408,6 +408,9 @@ signals.o: ../common/signals.c $(server_
linux-procfs.o: ../common/linux-procfs.c $(server_h)
$(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER
+linux-ptrace.o: ../common/linux-ptrace.c $(server_h)
+ $(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER
+
common-utils.o: ../common/common-utils.c $(server_h)
$(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER
Index: gdb-7.4.50.20120120/gdb/gdbserver/configure.srv
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/gdbserver/configure.srv 2011-12-06 15:14:49.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/gdbserver/configure.srv 2012-03-06 07:39:50.775713114 +0100
@@ -47,6 +47,7 @@ case "${target}" in
srv_regobj="${srv_regobj} arm-with-vfpv3.o"
srv_regobj="${srv_regobj} arm-with-neon.o"
srv_tgtobj="linux-low.o linux-osdata.o linux-arm-low.o linux-procfs.o"
+ srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
srv_xmlfiles="arm-with-iwmmxt.xml"
srv_xmlfiles="${srv_xmlfiles} arm-with-vfpv2.xml"
srv_xmlfiles="${srv_xmlfiles} arm-with-vfpv3.xml"
@@ -69,16 +70,19 @@ case "${target}" in
;;
bfin-*-*linux*) srv_regobj=reg-bfin.o
srv_tgtobj="linux-low.o linux-osdata.o linux-bfin-low.o linux-procfs.o"
+ srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
srv_linux_usrregs=yes
srv_linux_thread_db=yes
;;
crisv32-*-linux*) srv_regobj=reg-crisv32.o
srv_tgtobj="linux-low.o linux-osdata.o linux-crisv32-low.o linux-procfs.o"
+ srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
srv_linux_regsets=yes
srv_linux_thread_db=yes
;;
cris-*-linux*) srv_regobj=reg-cris.o
srv_tgtobj="linux-low.o linux-osdata.o linux-cris-low.o linux-procfs.o"
+ srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
srv_linux_usrregs=yes
srv_linux_thread_db=yes
;;
@@ -93,6 +97,7 @@ case "${target}" in
srv_xmlfiles="${srv_xmlfiles} $srv_amd64_linux_xmlfiles"
fi
srv_tgtobj="linux-low.o linux-osdata.o linux-x86-low.o i386-low.o i387-fp.o linux-procfs.o"
+ srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
srv_linux_usrregs=yes
srv_linux_regsets=yes
srv_linux_thread_db=yes
@@ -124,10 +129,12 @@ case "${target}" in
;;
ia64-*-linux*) srv_regobj=reg-ia64.o
srv_tgtobj="linux-low.o linux-osdata.o linux-ia64-low.o linux-procfs.o"
+ srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
srv_linux_usrregs=yes
;;
m32r*-*-linux*) srv_regobj=reg-m32r.o
srv_tgtobj="linux-low.o linux-osdata.o linux-m32r-low.o linux-procfs.o"
+ srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
srv_linux_usrregs=yes
srv_linux_thread_db=yes
;;
@@ -137,6 +144,7 @@ case "${target}" in
srv_regobj=reg-m68k.o
fi
srv_tgtobj="linux-low.o linux-osdata.o linux-m68k-low.o linux-procfs.o"
+ srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
srv_linux_usrregs=yes
srv_linux_regsets=yes
srv_linux_thread_db=yes
@@ -147,12 +155,14 @@ case "${target}" in
srv_regobj=reg-m68k.o
fi
srv_tgtobj="linux-low.o linux-osdata.o linux-m68k-low.o linux-procfs.o"
+ srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
srv_linux_usrregs=yes
srv_linux_regsets=yes
srv_linux_thread_db=yes
;;
mips*-*-linux*) srv_regobj="mips-linux.o mips64-linux.o"
srv_tgtobj="linux-low.o linux-osdata.o linux-mips-low.o linux-procfs.o"
+ srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
srv_xmlfiles="mips-linux.xml"
srv_xmlfiles="${srv_xmlfiles} mips-cpu.xml"
srv_xmlfiles="${srv_xmlfiles} mips-cp0.xml"
@@ -181,6 +191,7 @@ case "${target}" in
srv_regobj="${srv_regobj} powerpc-isa205-altivec64l.o"
srv_regobj="${srv_regobj} powerpc-isa205-vsx64l.o"
srv_tgtobj="linux-low.o linux-osdata.o linux-ppc-low.o linux-procfs.o"
+ srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
srv_xmlfiles="rs6000/powerpc-32l.xml"
srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-altivec32l.xml"
srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-cell32l.xml"
@@ -223,6 +234,7 @@ case "${target}" in
srv_regobj="${srv_regobj} s390x-linux64v1.o"
srv_regobj="${srv_regobj} s390x-linux64v2.o"
srv_tgtobj="linux-low.o linux-osdata.o linux-s390-low.o linux-procfs.o"
+ srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
srv_xmlfiles="s390-linux32.xml"
srv_xmlfiles="${srv_xmlfiles} s390-linux32v1.xml"
srv_xmlfiles="${srv_xmlfiles} s390-linux32v2.xml"
@@ -243,12 +255,14 @@ case "${target}" in
;;
sh*-*-linux*) srv_regobj=reg-sh.o
srv_tgtobj="linux-low.o linux-osdata.o linux-sh-low.o linux-procfs.o"
+ srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
srv_linux_usrregs=yes
srv_linux_regsets=yes
srv_linux_thread_db=yes
;;
sparc*-*-linux*) srv_regobj=reg-sparc64.o
srv_tgtobj="linux-low.o linux-osdata.o linux-sparc-low.o linux-procfs.o"
+ srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
srv_linux_regsets=yes
srv_linux_thread_db=yes
;;
@@ -265,12 +279,14 @@ case "${target}" in
srv_xmlfiles="${srv_xmlfiles} tic6x-gp.xml"
srv_xmlfiles="${srv_xmlfiles} tic6x-c6xp.xml"
srv_tgtobj="linux-low.o linux-osdata.o linux-tic6x-low.o linux-procfs.o"
+ srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
srv_linux_regsets=yes
srv_linux_usrregs=yes
srv_linux_thread_db=yes
;;
x86_64-*-linux*) srv_regobj="$srv_amd64_linux_regobj $srv_i386_linux_regobj"
srv_tgtobj="linux-low.o linux-osdata.o linux-x86-low.o i386-low.o i387-fp.o linux-procfs.o"
+ srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
srv_xmlfiles="$srv_i386_linux_xmlfiles $srv_amd64_linux_xmlfiles"
srv_linux_usrregs=yes # This is for i386 progs.
srv_linux_regsets=yes
@@ -285,6 +301,7 @@ case "${target}" in
xtensa*-*-linux*) srv_regobj=reg-xtensa.o
srv_tgtobj="linux-low.o linux-osdata.o linux-xtensa-low.o linux-procfs.o"
+ srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
srv_linux_regsets=yes
;;
*) echo "Error: target not supported by gdbserver."
Index: gdb-7.4.50.20120120/gdb/gdbserver/linux-low.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/gdbserver/linux-low.c 2012-03-06 07:39:41.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/gdbserver/linux-low.c 2012-03-06 07:39:50.776713111 +0100
@@ -630,10 +630,10 @@ linux_attach_lwp_1 (unsigned long lwpid,
fflush (stderr);
return;
}
- else
- /* If we fail to attach to a process, report an error. */
- error ("Cannot attach to lwp %ld: %s (%d)\n", lwpid,
- strerror (errno), errno);
+
+ /* If we fail to attach to a process, report an error. */
+ error ("Cannot attach to lwp %ld: %s (%d)\n", lwpid,
+ strerror (errno), errno);
}
if (initial)
Index: gdb-7.4.50.20120120/gdb/linux-nat.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/linux-nat.c 2012-03-06 07:39:41.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/linux-nat.c 2012-03-06 07:39:50.777713108 +0100
@@ -2464,37 +2464,6 @@ linux_handle_extended_wait (struct lwp_i
_("unknown ptrace event %d"), event);
}
-/* Return non-zero if LWP is a zombie. */
-
-static int
-linux_lwp_is_zombie (long lwp)
-{
- char buffer[MAXPATHLEN];
- FILE *procfile;
- int retval;
- int have_state;
-
- xsnprintf (buffer, sizeof (buffer), "/proc/%ld/status", lwp);
- procfile = fopen (buffer, "r");
- if (procfile == NULL)
- {
- warning (_("unable to open /proc file '%s'"), buffer);
- return 0;
- }
-
- have_state = 0;
- while (fgets (buffer, sizeof (buffer), procfile) != NULL)
- if (strncmp (buffer, "State:", 6) == 0)
- {
- have_state = 1;
- break;
- }
- retval = (have_state
- && strcmp (buffer, "State:\tZ (zombie)\n") == 0);
- fclose (procfile);
- return retval;
-}
-
/* Wait for LP to stop. Returns the wait status, or 0 if the LWP has
exited. */
@@ -2548,10 +2517,10 @@ wait_lwp (struct lwp_info *lp)
This is racy, what if the tgl becomes a zombie right after we check?
Therefore always use WNOHANG with sigsuspend - it is equivalent to
- waiting waitpid but the linux_lwp_is_zombie is safe this way. */
+ waiting waitpid but linux_proc_pid_is_zombie is safe this way. */
if (GET_PID (lp->ptid) == GET_LWP (lp->ptid)
- && linux_lwp_is_zombie (GET_LWP (lp->ptid)))
+ && linux_proc_pid_is_zombie (GET_LWP (lp->ptid)))
{
thread_dead = 1;
if (debug_linux_nat)
@@ -3431,7 +3400,7 @@ check_zombie_leaders (void)
/* Check if there are other threads in the group, as we may
have raced with the inferior simply exiting. */
&& num_lwps (inf->pid) > 1
- && linux_lwp_is_zombie (inf->pid))
+ && linux_proc_pid_is_zombie (inf->pid))
{
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,

View File

@ -1,402 +0,0 @@
http://sourceware.org/ml/gdb-patches/2012-03/msg00170.html
Subject: [patch 2/3] attach-fail-reasons: Say more than ptrace: Operation not permitted.
Hi,
There is a common question on #gdb and also already described:
http://sourceware.org/gdb/wiki/FAQ
16. Getting an internal error or other error while attaching to processes on
GNU/Linux
->
Try setenforce 0 (SELinux) or echo 0 >/proc/sys/kernel/yama/ptrace_scope
(ptrace scope) to disable system security protections.
and here is a patch to give some explanations.
More reasons can be given later, this is a container for them and it contains
some useful ones already.
No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu and with
non-extended gdbserver.
The testcase does not test gdbserver, somehow it is a bit difficult without
having shell on target.
Attaching to process 27480
ptrace: Operation not permitted.
(gdb) _
->
Attaching to process 27480
warning: process 27480 is already traced by process 29011
ptrace: Operation not permitted.
(gdb) _
Thanks,
Jan
gdb/
2012-03-06 Jan Kratochvil <jan.kratochvil@redhat.com>
* common/linux-procfs.c (linux_proc_get_int): New, from
linux_proc_get_tgid.
(linux_proc_get_tgid): Only call linux_proc_get_int.
(linux_proc_get_tracerpid): New.
(linux_proc_pid_has_state): New, from linux_proc_pid_is_zombie.
(linux_proc_pid_is_stopped, linux_proc_pid_is_zombie): Only call
linux_proc_pid_has_state.
* common/linux-procfs.h (linux_proc_get_tracerpid): New declaration.
* common/linux-ptrace.c: Include linux-procfs.h.
(linux_ptrace_attach_warnings): New.
* common/linux-ptrace.h (linux_ptrace_attach_warnings): New declaration.
* linux-nat.c: Include exceptions.h and linux-ptrace.h.
(linux_nat_attach): New variable ex. Wrap to_attach by TRY_CATCH and
call linux_ptrace_attach_warnings.
gdb/gdbserver/
2012-03-06 Jan Kratochvil <jan.kratochvil@redhat.com>
* linux-low.c (linux_attach_lwp_1): Call linux_ptrace_attach_warnings.
gdb/testsuite/
2012-03-06 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/attach-twice.c: New files.
* gdb.base/attach-twice.exp: New files.
Index: gdb-7.4.50.20120120/gdb/common/linux-procfs.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/common/linux-procfs.c 2012-03-06 07:34:00.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/common/linux-procfs.c 2012-03-06 07:34:17.586816449 +0100
@@ -28,67 +28,54 @@
/* Return the TGID of LWPID from /proc/pid/status. Returns -1 if not
found. */
-int
-linux_proc_get_tgid (int lwpid)
+static int
+linux_proc_get_int (int lwpid, const char *field)
{
+ size_t field_len = strlen (field);
FILE *status_file;
char buf[100];
- int tgid = -1;
+ int retval = -1;
snprintf (buf, sizeof (buf), "/proc/%d/status", (int) lwpid);
status_file = fopen (buf, "r");
- if (status_file != NULL)
+ if (status_file == NULL)
{
- while (fgets (buf, sizeof (buf), status_file))
- {
- if (strncmp (buf, "Tgid:", 5) == 0)
- {
- tgid = strtoul (buf + strlen ("Tgid:"), NULL, 10);
- break;
- }
- }
-
- fclose (status_file);
+ warning (_("unable to open /proc file '%s'"), buf);
+ return -1;
}
- return tgid;
+ while (fgets (buf, sizeof (buf), status_file))
+ if (strncmp (buf, field, field_len) == 0 && buf[field_len] == ':')
+ {
+ retval = strtol (&buf[field_len + 1], NULL, 10);
+ break;
+ }
+
+ fclose (status_file);
+ return retval;
}
-/* Detect `T (stopped)' in `/proc/PID/status'.
- Other states including `T (tracing stop)' are reported as false. */
+/* Return the TGID of LWPID from /proc/pid/status. Returns -1 if not
+ found. */
int
-linux_proc_pid_is_stopped (pid_t pid)
+linux_proc_get_tgid (int lwpid)
{
- FILE *status_file;
- char buf[100];
- int retval = 0;
+ return linux_proc_get_int (lwpid, "Tgid");
+}
- snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
- status_file = fopen (buf, "r");
- if (status_file != NULL)
- {
- int have_state = 0;
+/* See linux-procfs.h. */
- while (fgets (buf, sizeof (buf), status_file))
- {
- if (strncmp (buf, "State:", 6) == 0)
- {
- have_state = 1;
- break;
- }
- }
- if (have_state && strstr (buf, "T (stopped)") != NULL)
- retval = 1;
- fclose (status_file);
- }
- return retval;
+pid_t
+linux_proc_get_tracerpid (int lwpid)
+{
+ return linux_proc_get_int (lwpid, "TracerPid");
}
-/* See linux-procfs.h declaration. */
+/* Return non-zero if 'State' of /proc/PID/status contains STATE. */
-int
-linux_proc_pid_is_zombie (pid_t pid)
+static int
+linux_proc_pid_has_state (pid_t pid, const char *state)
{
char buffer[100];
FILE *procfile;
@@ -110,8 +97,24 @@ linux_proc_pid_is_zombie (pid_t pid)
have_state = 1;
break;
}
- retval = (have_state
- && strcmp (buffer, "State:\tZ (zombie)\n") == 0);
+ retval = (have_state && strstr (buffer, state) != NULL);
fclose (procfile);
return retval;
}
+
+/* Detect `T (stopped)' in `/proc/PID/status'.
+ Other states including `T (tracing stop)' are reported as false. */
+
+int
+linux_proc_pid_is_stopped (pid_t pid)
+{
+ return linux_proc_pid_has_state (pid, "T (stopped)");
+}
+
+/* See linux-procfs.h declaration. */
+
+int
+linux_proc_pid_is_zombie (pid_t pid)
+{
+ return linux_proc_pid_has_state (pid, "Z (zombie)");
+}
Index: gdb-7.4.50.20120120/gdb/common/linux-procfs.h
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/common/linux-procfs.h 2012-03-06 07:34:00.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/common/linux-procfs.h 2012-03-06 07:34:17.586816449 +0100
@@ -26,6 +26,11 @@
extern int linux_proc_get_tgid (int lwpid);
+/* Return the TracerPid of LWPID from /proc/pid/status. Returns -1 if not
+ found. */
+
+extern pid_t linux_proc_get_tracerpid (int lwpid);
+
/* Detect `T (stopped)' in `/proc/PID/status'.
Other states including `T (tracing stop)' are reported as false. */
Index: gdb-7.4.50.20120120/gdb/common/linux-ptrace.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/common/linux-ptrace.c 2012-03-06 07:34:00.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/common/linux-ptrace.c 2012-03-06 07:34:17.586816449 +0100
@@ -24,3 +24,21 @@
#endif
#include "linux-ptrace.h"
+#include "linux-procfs.h"
+
+/* Print all possible reasons we could fail to attach PID. */
+
+void
+linux_ptrace_attach_warnings (pid_t pid)
+{
+ pid_t tracerpid;
+
+ tracerpid = linux_proc_get_tracerpid (pid);
+ if (tracerpid > 0)
+ warning (_("process %d is already traced by process %d"), (int) pid,
+ (int) tracerpid);
+
+ if (linux_proc_pid_is_zombie (pid))
+ warning (_("process %d is a zombie - the process has already terminated"),
+ (int) pid);
+}
Index: gdb-7.4.50.20120120/gdb/common/linux-ptrace.h
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/common/linux-ptrace.h 2012-01-04 09:17:18.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/common/linux-ptrace.h 2012-03-06 07:34:17.586816449 +0100
@@ -65,4 +65,6 @@
#define __WALL 0x40000000 /* Wait for any child. */
#endif
+extern void linux_ptrace_attach_warnings (pid_t pid);
+
#endif /* COMMON_LINUX_PTRACE_H */
Index: gdb-7.4.50.20120120/gdb/gdbserver/linux-low.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/gdbserver/linux-low.c 2012-03-06 07:34:00.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/gdbserver/linux-low.c 2012-03-06 07:34:17.587816446 +0100
@@ -632,6 +632,7 @@ linux_attach_lwp_1 (unsigned long lwpid,
}
/* If we fail to attach to a process, report an error. */
+ linux_ptrace_attach_warnings (lwpid);
error ("Cannot attach to lwp %ld: %s (%d)\n", lwpid,
strerror (errno), errno);
}
Index: gdb-7.4.50.20120120/gdb/linux-nat.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/linux-nat.c 2012-03-06 07:34:00.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/linux-nat.c 2012-03-06 07:34:29.860775803 +0100
@@ -59,6 +59,8 @@
#include "solib.h"
#include "linux-osdata.h"
#include "cli/cli-utils.h"
+#include "exceptions.h"
+#include "linux-ptrace.h"
#ifndef SPUFS_MAGIC
#define SPUFS_MAGIC 0x23c9b64e
@@ -1613,11 +1615,22 @@ linux_nat_attach (struct target_ops *ops
struct lwp_info *lp;
int status;
ptid_t ptid;
+ volatile struct gdb_exception ex;
/* Make sure we report all signals during attach. */
linux_nat_pass_signals (0, NULL);
- linux_ops->to_attach (ops, args, from_tty);
+ TRY_CATCH (ex, RETURN_MASK_ERROR)
+ {
+ linux_ops->to_attach (ops, args, from_tty);
+ }
+ if (ex.reason < 0)
+ {
+ pid_t pid = parse_pid_to_attach (args);
+
+ linux_ptrace_attach_warnings (pid);
+ throw_exception (ex);
+ }
/* The ptrace base target adds the main thread with (pid,0,0)
format. Decorate it with lwp info. */
Index: gdb-7.4.50.20120120/gdb/testsuite/gdb.base/attach-twice.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20120120/gdb/testsuite/gdb.base/attach-twice.c 2012-03-06 07:34:17.589816440 +0100
@@ -0,0 +1,42 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2011-2012 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/ptrace.h>
+#include <errno.h>
+
+int
+main (void)
+{
+ long l;
+
+ switch (fork ())
+ {
+ case -1:
+ perror ("fork");
+ exit (1);
+ case 0:
+ errno = 0;
+ ptrace (PTRACE_ATTACH, getppid (), NULL, NULL);
+ if (errno != 0)
+ perror ("PTRACE_ATTACH");
+ break;
+ }
+ sleep (600);
+ return 0;
+}
Index: gdb-7.4.50.20120120/gdb/testsuite/gdb.base/attach-twice.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20120120/gdb/testsuite/gdb.base/attach-twice.exp 2012-03-06 07:34:17.589816440 +0100
@@ -0,0 +1,52 @@
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Manipulation with PID on target is not supported.
+if [is_remote target] then {
+ return 0
+}
+
+set testfile attach-twice
+set executable ${testfile}
+set binfile ${objdir}/${subdir}/${executable}
+
+if { [prepare_for_testing ${testfile}.exp $executable] } {
+ return -1
+}
+
+set testpid [eval exec $binfile &]
+exec sleep 2
+
+set parentpid 0
+
+set test "attach"
+gdb_test_multiple "attach $testpid" $test {
+ -re "Attaching to program: \[^\r\n\]*, process $testpid\r\n.*warning: process $testpid is already traced by process (\[0-9\]+)\r\n.*ptrace: Operation not permitted\\.\r\n$gdb_prompt $" {
+ set parentpid $expect_out(1,string)
+ pass $test
+ }
+ -re "Attaching to program: \[^\r\n\]*, process $testpid\r\n.*ptrace: Operation not permitted\\.\r\n$gdb_prompt $" {
+ fail $test
+ }
+ -re "\r\n$gdb_prompt $" {
+ xfail $test
+ }
+}
+
+eval exec ps xfw
+if {$parentpid != 0} {
+ eval exec kill -9 $parentpid
+}
+eval exec kill -9 $testpid

View File

@ -37,53 +37,60 @@ gdb/gdbserver/
(linux_create_inferior, linux_tracefork_child): Call it instead of
direct ptrace.
--- a/gdb/common/linux-ptrace.c
+++ b/gdb/common/linux-ptrace.c
@@ -26,6 +26,10 @@
#include "linux-ptrace.h"
Index: gdb-7.4.50.20120602/gdb/common/linux-ptrace.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/common/linux-ptrace.c 2012-03-13 16:02:23.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/common/linux-ptrace.c 2012-06-02 20:37:53.933828570 +0200
@@ -27,6 +27,10 @@
#include "linux-procfs.h"
#include "buffer.h"
+#ifdef HAVE_SELINUX_SELINUX_H
+# include <selinux/selinux.h>
+#endif /* HAVE_SELINUX_SELINUX_H */
+
/* Print all possible reasons we could fail to attach PID. */
void
@@ -41,4 +45,21 @@ linux_ptrace_attach_warnings (pid_t pid)
if (linux_proc_pid_is_zombie (pid))
warning (_("process %d is a zombie - the process has already terminated"),
(int) pid);
/* Find all possible reasons we could fail to attach PID and append these
newline terminated reason strings to initialized BUFFER. '\0' termination
of BUFFER must be done by the caller. */
@@ -46,4 +50,22 @@ linux_ptrace_attach_warnings (pid_t pid,
buffer_xml_printf (buffer, _("warning: process %d is a zombie "
"- the process has already terminated\n"),
(int) pid);
+
+ linux_ptrace_create_warnings ();
+ linux_ptrace_create_warnings (buffer);
+}
+
+/* Print all possible reasons we could fail to create a traced process. */
+
+void
+linux_ptrace_create_warnings (void)
+linux_ptrace_create_warnings (struct buffer *buffer)
+{
+#ifdef HAVE_LIBSELINUX
+ /* -1 is returned for errors, 0 if it has no effect, 1 if PTRACE_ATTACH is
+ forbidden. */
+ if (security_get_boolean_active ("deny_ptrace") == 1)
+ warning (_("the SELinux boolean 'deny_ptrace' is enabled, "
+ "you can disable this process attach protection by: "
+ "(gdb) shell sudo setsebool deny_ptrace=0"));
+ buffer_xml_printf (buffer,
+ _("the SELinux boolean 'deny_ptrace' is enabled, "
+ "you can disable this process attach protection by: "
+ "(gdb) shell sudo setsebool deny_ptrace=0"));
+#endif /* HAVE_LIBSELINUX */
}
--- a/gdb/common/linux-ptrace.h
+++ b/gdb/common/linux-ptrace.h
@@ -66,5 +66,6 @@
Index: gdb-7.4.50.20120602/gdb/common/linux-ptrace.h
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/common/linux-ptrace.h 2012-03-13 16:02:23.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/common/linux-ptrace.h 2012-06-02 20:37:46.565831956 +0200
@@ -68,5 +68,6 @@ struct buffer;
#endif
extern void linux_ptrace_attach_warnings (pid_t pid);
+extern void linux_ptrace_create_warnings (void);
extern void linux_ptrace_attach_warnings (pid_t pid, struct buffer *buffer);
+extern void linux_ptrace_create_warnings (struct buffer *buffer);
#endif /* COMMON_LINUX_PTRACE_H */
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1748,6 +1748,10 @@ then
Index: gdb-7.4.50.20120602/gdb/configure.ac
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/configure.ac 2012-06-02 20:05:08.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/configure.ac 2012-06-02 20:35:06.379798726 +0200
@@ -2002,6 +2002,10 @@ then
[Define if you support the personality syscall.])
fi
@ -94,9 +101,11 @@ gdb/gdbserver/
dnl Handle optional features that can be enabled.
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -411,6 +411,10 @@ if $want_ipa ; then
Index: gdb-7.4.50.20120602/gdb/gdbserver/configure.ac
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/gdbserver/configure.ac 2012-04-19 21:34:51.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/gdbserver/configure.ac 2012-06-02 20:35:06.408797663 +0200
@@ -438,6 +438,10 @@ if $want_ipa ; then
fi
fi
@ -107,9 +116,11 @@ gdb/gdbserver/
AC_SUBST(GDBSERVER_DEPFILES)
AC_SUBST(GDBSERVER_LIBS)
AC_SUBST(USE_THREAD_DB)
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -550,6 +550,25 @@ add_lwp (ptid_t ptid)
Index: gdb-7.4.50.20120602/gdb/gdbserver/linux-low.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/gdbserver/linux-low.c 2012-05-30 21:51:38.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/gdbserver/linux-low.c 2012-06-02 20:39:49.886785355 +0200
@@ -601,6 +601,28 @@ add_lwp (ptid_t ptid)
return lwp;
}
@ -119,15 +130,18 @@ gdb/gdbserver/
+linux_traceme (const char *program)
+{
+ int save_errno;
+ struct buffer buffer;
+
+ errno = 0;
+ if (ptrace (PTRACE_TRACEME, 0, NULL, NULL) == 0)
+ return;
+
+ save_errno = errno;
+ linux_ptrace_create_warnings ();
+ fprintf (stderr, _("Cannot trace created process %s: %s.\n"), program,
+ strerror (save_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);
+}
@ -135,7 +149,7 @@ gdb/gdbserver/
/* Start an inferior process and returns its pid.
ALLARGS is a vector of program-name and args. */
@@ -590,7 +609,7 @@ linux_create_inferior (char *program, char **allargs)
@@ -641,7 +663,7 @@ linux_create_inferior (char *program, ch
if (pid == 0)
{
@ -144,7 +158,7 @@ gdb/gdbserver/
#ifndef __ANDROID__ /* Bionic doesn't use SIGRTMIN the way glibc does. */
signal (__SIGRTMIN + 1, SIG_DFL);
@@ -4386,7 +4405,7 @@ linux_tracefork_grandchild (void *arg)
@@ -4567,7 +4589,7 @@ linux_tracefork_grandchild (void *arg)
static int
linux_tracefork_child (void *arg)
{
@ -153,8 +167,10 @@ gdb/gdbserver/
kill (getpid (), SIGSTOP);
#if !(defined(__UCLIBC__) && defined(HAS_NOMMU))
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
Index: gdb-7.4.50.20120602/gdb/inf-ptrace.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/inf-ptrace.c 2012-05-24 18:51:34.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/inf-ptrace.c 2012-06-02 20:35:06.428797311 +0200
@@ -105,7 +105,15 @@ static void
inf_ptrace_me (void)
{
@ -171,9 +187,11 @@ gdb/gdbserver/
}
/* Start a new inferior Unix child process. EXEC_FILE is the file to
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1570,6 +1570,7 @@ linux_nat_create_inferior (struct target_ops *ops,
Index: gdb-7.4.50.20120602/gdb/linux-nat.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/linux-nat.c 2012-06-02 20:01:38.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/linux-nat.c 2012-06-02 20:41:18.101751186 +0200
@@ -1572,6 +1572,7 @@ linux_nat_create_inferior (struct target
#ifdef HAVE_PERSONALITY
int personality_orig = 0, personality_set = 0;
#endif /* HAVE_PERSONALITY */
@ -181,7 +199,7 @@ gdb/gdbserver/
/* The fork_child mechanism is synchronous and calls target_wait, so
we have to mask the async mode. */
@@ -1594,7 +1595,10 @@ linux_nat_create_inferior (struct target_ops *ops,
@@ -1596,7 +1597,10 @@ linux_nat_create_inferior (struct target
/* Make sure we report all signals during startup. */
linux_nat_pass_signals (0, NULL);
@ -193,17 +211,28 @@ gdb/gdbserver/
#ifdef HAVE_PERSONALITY
if (personality_set)
@@ -1606,6 +1610,12 @@ linux_nat_create_inferior (struct target_ops *ops,
@@ -1608,6 +1612,24 @@ linux_nat_create_inferior (struct target
safe_strerror (errno));
}
#endif /* HAVE_PERSONALITY */
+
+ if (ex.reason < 0)
+ {
+ linux_ptrace_create_warnings ();
+ throw_exception (ex);
+ 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,16 +1,18 @@
--- 1/gdb/config.in 2012-03-09 18:40:28.001871023 +0100
+++ ./gdb/config.in 2012-03-09 18:41:46.552621113 +0100
@@ -245,6 +245,9 @@
Index: gdb-7.4.50.20120602/gdb/config.in
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/config.in 2012-06-02 21:49:26.147399232 +0200
+++ gdb-7.4.50.20120602/gdb/config.in 2012-06-02 21:49:27.206398845 +0200
@@ -222,6 +222,9 @@
/* Define if librpm library is being used. */
#undef HAVE_LIBRPM
+/* Define to 1 if you have the `selinux' library (-lselinux). */
+#undef HAVE_LIBSELINUX
+
/* Define if libunwind library is being used. */
#undef HAVE_LIBUNWIND
/* Define to 1 if you have the <libunwind-ia64.h> header file. */
#undef HAVE_LIBUNWIND_IA64_H
@@ -483,6 +486,9 @@
@@ -363,6 +366,9 @@
/* Define to 1 if you have the `sbrk' function. */
#undef HAVE_SBRK
@ -20,9 +22,11 @@
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
--- 1/gdb/configure 2012-03-09 18:40:28.183870443 +0100
+++ ./gdb/configure 2012-03-09 18:41:45.783623559 +0100
@@ -15557,6 +15557,64 @@ $as_echo "#define HAVE_PERSONALITY 1" >>
Index: gdb-7.4.50.20120602/gdb/configure
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/configure 2012-06-02 21:49:27.139398869 +0200
+++ gdb-7.4.50.20120602/gdb/configure 2012-06-02 21:49:50.890390179 +0200
@@ -12745,6 +12745,64 @@ $as_echo "#define HAVE_PERSONALITY 1" >>
fi
@ -87,3 +91,96 @@
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
# except that the argument to --with-sysroot is optional.
Index: gdb-7.4.50.20120602/gdb/gdbserver/config.in
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/gdbserver/config.in 2012-04-19 21:34:51.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/gdbserver/config.in 2012-06-02 21:49:55.945388329 +0200
@@ -69,6 +69,9 @@
/* Define to 1 if you have the `dl' library (-ldl). */
#undef HAVE_LIBDL
+/* Define to 1 if you have the `selinux' library (-lselinux). */
+#undef HAVE_LIBSELINUX
+
/* Define to 1 if you have the <linux/elf.h> header file. */
#undef HAVE_LINUX_ELF_H
@@ -130,6 +133,9 @@
/* Define to 1 if you have the `readlink' function. */
#undef HAVE_READLINK
+/* Define to 1 if you have the <selinux/selinux.h> header file. */
+#undef HAVE_SELINUX_SELINUX_H
+
/* Define to 1 if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
Index: gdb-7.4.50.20120602/gdb/gdbserver/configure
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/gdbserver/configure 2012-04-20 19:58:49.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/gdbserver/configure 2012-06-02 21:49:54.485388864 +0200
@@ -5532,6 +5532,64 @@ if $want_ipa ; then
fi
fi
+for ac_header in selinux/selinux.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default"
+if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SELINUX_SELINUX_H 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5
+$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; }
+if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lselinux $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char security_get_boolean_active ();
+int
+main ()
+{
+return security_get_boolean_active ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_selinux_security_get_boolean_active=yes
+else
+ ac_cv_lib_selinux_security_get_boolean_active=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5
+$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; }
+if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBSELINUX 1
+_ACEOF
+
+ LIBS="-lselinux $LIBS"
+
+fi
+
+

View File

@ -1,65 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-01/msg00202.html
### src/gdb/ChangeLog 2012/01/24 19:12:31 1.13771
### src/gdb/ChangeLog 2012/01/24 20:56:33 1.13772
## -1,3 +1,12 @@
+2012-01-24 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Code cleanup.
+ * cli/cli-cmds.c (source_script_from_stream): Never fclose STREAM.
+ Update the function comment for it.
+ (source_script_with_search): Call make_cleanup_fclose for STREAM.
+ * cli/cli-script.c (script_from_file): Do not call make_cleanup_fclose
+ for STREAM.
+
2012-01-24 Pedro Alves <palves@redhat.com>
* breakpoint.c (bpstat_stop_status): Moving clearing print_it
--- src/gdb/cli/cli-cmds.c 2012/01/23 16:37:03 1.123
+++ src/gdb/cli/cli-cmds.c 2012/01/24 20:56:33 1.124
@@ -527,8 +527,7 @@
return 1;
}
-/* Load script FILE, which has already been opened as STREAM.
- STREAM is closed before we return. */
+/* Load script FILE, which has already been opened as STREAM. */
static void
source_script_from_stream (FILE *stream, const char *file)
@@ -556,12 +555,9 @@
else
{
/* Nope, just punt. */
- fclose (stream);
throw_exception (e);
}
}
- else
- fclose (stream);
}
else
script_from_file (stream, file);
@@ -595,6 +591,7 @@
}
old_cleanups = make_cleanup (xfree, full_path);
+ make_cleanup_fclose (stream);
/* The python support reopens the file, so we need to pass full_path here
in case the file was found on the search path. It's useful to do this
anyway so that error messages show the actual file used. But only do
--- src/gdb/cli/cli-script.c 2012/01/04 08:17:17 1.73
+++ src/gdb/cli/cli-script.c 2012/01/24 20:56:33 1.74
@@ -1614,11 +1614,9 @@
if (stream == NULL)
internal_error (__FILE__, __LINE__, _("called with NULL file pointer!"));
- old_cleanups = make_cleanup_fclose (stream);
-
old_lines.old_line = source_line_number;
old_lines.old_file = source_file_name;
- make_cleanup (source_cleanup_lines, &old_lines);
+ old_cleanups = make_cleanup (source_cleanup_lines, &old_lines);
source_line_number = 0;
source_file_name = file;
/* This will get set every time we read a line. So it won't stay ""

View File

@ -1,103 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-01/msg00205.html
--- src/gdb/gdb_vecs.h
+++ src/gdb/gdb_vecs.h 2012-04-17 22:04:23.818666000 +0000
@@ -0,0 +1,28 @@
+/* Some commonly-used VEC types.
+
+ Copyright (C) 2012 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+
+#ifndef GDB_VECS_H
+#define GDB_VECS_H
+
+#include "vec.h"
+
+DEF_VEC_P (char_ptr);
+
+#endif /* GDB_VECS_H */
### src/gdb/ChangeLog 2012/01/24 21:32:56 1.13774
### src/gdb/ChangeLog 2012/01/24 21:36:37 1.13775
## -1,3 +1,10 @@
+2012-01-24 Tom Tromey <tromey@redhat.com>
+
+ * ada-lang.c: Include gdb_vecs.h.
+ * charset.c: Include gdb_vecs.h.
+ * tracepoint.h: Include gdb_vecs.h.
+ * gdb_vecs.h: New file.
+
2012-01-24 Pedro Alves <pedro@codesourcery.com>
* breakpoint.c (breakpoint_hit_catch_fork)
--- src/gdb/ada-lang.c 2012/01/06 03:34:45 1.330
+++ src/gdb/ada-lang.c 2012/01/24 21:36:37 1.331
@@ -57,6 +57,7 @@
#include "observer.h"
#include "vec.h"
#include "stack.h"
+#include "gdb_vecs.h"
#include "psymtab.h"
#include "value.h"
@@ -5628,8 +5629,6 @@
return sym_name;
}
-DEF_VEC_P (char_ptr);
-
/* A companion function to ada_make_symbol_completion_list().
Check if SYM_NAME represents a symbol which name would be suitable
to complete TEXT (TEXT_LEN is the length of TEXT), in which case
--- src/gdb/charset.c 2012/01/04 08:17:00 1.46
+++ src/gdb/charset.c 2012/01/24 21:36:37 1.47
@@ -27,6 +27,7 @@
#include "vec.h"
#include "environ.h"
#include "arch-utils.h"
+#include "gdb_vecs.h"
#include <stddef.h>
#include "gdb_string.h"
@@ -717,8 +718,6 @@
extern initialize_file_ftype _initialize_charset; /* -Wmissing-prototype */
-DEF_VEC_P (char_ptr);
-
static VEC (char_ptr) *charsets;
#ifdef PHONY_ICONV
--- src/gdb/tracepoint.h 2012/01/04 08:27:57 1.46
+++ src/gdb/tracepoint.h 2012/01/24 21:36:37 1.47
@@ -22,6 +22,7 @@
#include "breakpoint.h"
#include "target.h"
#include "memrange.h"
+#include "gdb_vecs.h"
/* A trace state variable is a value managed by a target being
traced. A trace state variable (or tsv for short) can be accessed
@@ -143,8 +144,6 @@
/* Struct to collect random info about tracepoints on the target. */
-DEF_VEC_P (char_ptr);
-
struct uploaded_tp
{
int number;

View File

@ -1,215 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-01/msg00219.html
### src/gdb/ChangeLog 2012/01/26 16:44:29 1.13780
### src/gdb/ChangeLog 2012/01/26 21:54:42 1.13781
## -1,3 +1,22 @@
+2012-01-26 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Do not open script filenames twice.
+ * cli/cli-cmds.c (source_script_from_stream): Pass to
+ source_python_script also STREAM.
+ * python/py-auto-load.c (source_section_scripts): Pass to
+ source_python_script_for_objfile also STREAM.
+ (auto_load_objfile_script): Pass to source_python_script_for_objfile
+ also INPUT.
+ * python/python-internal.h (source_python_script_for_objfile): New
+ parameter file, rename parameter file to filename.
+ * python/python.c (python_run_simple_file): Call PyRun_SimpleFile
+ instead if !_WIN32. Update the function comment.
+ (source_python_script, source_python_script_for_objfile)
+ (source_python_script): New parameter file, rename parameter file to
+ filename. Pass FILENAME to python_run_simple_file.
+ * python/python.h (source_python_script): New parameter file, rename
+ parameter file to filename.
+
2012-01-26 Pedro Alves <palves@redhat.com>
* corelow.c (core_has_fake_pid): Delete.
Index: gdb-7.4.50.20120120/gdb/cli/cli-cmds.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/cli/cli-cmds.c 2012-01-04 09:17:16.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/cli/cli-cmds.c 2012-04-18 00:41:42.696855430 +0200
@@ -529,9 +529,7 @@ source_script_from_stream (FILE *stream,
TRY_CATCH (e, RETURN_MASK_ERROR)
{
- /* The python support reopens the file using python functions,
- so there's no point in passing STREAM here. */
- source_python_script (file);
+ source_python_script (stream, file);
}
if (e.reason < 0)
{
Index: gdb-7.4.50.20120120/gdb/python/py-auto-load.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/python/py-auto-load.c 2012-01-04 09:17:25.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/python/py-auto-load.c 2012-04-18 00:41:42.696855430 +0200
@@ -312,7 +312,7 @@ Use `info auto-load-scripts [REGEXP]' to
{
/* If this file is not currently loaded, load it. */
if (! in_hash_table)
- source_python_script_for_objfile (objfile, full_path);
+ source_python_script_for_objfile (objfile, stream, full_path);
fclose (stream);
xfree (full_path);
}
@@ -431,7 +431,7 @@ auto_load_objfile_script (struct objfile
It's highly unlikely that we'd ever load it twice,
and these scripts are required to be idempotent under multiple
loads anyway. */
- source_python_script_for_objfile (objfile, debugfile);
+ source_python_script_for_objfile (objfile, input, debugfile);
fclose (input);
}
Index: gdb-7.4.50.20120120/gdb/python/python-internal.h
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/python/python-internal.h 2012-01-04 09:17:25.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/python/python-internal.h 2012-04-18 00:41:42.696855430 +0200
@@ -289,8 +289,8 @@ extern const struct language_defn *pytho
void gdbpy_print_stack (void);
-void source_python_script_for_objfile (struct objfile *objfile,
- const char *file);
+void source_python_script_for_objfile (struct objfile *objfile, FILE *file,
+ const char *filename);
PyObject *python_string_to_unicode (PyObject *obj);
char *unicode_to_target_string (PyObject *unicode_str);
Index: gdb-7.4.50.20120120/gdb/python/python.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/python/python.c 2012-04-18 00:41:30.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/python/python.c 2012-04-18 00:41:42.696855430 +0200
@@ -154,34 +154,31 @@ ensure_python_env (struct gdbarch *gdbar
return make_cleanup (restore_python_env, env);
}
-/* A wrapper around PyRun_SimpleFile. FILENAME is the name of
- the Python script to run.
+/* A wrapper around PyRun_SimpleFile. FILE is the Python script to run
+ named FILENAME.
- One of the parameters of PyRun_SimpleFile is a FILE *.
- The problem is that type FILE is extremely system and compiler
- dependent. So, unless the Python library has been compiled using
- the same build environment as GDB, we run the risk of getting
- a crash due to inconsistencies between the definition used by GDB,
- and the definition used by Python. A mismatch can very likely
- lead to a crash.
-
- There is also the situation where the Python library and GDB
- are using two different versions of the C runtime library.
- This is particularly visible on Windows, where few users would
- build Python themselves (this is no trivial task on this platform),
- and thus use binaries built by someone else instead. Python,
- being built with VC, would use one version of the msvcr DLL
- (Eg. msvcr100.dll), while MinGW uses msvcrt.dll. A FILE *
- from one runtime does not necessarily operate correctly in
+ On Windows hosts few users would build Python themselves (this is no
+ trivial task on this platform), and thus use binaries built by
+ someone else instead. There may happen situation where the Python
+ library and GDB are using two different versions of the C runtime
+ library. Python, being built with VC, would use one version of the
+ msvcr DLL (Eg. msvcr100.dll), while MinGW uses msvcrt.dll.
+ A FILE * from one runtime does not necessarily operate correctly in
the other runtime.
- To work around this potential issue, we create the FILE object
- using Python routines, thus making sure that it is compatible
- with the Python library. */
+ To work around this potential issue, we create on Windows hosts the
+ FILE object using Python routines, thus making sure that it is
+ compatible with the Python library. */
static void
-python_run_simple_file (const char *filename)
+python_run_simple_file (FILE *file, const char *filename)
{
+#ifndef _WIN32
+
+ PyRun_SimpleFile (file, filename);
+
+#else /* _WIN32 */
+
char *full_path;
PyObject *python_file;
struct cleanup *cleanup;
@@ -201,6 +198,8 @@ python_run_simple_file (const char *file
make_cleanup_py_decref (python_file);
PyRun_SimpleFile (PyFile_AsFile (python_file), filename);
do_cleanups (cleanup);
+
+#endif /* _WIN32 */
}
/* Given a command_line, return a command string suitable for passing
@@ -623,17 +622,17 @@ gdbpy_parse_and_eval (PyObject *self, Py
}
/* Read a file as Python code.
- FILE is the name of the file.
+ FILE is the file to run. FILENAME is name of the file FILE.
This does not throw any errors. If an exception occurs python will print
the traceback and clear the error indicator. */
void
-source_python_script (const char *file)
+source_python_script (FILE *file, const char *filename)
{
struct cleanup *cleanup;
cleanup = ensure_python_env (get_current_arch (), current_language);
- python_run_simple_file (file);
+ python_run_simple_file (file, filename);
do_cleanups (cleanup);
}
@@ -1041,19 +1040,20 @@ gdbpy_progspaces (PyObject *unused1, PyO
source_python_script_for_objfile; it is NULL at other times. */
static struct objfile *gdbpy_current_objfile;
-/* Set the current objfile to OBJFILE and then read FILE as Python code.
- This does not throw any errors. If an exception occurs python will print
- the traceback and clear the error indicator. */
+/* Set the current objfile to OBJFILE and then read FILE named FILENAME
+ as Python code. This does not throw any errors. If an exception
+ occurs python will print the traceback and clear the error indicator. */
void
-source_python_script_for_objfile (struct objfile *objfile, const char *file)
+source_python_script_for_objfile (struct objfile *objfile, FILE *file,
+ const char *filename)
{
struct cleanup *cleanups;
cleanups = ensure_python_env (get_objfile_arch (objfile), current_language);
gdbpy_current_objfile = objfile;
- python_run_simple_file (file);
+ python_run_simple_file (file, filename);
do_cleanups (cleanups);
gdbpy_current_objfile = NULL;
@@ -1129,7 +1129,7 @@ eval_python_from_control_command (struct
}
void
-source_python_script (const char *file)
+source_python_script (FILE *file, const char *filename)
{
throw_error (UNSUPPORTED_ERROR,
_("Python scripting is not supported in this copy of GDB."));
Index: gdb-7.4.50.20120120/gdb/python/python.h
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/python/python.h 2012-04-18 00:41:30.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/python/python.h 2012-04-18 00:41:42.697855427 +0200
@@ -30,7 +30,7 @@ extern void finish_python_initialization
void eval_python_from_control_command (struct command_line *);
-void source_python_script (const char *file);
+void source_python_script (FILE *file, const char *filename);
void run_python_script (int argc, char **argv);

View File

@ -1,141 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-03/msg00234.html
### src/gdb/ChangeLog 2012/03/19 18:13:39 1.14025
### src/gdb/ChangeLog 2012/03/19 18:16:17 1.14026
## -1,3 +1,14 @@
+2012-03-19 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Code cleanup.
+ * main.c (struct cmdarg): Move it here from main. Add more comments.
+ (cmdarg_s, VEC (cmdarg_s)): New.
+ (main): Move struct cmdarg from here. New variables cmdarg_vec and
+ cmdarg_p. Remove variables cmdsize and ncmd and their initialization.
+ Install cleanup for cmdarg_vec. Update filling for options 'x' and
+ 'X'. Replace cmdarg processing by cmdarg_vec processing. Remove xfree
+ of CMDARG.
+
2012-03-19 Tom Tromey <tromey@redhat.com>
* gnu-v3-abi.c (gnuv3_print_vtable): Initialize 'result_vec'.
Index: gdb-7.4.50.20120120/gdb/main.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/main.c 2012-04-18 00:41:31.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/main.c 2012-04-18 00:42:15.354772337 +0200
@@ -277,6 +277,25 @@ exec_or_core_file_attach (char *filename
}
}
+/* Arguments of --command option and its counterpart. */
+typedef struct cmdarg {
+ /* Type of this option. */
+ enum {
+ /* Option type -x. */
+ CMDARG_FILE,
+
+ /* Option type -ex. */
+ CMDARG_COMMAND
+ } type;
+
+ /* Value of this option - filename or the GDB command itself. String memory
+ is not owned by this structure despite it is 'const'. */
+ char *string;
+} cmdarg_s;
+
+/* Define type VEC (cmdarg_s). */
+DEF_VEC_O (cmdarg_s);
+
static int
captured_main (void *data)
{
@@ -303,17 +322,8 @@ captured_main (void *data)
static int print_version;
/* Pointers to all arguments of --command option. */
- struct cmdarg {
- enum {
- CMDARG_FILE,
- CMDARG_COMMAND
- } type;
- char *string;
- } *cmdarg;
- /* Allocated size of cmdarg. */
- int cmdsize;
- /* Number of elements of cmdarg used. */
- int ncmd;
+ VEC (cmdarg_s) *cmdarg_vec = NULL;
+ struct cmdarg *cmdarg_p;
/* Indices of all arguments of --directory option. */
char **dirarg;
@@ -349,9 +359,7 @@ captured_main (void *data)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- cmdsize = 1;
- cmdarg = (struct cmdarg *) xmalloc (cmdsize * sizeof (*cmdarg));
- ncmd = 0;
+ make_cleanup (VEC_cleanup (cmdarg_s), &cmdarg_vec);
dirsize = 1;
dirarg = (char **) xmalloc (dirsize * sizeof (*dirarg));
ndir = 0;
@@ -582,24 +590,19 @@ captured_main (void *data)
pidarg = optarg;
break;
case 'x':
- cmdarg[ncmd].type = CMDARG_FILE;
- cmdarg[ncmd++].string = optarg;
- if (ncmd >= cmdsize)
- {
- cmdsize *= 2;
- cmdarg = xrealloc ((char *) cmdarg,
- cmdsize * sizeof (*cmdarg));
- }
+ {
+ struct cmdarg cmdarg = { CMDARG_FILE, optarg };
+
+ VEC_safe_push (cmdarg_s, cmdarg_vec, &cmdarg);
+ }
break;
case 'X':
- cmdarg[ncmd].type = CMDARG_COMMAND;
- cmdarg[ncmd++].string = optarg;
- if (ncmd >= cmdsize)
- {
- cmdsize *= 2;
- cmdarg = xrealloc ((char *) cmdarg,
- cmdsize * sizeof (*cmdarg));
- }
+ {
+ struct cmdarg cmdarg = { CMDARG_COMMAND, optarg };
+
+ VEC_safe_push (cmdarg_s, cmdarg_vec, &cmdarg);
+ }
+ break;
break;
case 'B':
batch_flag = batch_silent = 1;
@@ -990,16 +993,18 @@ captured_main (void *data)
ALL_OBJFILES (objfile)
load_auto_scripts_for_objfile (objfile);
- for (i = 0; i < ncmd; i++)
+ for (i = 0; VEC_iterate (cmdarg_s, cmdarg_vec, i, cmdarg_p); i++)
+ switch (cmdarg_p->type)
{
- if (cmdarg[i].type == CMDARG_FILE)
- catch_command_errors (source_script, cmdarg[i].string,
+ case CMDARG_FILE:
+ catch_command_errors (source_script, cmdarg_p->string,
!batch_flag, RETURN_MASK_ALL);
- else /* cmdarg[i].type == CMDARG_COMMAND */
- catch_command_errors (execute_command, cmdarg[i].string,
+ break;
+ case CMDARG_COMMAND:
+ catch_command_errors (execute_command, cmdarg_p->string,
!batch_flag, RETURN_MASK_ALL);
+ break;
}
- xfree (cmdarg);
/* Read in the old history after all the command files have been
read. */

View File

@ -1,244 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-03/msg00235.html
### src/gdb/ChangeLog 2012/03/19 18:16:17 1.14026
### src/gdb/ChangeLog 2012/03/19 18:19:23 1.14027
## -1,5 +1,18 @@
2012-03-19 Jan Kratochvil <jan.kratochvil@redhat.com>
+ * NEWS: Describe new options --init-command=FILE, -ix and
+ --init-eval-command=COMMAND, -iex.
+ * main.c (struct cmdarg): New enum items CMDARG_INIT_FILE and
+ CMDARG_INIT_COMMAND.
+ (captured_main): New enum items OPT_IX and OPT_IEX. Add
+ "init-command", "init-eval-command", "ix" and "iex" to the variable
+ long_options. Handle OPT_IX and OPT_IEX. Process them from CMDARG_VEC.
+ New comment for CMDARG_FILE and CMDARG_COMMAND processing.
+ (print_gdb_help): Describe --init-command=FILE, -ix and
+ --init-eval-command=COMMAND, -iex.
+
+2012-03-19 Jan Kratochvil <jan.kratochvil@redhat.com>
+
Code cleanup.
* main.c (struct cmdarg): Move it here from main. Add more comments.
(cmdarg_s, VEC (cmdarg_s)): New.
Index: gdb-7.4.50.20120120/gdb/NEWS
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/NEWS 2012-04-18 00:41:30.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/NEWS 2012-04-18 00:42:51.226681068 +0200
@@ -28,6 +28,13 @@
now set a breakpoint in build/gcc/expr.c, but not
build/libcpp/expr.c.
+* New command line options
+
+--init-command=FILE, -ix Like --command, -x but execute it
+ before loading inferior.
+--init-eval-command=COMMAND, -iex Like --eval-command=COMMAND, -ex but
+ execute it before loading inferior.
+
*** Changes in GDB 7.4
* GDB now handles ambiguous linespecs more consistently; the existing
Index: gdb-7.4.50.20120120/gdb/main.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/main.c 2012-04-18 00:42:15.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/main.c 2012-04-18 00:42:51.226681068 +0200
@@ -285,7 +285,13 @@ typedef struct cmdarg {
CMDARG_FILE,
/* Option type -ex. */
- CMDARG_COMMAND
+ CMDARG_COMMAND,
+
+ /* Option type -ix. */
+ CMDARG_INIT_FILE,
+
+ /* Option type -iex. */
+ CMDARG_INIT_COMMAND
} type;
/* Value of this option - filename or the GDB command itself. String memory
@@ -434,7 +440,9 @@ captured_main (void *data)
OPT_STATISTICS,
OPT_TUI,
OPT_NOWINDOWS,
- OPT_WINDOWS
+ OPT_WINDOWS,
+ OPT_IX,
+ OPT_IEX
};
static struct option long_options[] =
{
@@ -475,6 +483,10 @@ captured_main (void *data)
{"version", no_argument, &print_version, 1},
{"x", required_argument, 0, 'x'},
{"ex", required_argument, 0, 'X'},
+ {"init-command", required_argument, 0, OPT_IX},
+ {"init-eval-command", required_argument, 0, OPT_IEX},
+ {"ix", required_argument, 0, OPT_IX},
+ {"iex", required_argument, 0, OPT_IEX},
#ifdef GDBTK
{"tclcommand", required_argument, 0, 'z'},
{"enable-external-editor", no_argument, 0, 'y'},
@@ -603,6 +615,19 @@ captured_main (void *data)
VEC_safe_push (cmdarg_s, cmdarg_vec, &cmdarg);
}
break;
+ case OPT_IX:
+ {
+ struct cmdarg cmdarg = { CMDARG_INIT_FILE, optarg };
+
+ VEC_safe_push (cmdarg_s, cmdarg_vec, &cmdarg);
+ }
+ break;
+ case OPT_IEX:
+ {
+ struct cmdarg cmdarg = { CMDARG_INIT_COMMAND, optarg };
+
+ VEC_safe_push (cmdarg_s, cmdarg_vec, &cmdarg);
+ }
break;
case 'B':
batch_flag = batch_silent = 1;
@@ -877,6 +902,20 @@ captured_main (void *data)
quit_pre_print = error_pre_print;
warning_pre_print = _("\nwarning: ");
+ /* Process '-ix' and '-iex' options early. */
+ for (i = 0; VEC_iterate (cmdarg_s, cmdarg_vec, i, cmdarg_p); i++)
+ switch (cmdarg_p->type)
+ {
+ case CMDARG_INIT_FILE:
+ catch_command_errors (source_script, cmdarg_p->string,
+ !batch_flag, RETURN_MASK_ALL);
+ break;
+ case CMDARG_INIT_COMMAND:
+ catch_command_errors (execute_command, cmdarg_p->string,
+ !batch_flag, RETURN_MASK_ALL);
+ break;
+ }
+
/* Read and execute the system-wide gdbinit file, if it exists.
This is done *before* all the command line arguments are
processed; it sets global parameters, which are independent of
@@ -993,6 +1032,7 @@ captured_main (void *data)
ALL_OBJFILES (objfile)
load_auto_scripts_for_objfile (objfile);
+ /* Process '-x' and '-ex' options. */
for (i = 0; VEC_iterate (cmdarg_s, cmdarg_vec, i, cmdarg_p); i++)
switch (cmdarg_p->type)
{
@@ -1093,6 +1133,8 @@ Options:\n\n\
Execute a single GDB command.\n\
May be used multiple times and in conjunction\n\
with --command.\n\
+ --init-command=FILE, -ix Like -x but execute it before loading inferior.\n\
+ --init-eval-command=COMMAND, -iex Like -ex but before loading inferior.\n\
--core=COREFILE Analyze the core dump COREFILE.\n\
--pid=PID Attach to running process PID.\n\
"), stream);
Index: gdb-7.4.50.20120120/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/doc/gdb.texinfo 2012-04-18 00:41:31.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/doc/gdb.texinfo 2012-04-18 00:42:51.232681052 +0200
@@ -989,6 +989,22 @@ also be interleaved with @samp{-command}
-x setbreakpoints -ex 'run' a.out
@end smallexample
+@item -init-command @var{file}
+@itemx -ix @var{file}
+@cindex @code{--init-command}
+@cindex @code{-ix}
+Execute commands from file @var{file} before loading gdbinit files or the
+inferior.
+@xref{Startup}.
+
+@item -init-eval-command @var{command}
+@itemx -iex @var{command}
+@cindex @code{--init-eval-command}
+@cindex @code{-iex}
+Execute a single @value{GDBN} command before loading gdbinit files or the
+inferior.
+@xref{Startup}.
+
@item -directory @var{directory}
@itemx -d @var{directory}
@cindex @code{--directory}
@@ -1250,6 +1266,13 @@ Sets up the command interpreter as speci
(@pxref{Mode Options, interpreter}).
@item
+Executes commands and command files specified by the @samp{-iex} and
+@samp{-ix} options in their specified order. Usually you should use the
+@samp{-ex} and @samp{-x} options instead, but this way you can apply
+settings before @value{GDBN} init files get executed and before inferior
+gets loaded.
+
+@item
@cindex init file
Reads the system-wide @dfn{init file} (if @option{--with-system-gdbinit} was
used when building @value{GDBN}; @pxref{System-wide configuration,
@@ -1283,14 +1306,11 @@ If you wish to disable the auto-loading
you must do something like the following:
@smallexample
-$ gdb -ex "set auto-load-scripts off" -ex "file myprogram"
+$ gdb -iex "set auto-load-scripts off" myprogram
@end smallexample
-The following does not work because the auto-loading is turned off too late:
-
-@smallexample
-$ gdb -ex "set auto-load-scripts off" myprogram
-@end smallexample
+Option @samp{-ex} does not work because the auto-loading is then turned
+off too late.
@item
Reads command files specified by the @samp{-x} option. @xref{Command
Index: gdb-7.4.50.20120120/gdb/testsuite/gdb.gdb/selftest.exp
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/testsuite/gdb.gdb/selftest.exp 2012-04-18 00:41:31.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/testsuite/gdb.gdb/selftest.exp 2012-04-18 00:42:51.232681052 +0200
@@ -92,6 +92,10 @@ proc do_steps_and_nexts {} {
set description "step over python_script initialization"
set command "step"
}
+ -re ".*cmdarg_vec = NULL.*$gdb_prompt $" {
+ set description "step over cmdarg_vec initialization"
+ set command "step"
+ }
-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"
@@ -128,18 +132,6 @@ proc do_steps_and_nexts {} {
set description "next over conditional stack alignment alloca"
set command "next"
}
- -re ".*cmdsize = 1.*$gdb_prompt $" {
- set description "step over cmdsize initialization"
- set command "next"
- }
- -re ".*cmdarg = .* xmalloc.*$gdb_prompt $" {
- set description "next over cmdarg initialization via xmalloc"
- set command "next"
- }
- -re ".*ncmd = 0.*$gdb_prompt $" {
- set description "next over ncmd initialization"
- set command "next"
- }
-re ".*dirsize = 1.*$gdb_prompt $" {
set description "next over dirsize initialization"
set command "next"
@@ -163,6 +155,10 @@ proc do_steps_and_nexts {} {
set description "next over textdomain PACKAGE"
set command "next"
}
+ -re ".*VEC_cleanup .cmdarg_s.*$gdb_prompt $" {
+ set description "next over cmdarg_s VEC_cleanup"
+ set command "next"
+ }
-re "\[0-9\]+\[\t \]+\{\r\n$gdb_prompt $" {
set description "step over initial brace"
set command "step"

View File

@ -1,71 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-03/msg00236.html
### src/gdb/ChangeLog 2012/03/19 18:19:23 1.14027
### src/gdb/ChangeLog 2012/03/19 18:23:51 1.14028
## -1,5 +1,13 @@
2012-03-19 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Code cleanup.
+ * python/py-auto-load.c (source_section_scripts): New variable back_to.
+ Turn fclose and xfree calls into make_cleanup_fclose and make_cleanup
+ with xfree.
+ (auto_load_objfile_script): Turn fclose into make_cleanup_fclose.
+
+2012-03-19 Jan Kratochvil <jan.kratochvil@redhat.com>
+
* NEWS: Describe new options --init-command=FILE, -ix and
--init-eval-command=COMMAND, -iex.
* main.c (struct cmdarg): New enum items CMDARG_INIT_FILE and
--- src/gdb/python/py-auto-load.c 2012/01/26 21:54:45 1.18
+++ src/gdb/python/py-auto-load.c 2012/03/19 18:23:52 1.19
@@ -254,6 +254,7 @@
FILE *stream;
char *full_path;
int opened, in_hash_table;
+ struct cleanup *back_to;
if (*p != 1)
{
@@ -286,6 +287,13 @@
opened = find_and_open_script (file, 1 /*search_path*/,
&stream, &full_path);
+ back_to = make_cleanup (null_cleanup, NULL);
+ if (opened)
+ {
+ make_cleanup_fclose (stream);
+ make_cleanup (xfree, full_path);
+ }
+
/* If one script isn't found it's not uncommon for more to not be
found either. We don't want to print an error message for each
script, too much noise. Instead, we print the warning once and tell
@@ -313,9 +321,9 @@
/* If this file is not currently loaded, load it. */
if (! in_hash_table)
source_python_script_for_objfile (objfile, stream, full_path);
- fclose (stream);
- xfree (full_path);
}
+
+ do_cleanups (back_to);
}
}
@@ -420,6 +428,8 @@
{
struct auto_load_pspace_info *pspace_info;
+ make_cleanup_fclose (input);
+
/* Add this script to the hash table too so "info auto-load-scripts"
can print it. */
pspace_info =
@@ -432,7 +442,6 @@
and these scripts are required to be idempotent under multiple
loads anyway. */
source_python_script_for_objfile (objfile, input, debugfile);
- fclose (input);
}
do_cleanups (cleanups);

View File

@ -1,57 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-03/msg00296.html
### src/gdb/doc/ChangeLog 2012/03/22 08:10:41 1.1289
### src/gdb/doc/ChangeLog 2012/03/27 20:15:20 1.1290
## -1,3 +1,12 @@
+2012-03-27 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.texinfo (Auto-loading): Rename node reference
+ '.debug_gdb_scripts section' to 'dotdebug_gdb_scripts section'.
+ Twice.
+ (.debug_gdb_scripts section): Rename the node ...
+ (dotdebug_gdb_scripts section): ... here.
+ (Maintenance Commands): Also rename this node reference.
+
2012-03-22 Siva Chandra Reddy <sivachandra@google.com>
* gdb.texinfo (Python API/Values From Inferior): Add description
--- src/gdb/doc/gdb.texinfo 2012/03/22 08:10:41 1.936
+++ src/gdb/doc/gdb.texinfo 2012/03/27 20:15:20 1.937
@@ -24717,8 +24717,8 @@
@file{@var{objfile}-gdb.py} and @code{.debug_gdb_scripts} section.
@menu
-* objfile-gdb.py file:: The @file{@var{objfile}-gdb.py} file
-* .debug_gdb_scripts section:: The @code{.debug_gdb_scripts} section
+* objfile-gdb.py file:: The @file{@var{objfile}-gdb.py} file
+* dotdebug_gdb_scripts section:: The @code{.debug_gdb_scripts} section
* Which flavor to choose?::
@end menu
@@ -24744,7 +24744,7 @@
Also printed is the list of scripts that were mentioned in
the @code{.debug_gdb_scripts} section and were not found
-(@pxref{.debug_gdb_scripts section}).
+(@pxref{dotdebug_gdb_scripts section}).
This is useful because their names are not printed when @value{GDBN}
tries to load them and fails. There may be many of them, and printing
an error message for each one is problematic.
@@ -24795,7 +24795,7 @@
So your @file{-gdb.py} file should be careful to avoid errors if it
is evaluated more than once.
-@node .debug_gdb_scripts section
+@node dotdebug_gdb_scripts section
@subsubsection The @code{.debug_gdb_scripts} section
@cindex @code{.debug_gdb_scripts} section
@@ -33475,7 +33475,7 @@
matching @var{regexp}.
For each script, this command prints its name as specified in the objfile,
and the full path if known.
-@xref{.debug_gdb_scripts section}.
+@xref{dotdebug_gdb_scripts section}.
@kindex maint print statistics
@cindex bcache statistics

View File

@ -1,171 +0,0 @@
[patch#4 2/8] Code cleanup: new path to VEC in utils.c
http://sourceware.org/ml/gdb-patches/2012-04/msg00086.html
http://sourceware.org/ml/gdb-cvs/2012-04/msg00111.html
- reduced for the backport
### src/gdb/ChangeLog 2012/04/17 15:45:05 1.14110
### src/gdb/ChangeLog 2012/04/17 15:47:08 1.14111
## -1,6 +1,34 @@
2012-04-17 Jan Kratochvil <jan.kratochvil@redhat.com>
Code cleanup.
+ * charset.c (find_charset_names): Remove variables ix and elt.
+ Use free_char_ptr_vec.
+ * elfread.c (build_id_to_debug_filename): New variables debugdir_vec,
+ back_to and ix. Use dirnames_to_char_ptr_vec. Remove variable
+ debugdir_end. New variable debugdir_len.
+ * gdb_vecs.h (free_char_ptr_vec, make_cleanup_free_char_ptr_vec)
+ (dirnames_to_char_ptr_vec_append, dirnames_to_char_ptr_vec): New
+ declarations.
+ * progspace.c (clear_program_space_solib_cache): Remove variables ix
+ and elt. Use free_char_ptr_vec.
+ * source.c (add_path): Remove variables argv, arg and argv_index.
+ New variables dir_vec, back_to, ix and name.
+ Use dirnames_to_char_ptr_vec_append. Use freeargv instead of
+ make_cleanup_freeargv. Remove variable separator. Simplify the code
+ no longer expecting DIRNAME_SEPARATOR.
+ (openp): Remove variable p, p1 and len. New variables dir_vec,
+ back_to, ix and dir. Use dirnames_to_char_ptr_vec. Simplify the code
+ no longer expecting DIRNAME_SEPARATOR.
+ * symfile.c (find_separate_debug_file): New variables debugdir_vec,
+ back_to and ix. Use dirnames_to_char_ptr_vec. Remove variable
+ debugdir_end.
+ * utils.c (free_char_ptr_vec, do_free_char_ptr_vec)
+ (make_cleanup_free_char_ptr_vec, dirnames_to_char_ptr_vec_append)
+ (dirnames_to_char_ptr_vec): New functions.
+
+2012-04-17 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Code cleanup.
* source.c (add_path): Remove always true conditional 'p == 0' and
unindent its code block.
Index: gdb-7.4.50.20120120/gdb/gdb_vecs.h
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/gdb_vecs.h 2012-04-18 00:40:12.067086016 +0200
+++ gdb-7.4.50.20120120/gdb/gdb_vecs.h 2012-04-18 00:40:23.474056993 +0200
@@ -25,4 +25,16 @@
DEF_VEC_P (char_ptr);
+/* From utils.c: */
+
+extern void free_char_ptr_vec (VEC (char_ptr) *char_ptr_vec);
+
+extern struct cleanup *
+ make_cleanup_free_char_ptr_vec (VEC (char_ptr) *char_ptr_vec);
+
+extern void dirnames_to_char_ptr_vec_append (VEC (char_ptr) **vecp,
+ const char *dirnames);
+
+extern VEC (char_ptr) *dirnames_to_char_ptr_vec (const char *dirnames);
+
#endif /* GDB_VECS_H */
Index: gdb-7.4.50.20120120/gdb/utils.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/utils.c 2012-04-18 00:40:12.068086013 +0200
+++ gdb-7.4.50.20120120/gdb/utils.c 2012-04-18 00:40:49.862989855 +0200
@@ -29,6 +29,7 @@
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif /* HAVE_SYS_RESOURCE_H */
+#include "gdb_vecs.h"
#ifdef TUI
#include "tui/tui.h" /* For tui_get_command_dimension. */
@@ -3835,6 +3836,95 @@ producer_is_gcc_ge_4 (const char *produc
return minor;
}
+/* Call xfree for each element of CHAR_PTR_VEC and final VEC_free for
+ CHAR_PTR_VEC itself.
+
+ You must not modify CHAR_PTR_VEC after it got registered with this function
+ by make_cleanup as the CHAR_PTR_VEC base address may change on its updates.
+ Contrary to VEC_free this function does not (cannot) clear the pointer. */
+
+void
+free_char_ptr_vec (VEC (char_ptr) *char_ptr_vec)
+{
+ int ix;
+ char *name;
+
+ for (ix = 0; VEC_iterate (char_ptr, char_ptr_vec, ix, name); ++ix)
+ xfree (name);
+ VEC_free (char_ptr, char_ptr_vec);
+}
+
+/* Helper for make_cleanup_free_char_ptr_vec. */
+
+static void
+do_free_char_ptr_vec (void *arg)
+{
+ VEC (char_ptr) *char_ptr_vec = arg;
+
+ free_char_ptr_vec (char_ptr_vec);
+}
+
+/* Make cleanup handler calling xfree for each element of CHAR_PTR_VEC and
+ final VEC_free for CHAR_PTR_VEC itself.
+
+ You must not modify CHAR_PTR_VEC after this cleanup registration as the
+ CHAR_PTR_VEC base address may change on its updates. Contrary to VEC_free
+ this function does not (cannot) clear the pointer. */
+
+struct cleanup *
+make_cleanup_free_char_ptr_vec (VEC (char_ptr) *char_ptr_vec)
+{
+ return make_cleanup (do_free_char_ptr_vec, char_ptr_vec);
+}
+
+/* Extended version of dirnames_to_char_ptr_vec - additionally if *VECP is
+ non-NULL the new list elements from DIRNAMES are appended to the existing
+ *VECP list of entries. *VECP address will be updated by this call. */
+
+void
+dirnames_to_char_ptr_vec_append (VEC (char_ptr) **vecp, const char *dirnames)
+{
+ do
+ {
+ size_t this_len;
+ char *next_dir, *this_dir;
+
+ next_dir = strchr (dirnames, DIRNAME_SEPARATOR);
+ if (next_dir == NULL)
+ this_len = strlen (dirnames);
+ else
+ {
+ this_len = next_dir - dirnames;
+ next_dir++;
+ }
+
+ this_dir = xmalloc (this_len + 1);
+ memcpy (this_dir, dirnames, this_len);
+ this_dir[this_len] = '\0';
+ VEC_safe_push (char_ptr, *vecp, this_dir);
+
+ dirnames = next_dir;
+ }
+ while (dirnames != NULL);
+}
+
+/* Split DIRNAMES by DIRNAME_SEPARATOR delimiter and return a list of all the
+ elements in their original order. For empty string ("") DIRNAMES return
+ list of one empty string ("") element.
+
+ You may modify the returned strings.
+ Read free_char_ptr_vec for its cleanup. */
+
+VEC (char_ptr) *
+dirnames_to_char_ptr_vec (const char *dirnames)
+{
+ VEC (char_ptr) *retval = NULL;
+
+ dirnames_to_char_ptr_vec_append (&retval, dirnames);
+
+ return retval;
+}
+
#ifdef HAVE_WAITPID
#ifdef SIGALRM

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,744 +0,0 @@
[patch#4 5/8] set auto-load safe-path
http://sourceware.org/ml/gdb-patches/2012-04/msg00092.html
http://sourceware.org/ml/gdb-cvs/2012-04/msg00114.html
### src/gdb/ChangeLog 2012/04/17 15:51:41 1.14113
### src/gdb/ChangeLog 2012/04/17 15:54:28 1.14114
## -1,5 +1,39 @@
2012-04-17 Jan Kratochvil <jan.kratochvil@redhat.com>
+ New option "set auto-load safe-path".
+ * NEWS: New commands "set auto-load safe-path"
+ and "show auto-load safe-path".
+ * auto-load.c: Include gdb_vecs.h, readline/tilde.h and completer.h.
+ (auto_load_safe_path, auto_load_safe_path_vec)
+ (auto_load_safe_path_vec_update, set_auto_load_safe_path)
+ (show_auto_load_safe_path, add_auto_load_safe_path, filename_is_in_dir)
+ (filename_is_in_auto_load_safe_path_vec, file_is_auto_load_safe): New.
+ (source_gdb_script_for_objfile): New variable is_safe. Call
+ file_is_auto_load_safe. Return if it is not.
+ (struct loaded_script): New field loaded.
+ (maybe_add_script): Add parameter loaded. Initialize SLOT with it.
+ (print_script): Use LOADED indicator instead of FULL_PATH. Change
+ output "Missing" to "No".
+ (_initialize_auto_load): New variable cmd. Initialize
+ auto_load_safe_path. Register "set auto-load safe-path",
+ "show auto-load safe-path" and "add-auto-load-safe-path".
+ * auto-load.h (maybe_add_script): Add parameter loaded.
+ (file_is_auto_load_safe): New declaration.
+ * config.in: Regenerate.
+ * configure: Regenerate.
+ * configure.ac: New parameters --with-auto-load-safe-path
+ and --without-auto-load-safe-path.
+ * linux-thread-db.c (try_thread_db_load_from_pdir_1)
+ (try_thread_db_load_from_dir): Check file_is_auto_load_safe first.
+ * main.c (captured_main): Check file_is_auto_load_safe for
+ LOCAL_GDBINIT.
+ * python/py-auto-load.c (gdbpy_load_auto_script_for_objfile): New
+ variable is_safe. Call file_is_auto_load_safe. Return if it is not.
+ (source_section_scripts): Call file_is_auto_load_safe. Return if it is
+ not.
+
+2012-04-17 Jan Kratochvil <jan.kratochvil@redhat.com>
+
auto-load: Implementation.
* NEWS: New descriptions for "info auto-load",
"info auto-load gdb-scripts", "info auto-load python-scripts",
Index: gdb-7.4.50.20120120/gdb/NEWS
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/NEWS 2012-04-18 00:49:02.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/NEWS 2012-04-18 00:49:33.282706319 +0200
@@ -67,6 +67,11 @@ set auto-load libthread-db on|off
show auto-load libthread-db
Control auto-loading of inferior specific thread debugging shared library.
+set auto-load safe-path <dir1>[:<dir2>...]
+show auto-load safe-path
+ Set a list of directories from which it is safe to auto-load files.
+ The delimiter (':' above) may differ according to the host platform.
+
* New command line options
--init-command=FILE, -ix Like --command, -x but execute it
Index: gdb-7.4.50.20120120/gdb/auto-load.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/auto-load.c 2012-04-18 00:46:47.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/auto-load.c 2012-04-18 00:49:21.607736020 +0200
@@ -32,6 +32,9 @@
#include "gdbcmd.h"
#include "cli/cli-decode.h"
#include "cli/cli-setshow.h"
+#include "gdb_vecs.h"
+#include "readline/tilde.h"
+#include "completer.h"
/* The suffix of per-objfile scripts to auto-load as non-Python command files.
E.g. When the program loads libfoo.so, look for libfoo-gdb.gdb. */
@@ -90,6 +93,181 @@ show_auto_load_local_gdbinit (struct ui_
value);
}
+/* Directory list safe to hold auto-loaded files. It is not checked for
+ absolute paths but they are strongly recommended. It is initialized by
+ _initialize_auto_load. */
+static char *auto_load_safe_path;
+
+/* Vector of directory elements of AUTO_LOAD_SAFE_PATH with each one normalized
+ by tilde_expand and possibly each entries has added its gdb_realpath
+ counterpart. */
+static VEC (char_ptr) *auto_load_safe_path_vec;
+
+/* Update auto_load_safe_path_vec from current AUTO_LOAD_SAFE_PATH. */
+
+static void
+auto_load_safe_path_vec_update (void)
+{
+ VEC (char_ptr) *dir_vec = NULL;
+ unsigned len;
+ int ix;
+
+ free_char_ptr_vec (auto_load_safe_path_vec);
+
+ auto_load_safe_path_vec = dirnames_to_char_ptr_vec (auto_load_safe_path);
+ len = VEC_length (char_ptr, auto_load_safe_path_vec);
+
+ /* Apply tilde_expand and gdb_realpath to each AUTO_LOAD_SAFE_PATH_VEC
+ element. */
+ for (ix = 0; ix < len; ix++)
+ {
+ char *dir = VEC_index (char_ptr, auto_load_safe_path_vec, ix);
+ char *expanded = tilde_expand (dir);
+ char *real_path = gdb_realpath (expanded);
+
+ /* Ensure the current entry is at least tilde_expand-ed. */
+ xfree (dir);
+ VEC_replace (char_ptr, auto_load_safe_path_vec, ix, expanded);
+
+ /* If gdb_realpath returns a different content, append it. */
+ if (strcmp (real_path, expanded) == 0)
+ xfree (real_path);
+ else
+ VEC_safe_push (char_ptr, auto_load_safe_path_vec, real_path);
+ }
+}
+
+/* "set" command for the auto_load_safe_path configuration variable. */
+
+static void
+set_auto_load_safe_path (char *args, int from_tty, struct cmd_list_element *c)
+{
+ auto_load_safe_path_vec_update ();
+}
+
+/* "show" command for the auto_load_safe_path configuration variable. */
+
+static void
+show_auto_load_safe_path (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ if (*value == 0)
+ fprintf_filtered (file, _("Auto-load files are safe to load from any "
+ "directory.\n"));
+ else
+ fprintf_filtered (file, _("List of directories from which it is safe to "
+ "auto-load files is %s.\n"),
+ value);
+}
+
+/* "add-auto-load-safe-path" command for the auto_load_safe_path configuration
+ variable. */
+
+static void
+add_auto_load_safe_path (char *args, int from_tty)
+{
+ char *s;
+
+ if (args == NULL || *args == 0)
+ error (_("\
+Adding empty directory element disables the auto-load safe-path security. \
+Use 'set auto-load safe-path' instead if you mean that."));
+
+ s = xstrprintf ("%s%c%s", auto_load_safe_path, DIRNAME_SEPARATOR, args);
+ xfree (auto_load_safe_path);
+ auto_load_safe_path = s;
+
+ auto_load_safe_path_vec_update ();
+}
+
+/* Return 1 if FILENAME is equal to DIR or if FILENAME belongs to the
+ subdirectory DIR. Return 0 otherwise. gdb_realpath normalization is never
+ done here. */
+
+static ATTRIBUTE_PURE int
+filename_is_in_dir (const char *filename, const char *dir)
+{
+ size_t dir_len = strlen (dir);
+
+ while (dir_len && IS_DIR_SEPARATOR (dir[dir_len - 1]))
+ dir_len--;
+
+ return (filename_ncmp (dir, filename, dir_len) == 0
+ && (IS_DIR_SEPARATOR (filename[dir_len])
+ || filename[dir_len] == '\0'));
+}
+
+/* Return 1 if FILENAME belongs to one of directory components of
+ AUTO_LOAD_SAFE_PATH_VEC. Return 0 otherwise.
+ auto_load_safe_path_vec_update is never called.
+ *FILENAME_REALP may be updated by gdb_realpath of FILENAME - it has to be
+ freed by the caller. */
+
+static int
+filename_is_in_auto_load_safe_path_vec (const char *filename,
+ char **filename_realp)
+{
+ char *dir;
+ int ix;
+
+ for (ix = 0; VEC_iterate (char_ptr, auto_load_safe_path_vec, ix, dir); ++ix)
+ if (*filename_realp == NULL && filename_is_in_dir (filename, dir))
+ break;
+
+ if (dir == NULL)
+ {
+ if (*filename_realp == NULL)
+ *filename_realp = gdb_realpath (filename);
+
+ for (ix = 0; VEC_iterate (char_ptr, auto_load_safe_path_vec, ix, dir);
+ ++ix)
+ if (filename_is_in_dir (*filename_realp, dir))
+ break;
+ }
+
+ if (dir != NULL)
+ return 1;
+
+ return 0;
+}
+
+/* Return 1 if FILENAME is located in one of the directories of
+ AUTO_LOAD_SAFE_PATH. Otherwise call warning and return 0. FILENAME does
+ not have to be an absolute path.
+
+ Existence of FILENAME is not checked. Function will still give a warning
+ even if the caller would quietly skip non-existing file in unsafe
+ directory. */
+
+int
+file_is_auto_load_safe (const char *filename)
+{
+ char *filename_real = NULL;
+ struct cleanup *back_to;
+
+ back_to = make_cleanup (free_current_contents, &filename_real);
+
+ if (filename_is_in_auto_load_safe_path_vec (filename, &filename_real))
+ {
+ do_cleanups (back_to);
+ return 1;
+ }
+
+ auto_load_safe_path_vec_update ();
+ if (filename_is_in_auto_load_safe_path_vec (filename, &filename_real))
+ {
+ do_cleanups (back_to);
+ return 1;
+ }
+
+ warning (_("File \"%s\" auto-loading has been declined by your "
+ "`auto-load safe-path' set to \"%s\"."),
+ filename_real, auto_load_safe_path);
+
+ do_cleanups (back_to);
+ return 0;
+}
+
/* Definition of script language for GDB canned sequences of commands. */
static const struct script_language script_language_gdb
@@ -99,13 +277,20 @@ static void
source_gdb_script_for_objfile (struct objfile *objfile, FILE *file,
const char *filename)
{
+ int is_safe;
struct auto_load_pspace_info *pspace_info;
volatile struct gdb_exception e;
+ is_safe = file_is_auto_load_safe (filename);
+
/* Add this script to the hash table too so "info auto-load gdb-scripts"
can print it. */
pspace_info = get_auto_load_pspace_data_for_loading (current_program_space);
- maybe_add_script (pspace_info, filename, filename, &script_language_gdb);
+ maybe_add_script (pspace_info, is_safe, filename, filename,
+ &script_language_gdb);
+
+ if (!is_safe)
+ return;
TRY_CATCH (e, RETURN_MASK_ALL)
{
@@ -140,6 +325,9 @@ struct loaded_script
inaccessible). */
const char *full_path;
+ /* Non-zero if this script has been loaded. */
+ int loaded;
+
const struct script_language *language;
};
@@ -232,12 +420,13 @@ get_auto_load_pspace_data_for_loading (s
return info;
}
-/* Add script NAME in LANGUAGE to hash table of PSPACE_INFO.
- FULL_PATH is NULL if the script wasn't found. The result is
+/* Add script NAME in LANGUAGE to hash table of PSPACE_INFO. LOADED 1 if the
+ script has been (is going to) be loaded, 0 otherwise (such as if it has not
+ been found). FULL_PATH is NULL if the script wasn't found. The result is
true if the script was already in the hash table. */
int
-maybe_add_script (struct auto_load_pspace_info *pspace_info,
+maybe_add_script (struct auto_load_pspace_info *pspace_info, int loaded,
const char *name, const char *full_path,
const struct script_language *language)
{
@@ -271,6 +460,7 @@ maybe_add_script (struct auto_load_pspac
}
else
(*slot)->full_path = NULL;
+ (*slot)->loaded = loaded;
(*slot)->language = language;
}
@@ -432,7 +622,7 @@ print_script (struct loaded_script *scri
chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
- ui_out_field_string (uiout, "loaded", script->full_path ? "Yes" : "Missing");
+ ui_out_field_string (uiout, "loaded", script->loaded ? "Yes" : "No");
ui_out_field_string (uiout, "script", script->name);
ui_out_text (uiout, "\n");
@@ -718,6 +908,8 @@ void _initialize_auto_load (void);
void
_initialize_auto_load (void)
{
+ struct cmd_list_element *cmd;
+
auto_load_pspace_data
= register_program_space_data_with_cleanup (auto_load_pspace_data_cleanup);
@@ -757,4 +949,30 @@ This options has security implications f
_("Print whether current directory .gdbinit file has been loaded.\n\
Usage: info auto-load local-gdbinit"),
auto_load_info_cmdlist_get ());
+
+ auto_load_safe_path = xstrdup (DEFAULT_AUTO_LOAD_SAFE_PATH);
+ auto_load_safe_path_vec_update ();
+ add_setshow_optional_filename_cmd ("safe-path", class_support,
+ &auto_load_safe_path, _("\
+Set the list of directories from which it is safe to auto-load files."), _("\
+Show the list of directories from which it is safe to auto-load files."), _("\
+Various files loaded automatically for the 'set auto-load ...' options must\n\
+be located in one of the directories listed by this option. Warning will be\n\
+printed and file will not be used otherwise. Use empty string (or even\n\
+empty directory entry) to allow any file for the 'set auto-load ...' options.\n\
+This option is ignored for the kinds of files having 'set auto-load ... off'.\n\
+This options has security implications for untrusted inferiors."),
+ set_auto_load_safe_path,
+ show_auto_load_safe_path,
+ auto_load_set_cmdlist_get (),
+ auto_load_show_cmdlist_get ());
+
+ cmd = add_cmd ("add-auto-load-safe-path", class_support,
+ add_auto_load_safe_path,
+ _("Add entries to the list of directories from which it is safe "
+ "to auto-load files.\n\
+See the commands 'set auto-load safe-path' and 'show auto-load safe-path' to\n\
+access the current full list setting."),
+ &cmdlist);
+ set_cmd_completer (cmd, filename_completer);
}
Index: gdb-7.4.50.20120120/gdb/auto-load.h
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/auto-load.h 2012-04-18 00:46:47.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/auto-load.h 2012-04-18 00:49:21.607736020 +0200
@@ -39,7 +39,8 @@ extern int auto_load_local_gdbinit_loade
extern struct auto_load_pspace_info *
get_auto_load_pspace_data_for_loading (struct program_space *pspace);
extern int maybe_add_script (struct auto_load_pspace_info *pspace_info,
- const char *name, const char *full_path,
+ int loaded, const char *name,
+ const char *full_path,
const struct script_language *language);
extern void auto_load_objfile_script (struct objfile *objfile,
const struct script_language *language);
@@ -54,4 +55,6 @@ extern struct cmd_list_element **auto_lo
extern struct cmd_list_element **auto_load_show_cmdlist_get (void);
extern struct cmd_list_element **auto_load_info_cmdlist_get (void);
+extern int file_is_auto_load_safe (const char *filename);
+
#endif /* AUTO_LOAD_H */
Index: gdb-7.4.50.20120120/gdb/config.in
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/config.in 2012-04-18 00:46:47.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/config.in 2012-04-18 00:49:21.607736020 +0200
@@ -43,6 +43,9 @@
moved. */
#undef DEBUGDIR_RELOCATABLE
+/* Directories safe to hold auto-loaded files. */
+#undef DEFAULT_AUTO_LOAD_SAFE_PATH
+
/* Define to BFD's default architecture. */
#undef DEFAULT_BFD_ARCH
Index: gdb-7.4.50.20120120/gdb/configure
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/configure 2012-04-18 00:46:47.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/configure 2012-04-18 00:49:21.611736010 +0200
@@ -955,6 +955,7 @@ with_separate_debug_dir
with_gdb_datadir
with_relocated_sources
with_rpm
+with_auto_load_safe_path
enable_targets
enable_64_bit_bfd
enable_gdbcli
@@ -1666,6 +1667,10 @@ Optional Packages:
automatically relocate this path for source files
--with-rpm query rpm database for missing debuginfos (yes/no,
def. auto=librpm.so)
+ --with-auto-load-safe-path=PATH
+ directories safe to hold auto-loaded files
+ --without-auto-load-safe-path
+ do not restrict auto-loaded files locations
--with-libunwind use libunwind frame unwinding support
--with-curses use the curses library instead of the termcap
library
@@ -8477,6 +8482,32 @@ $as_echo "$as_me: WARNING: $RPM_PKG_ERRO
fi
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for default auto-load safe-path" >&5
+$as_echo_n "checking for default auto-load safe-path... " >&6; }
+
+# Check whether --with-auto-load-safe-path was given.
+if test "${with_auto_load_safe_path+set}" = set; then :
+ withval=$with_auto_load_safe_path; if test "$with_auto_load_safe_path" = "no"; then
+ with_auto_load_safe_path=""
+ fi
+else
+ with_auto_load_safe_path="$prefix"
+fi
+
+
+ test "x$prefix" = xNONE && prefix="$ac_default_prefix"
+ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+ ac_define_dir=`eval echo $with_auto_load_safe_path`
+ ac_define_dir=`eval echo $ac_define_dir`
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_AUTO_LOAD_SAFE_PATH "$ac_define_dir"
+_ACEOF
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
+$as_echo "$with_auto_load_safe_path" >&6; }
+
subdirs="$subdirs testsuite"
Index: gdb-7.4.50.20120120/gdb/configure.ac
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/configure.ac 2012-04-18 00:46:47.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/configure.ac 2012-04-18 00:49:21.611736010 +0200
@@ -339,6 +339,18 @@ extern rpmdbMatchIterator rpmtsInitItera
fi
fi
+AC_MSG_CHECKING([for default auto-load safe-path])
+AC_ARG_WITH(auto-load-safe-path,
+AS_HELP_STRING([--with-auto-load-safe-path=PATH], [directories safe to hold auto-loaded files])
+AS_HELP_STRING([--without-auto-load-safe-path], [do not restrict auto-loaded files locations]),
+[if test "$with_auto_load_safe_path" = "no"; then
+ with_auto_load_safe_path=""
+ fi],
+[with_auto_load_safe_path="$prefix"])
+AC_DEFINE_DIR(DEFAULT_AUTO_LOAD_SAFE_PATH, with_auto_load_safe_path,
+ [Directories safe to hold auto-loaded files.])
+AC_MSG_RESULT([$with_auto_load_safe_path])
+
AC_CONFIG_SUBDIRS(testsuite)
# Check whether to support alternative target configurations
Index: gdb-7.4.50.20120120/gdb/linux-thread-db.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/linux-thread-db.c 2012-04-18 00:46:47.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/linux-thread-db.c 2012-04-18 00:49:21.612736007 +0200
@@ -868,7 +868,11 @@ try_thread_db_load_from_pdir_1 (struct o
/* This should at minimum hit the first character. */
gdb_assert (cp != NULL);
strcpy (cp + 1, LIBTHREAD_DB_SO);
- result = try_thread_db_load (path);
+
+ if (!file_is_auto_load_safe (path))
+ result = 0;
+ else
+ result = try_thread_db_load (path);
do_cleanups (cleanup);
return result;
@@ -934,7 +938,11 @@ try_thread_db_load_from_dir (const char
memcpy (path, dir, dir_len);
path[dir_len] = '/';
strcpy (path + dir_len + 1, LIBTHREAD_DB_SO);
- result = try_thread_db_load (path);
+
+ if (!file_is_auto_load_safe (path))
+ result = 0;
+ else
+ result = try_thread_db_load (path);
do_cleanups (cleanup);
return result;
Index: gdb-7.4.50.20120120/gdb/main.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/main.c 2012-04-18 00:46:47.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/main.c 2012-04-18 00:49:21.612736007 +0200
@@ -1026,7 +1026,8 @@ captured_main (void *data)
{
auto_load_local_gdbinit_pathname = gdb_realpath (local_gdbinit);
- if (!inhibit_gdbinit && auto_load_local_gdbinit)
+ if (!inhibit_gdbinit && auto_load_local_gdbinit
+ && file_is_auto_load_safe (local_gdbinit))
{
auto_load_local_gdbinit_loaded = 1;
Index: gdb-7.4.50.20120120/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/doc/gdb.texinfo 2012-04-18 00:46:47.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/doc/gdb.texinfo 2012-04-18 00:49:21.620735987 +0200
@@ -20801,6 +20801,8 @@ gdb-scripts: Auto-loading of canned seq
libthread-db: Auto-loading of inferior specific libthread_db is on.
local-gdbinit: Auto-loading of .gdbinit script from current directory is on.
python-scripts: Auto-loading of Python scripts is on.
+safe-path: List of directories from which it is safe to auto-load files
+ is /usr/local.
@end smallexample
@anchor{info auto-load}
@@ -20872,12 +20874,19 @@ These are @value{GDBN} control commands
@tab Show setting of thread debugging library.
@item @xref{info auto-load libthread-db}.
@tab Show state of thread debugging library.
+@item @xref{set auto-load safe-path}.
+@tab Control directories trusted for automatic loading.
+@item @xref{show auto-load safe-path}.
+@tab Show directories trusted for automatic loading.
+@item @xref{add-auto-load-safe-path}.
+@tab Add directory trusted for automatic loading.
@end multitable
@menu
* Init File in the Current Directory:: @samp{set/show/info auto-load local-gdbinit}
* libthread_db.so.1 file:: @samp{set/show/info auto-load libthread-db}
* objfile-gdb.gdb file:: @samp{set/show/info auto-load gdb-script}
+* Auto-loading safe path:: @samp{set/show/info auto-load safe-path}
@xref{Python Auto-loading}.
@end menu
@@ -20978,6 +20987,104 @@ auto-loaded.
If @var{regexp} is supplied only canned sequences of commands scripts with
matching names are printed.
+@node Auto-loading safe path
+@subsection Security restriction for auto-loading
+@cindex auto-loading safe-path
+
+As the files of inferior can come from untrusted source (such as submitted by
+an application user) @value{GDBN} does not always load any files automatically.
+@value{GDBN} provides the @samp{set auto-load safe-path} setting to list
+directories trusted for loading files not explicitly requested by user.
+
+If the path is not set properly you will see a warning and the file will not
+get loaded:
+
+@smallexample
+$ ./gdb -q ./gdb
+Reading symbols from /home/user/gdb/gdb...done.
+warning: File "/home/user/gdb/gdb-gdb.gdb" auto-loading has been
+ declined by your `auto-load safe-path' set to "/usr/local".
+warning: File "/home/user/gdb/gdb-gdb.py" auto-loading has been
+ declined by your `auto-load safe-path' set to "/usr/local".
+@end smallexample
+
+The list of trusted directories is controlled by the following commands:
+
+@table @code
+@anchor{set auto-load safe-path}
+@kindex set auto-load safe-path
+@item set auto-load safe-path @var{directories}
+Set the list of directories (and their subdirectories) trusted for automatic
+loading and execution of scripts. You can also enter a specific trusted file.
+The list of directories uses directory separator (@samp{:} on GNU and Unix
+systems, @samp{;} on MS-Windows and MS-DOS) to separate directories, similarly
+to the @env{PATH} environment variable.
+
+@anchor{show auto-load safe-path}
+@kindex show auto-load safe-path
+@item show auto-load safe-path
+Show the list of directories trusted for automatic loading and execution of
+scripts.
+
+@anchor{add-auto-load-safe-path}
+@kindex add-auto-load-safe-path
+@item add-auto-load-safe-path
+Add an entry (or list of entries) the list of directories trusted for automatic
+loading and execution of scripts. Multiple entries may be delimited by the
+host platform directory separator in use.
+@end table
+
+Setting this variable to an empty string disables this security protection.
+This variable is supposed to be set to the system directories writable by the
+system superuser only. Users can add their source directories in init files in
+their home directories (@pxref{Home Directory Init File}). See also deprecated
+init file in the current directory
+(@pxref{Init File in the Current Directory during Startup}).
+
+To force @value{GDBN} to load the files it declined to load in the previous
+example, you could use one of the following ways:
+
+@itemize @bullet
+@item ~/.gdbinit: add-auto-load-safe-path ~/src/gdb
+Specify this trusted directory (or a file) as additional component of the list.
+You have to specify also any existing directories displayed by
+by @samp{show auto-load safe-path} (such as @samp{/usr:/bin} in this example).
+
+@item @kbd{gdb -iex "set auto-load safe-path /usr:/bin:~/src/gdb" [@dots{}]}
+Specify this directory as in the previous case but just for a single
+@value{GDBN} session.
+
+@item @kbd{gdb -iex "set auto-load safe-path" [@dots{}]}
+Disable auto-loading safety for a single @value{GDBN} session.
+This assumes all the files you debug during this @value{GDBN} session will come
+from trusted sources.
+
+@item @kbd{./configure --without-auto-load-safe-path}
+During compilation of @value{GDBN} you may disable any auto-loading safety.
+This assumes all the files you will ever debug with this @value{GDBN} come from
+trusted sources.
+@end itemize
+
+On the other hand you can also explicitly forbid automatic files loading which
+also suppresses any such warning messages:
+
+@itemize @bullet
+@item @kbd{gdb -iex "set auto-load no" [@dots{}]}
+You can use @value{GDBN} command-line option for a single @value{GDBN} session.
+
+@item @samp{~/.gdbinit}: @samp{set auto-load no}
+Disable auto-loading globally for the user
+(@pxref{Home Directory Init File}). While it is improbable, you could also
+use system init file instead (@pxref{System-wide configuration}).
+@end itemize
+
+This setting applies to the file names as entered by user. If no entry matches
+@value{GDBN} tries as a last resort to also resolve all the file names into
+their canonical form (typically resolving symbolic links) and compare the
+entries again. @value{GDBN} already canonicalizes most of the filenames on its
+own before starting the comparison so a canonical form of directories is
+recommended to be entered.
+
@node Messages/Warnings
@section Optional Warnings and Messages
@@ -24955,10 +25062,10 @@ Example:
@smallexample
(gdb) info auto-load python-scripts
-Loaded Script
-Yes py-section-script.py
- full name: /tmp/py-section-script.py
-Missing my-foo-pretty-printers.py
+Loaded Script
+Yes py-section-script.py
+ full name: /tmp/py-section-script.py
+No my-foo-pretty-printers.py
@end smallexample
@end table
Index: gdb-7.4.50.20120120/gdb/python/py-auto-load.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/python/py-auto-load.c 2012-04-18 00:46:47.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/python/py-auto-load.c 2012-04-18 00:49:21.621735985 +0200
@@ -72,14 +72,19 @@ static void
gdbpy_load_auto_script_for_objfile (struct objfile *objfile, FILE *file,
const char *filename)
{
+ int is_safe;
struct auto_load_pspace_info *pspace_info;
+ is_safe = file_is_auto_load_safe (filename);
+
/* Add this script to the hash table too so "info auto-load python-scripts"
can print it. */
pspace_info = get_auto_load_pspace_data_for_loading (current_program_space);
- maybe_add_script (pspace_info, filename, filename, &script_language_python);
+ maybe_add_script (pspace_info, is_safe, filename, filename,
+ &script_language_python);
- source_python_script_for_objfile (objfile, file, filename);
+ if (is_safe)
+ source_python_script_for_objfile (objfile, file, filename);
}
/* Load scripts specified in OBJFILE.
@@ -147,6 +152,9 @@ source_section_scripts (struct objfile *
{
make_cleanup_fclose (stream);
make_cleanup (xfree, full_path);
+
+ if (!file_is_auto_load_safe (full_path))
+ opened = 0;
}
else
{
@@ -167,7 +175,7 @@ Use `info auto-load python [REGEXP]' to
IWBN if complaints.c were more general-purpose. */
- in_hash_table = maybe_add_script (pspace_info, file, full_path,
+ in_hash_table = maybe_add_script (pspace_info, opened, file, full_path,
&script_language_python);
/* If this file is not currently loaded, load it. */
Index: gdb-7.4.50.20120120/gdb/testsuite/gdb.python/py-objfile-script.exp
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/testsuite/gdb.python/py-objfile-script.exp 2012-04-18 00:46:47.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/testsuite/gdb.python/py-objfile-script.exp 2012-04-18 00:49:21.621735985 +0200
@@ -37,6 +37,7 @@ if { [skip_python_tests] } { continue }
set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}-gdb.py.in ${subdir}/${testfile}-gdb.py]
gdb_reinitialize_dir $srcdir/$subdir
+gdb_test_no_output "set auto-load safe-path ${remote_python_file}" "set auto-load safe-path"
gdb_load ${binfile}
# Verify gdb loaded the script.
Index: gdb-7.4.50.20120120/gdb/testsuite/gdb.python/py-section-script.exp
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/testsuite/gdb.python/py-section-script.exp 2012-04-18 00:46:47.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/testsuite/gdb.python/py-section-script.exp 2012-04-18 00:49:21.621735985 +0200
@@ -49,6 +49,7 @@ if { [skip_python_tests] } { continue }
set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
gdb_reinitialize_dir $srcdir/$subdir
+gdb_test_no_output "set auto-load safe-path ${remote_python_file}" "set auto-load safe-path"
gdb_load ${binfile}
# Verify gdb loaded the script.

View File

@ -1,352 +0,0 @@
[patch#4 6/8] set debug auto-load
http://sourceware.org/ml/gdb-patches/2012-04/msg00089.html
http://sourceware.org/ml/gdb-cvs/2012-04/msg00115.html
### src/gdb/ChangeLog 2012/04/17 15:54:28 1.14114
### src/gdb/ChangeLog 2012/04/17 15:56:20 1.14115
## -1,5 +1,27 @@
2012-04-17 Jan Kratochvil <jan.kratochvil@redhat.com>
+ New option "set debug auto-load".
+ * NEWS: New commands "set debug auto-load" and "show debug auto-load".
+ * auto-load.c (debug_auto_load, show_debug_auto_load: New.
+ (auto_load_safe_path_vec_update)
+ (filename_is_in_auto_load_safe_path_vec): Call fprintf_unfiltered
+ if DEBUG_AUTO_LOAD.
+ (file_is_auto_load_safe): New parameters debug_fmt and ....
+ Call fprintf_unfiltered if DEBUG_AUTO_LOAD.
+ (source_gdb_script_for_objfile): Extend the file_is_auto_load_safe
+ caller by explanatory string.
+ (_initialize_auto_load): Register "set debug auto-load".
+ * auto-load.h (file_is_auto_load_safe): New parameters debug_fmt
+ and ....
+ * linux-thread-db.c (try_thread_db_load_from_pdir_1)
+ (try_thread_db_load_from_dir): Extend the file_is_auto_load_safe caller
+ by explanatory string.
+ * main.c (captured_main): Likewise.
+ * python/py-auto-load.c (gdbpy_load_auto_script_for_objfile)
+ (source_section_scripts): Likewise.
+
+2012-04-17 Jan Kratochvil <jan.kratochvil@redhat.com>
+
New option "set auto-load safe-path".
* NEWS: New commands "set auto-load safe-path"
and "show auto-load safe-path".
Index: gdb-7.4.50.20120120/gdb/NEWS
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/NEWS 2012-04-18 00:49:33.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/NEWS 2012-04-18 00:50:15.018600282 +0200
@@ -72,6 +72,10 @@ show auto-load safe-path
Set a list of directories from which it is safe to auto-load files.
The delimiter (':' above) may differ according to the host platform.
+set debug auto-load on|off
+show debug auto-load
+ Control display of debugging info for auto-loading the files above.
+
* New command line options
--init-command=FILE, -ix Like --command, -x but execute it
Index: gdb-7.4.50.20120120/gdb/auto-load.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/auto-load.c 2012-04-18 00:49:21.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/auto-load.c 2012-04-18 00:50:04.801626235 +0200
@@ -43,6 +43,20 @@
static void source_gdb_script_for_objfile (struct objfile *objfile, FILE *file,
const char *filename);
+/* Value of the 'set debug auto-load' configuration variable. */
+static int debug_auto_load = 0;
+
+/* "show" command for the debug_auto_load configuration variable. */
+
+static void
+show_debug_auto_load (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ fprintf_filtered (file, _("Debugging output for files "
+ "of 'set auto-load ...' is %s.\n"),
+ value);
+}
+
/* User-settable option to enable/disable auto-loading of GDB_AUTO_FILE_NAME
scripts:
set auto-load gdb-scripts on|off
@@ -112,6 +126,11 @@ auto_load_safe_path_vec_update (void)
unsigned len;
int ix;
+ if (debug_auto_load)
+ fprintf_unfiltered (gdb_stdlog,
+ _("auto-load: Updating directories of \"%s\".\n"),
+ auto_load_safe_path);
+
free_char_ptr_vec (auto_load_safe_path_vec);
auto_load_safe_path_vec = dirnames_to_char_ptr_vec (auto_load_safe_path);
@@ -126,14 +145,34 @@ auto_load_safe_path_vec_update (void)
char *real_path = gdb_realpath (expanded);
/* Ensure the current entry is at least tilde_expand-ed. */
- xfree (dir);
VEC_replace (char_ptr, auto_load_safe_path_vec, ix, expanded);
+ if (debug_auto_load)
+ {
+ if (strcmp (expanded, dir) == 0)
+ fprintf_unfiltered (gdb_stdlog,
+ _("auto-load: Using directory \"%s\".\n"),
+ expanded);
+ else
+ fprintf_unfiltered (gdb_stdlog,
+ _("auto-load: Resolved directory \"%s\" "
+ "as \"%s\".\n"),
+ dir, expanded);
+ }
+ xfree (dir);
+
/* If gdb_realpath returns a different content, append it. */
if (strcmp (real_path, expanded) == 0)
xfree (real_path);
else
- VEC_safe_push (char_ptr, auto_load_safe_path_vec, real_path);
+ {
+ VEC_safe_push (char_ptr, auto_load_safe_path_vec, real_path);
+
+ if (debug_auto_load)
+ fprintf_unfiltered (gdb_stdlog,
+ _("auto-load: And canonicalized as \"%s\".\n"),
+ real_path);
+ }
}
}
@@ -217,16 +256,30 @@ filename_is_in_auto_load_safe_path_vec (
if (dir == NULL)
{
if (*filename_realp == NULL)
- *filename_realp = gdb_realpath (filename);
+ {
+ *filename_realp = gdb_realpath (filename);
+ if (debug_auto_load && strcmp (*filename_realp, filename) != 0)
+ fprintf_unfiltered (gdb_stdlog,
+ _("auto-load: Resolved "
+ "file \"%s\" as \"%s\".\n"),
+ filename, *filename_realp);
+ }
- for (ix = 0; VEC_iterate (char_ptr, auto_load_safe_path_vec, ix, dir);
- ++ix)
- if (filename_is_in_dir (*filename_realp, dir))
- break;
+ if (strcmp (*filename_realp, filename) != 0)
+ for (ix = 0; VEC_iterate (char_ptr, auto_load_safe_path_vec, ix, dir);
+ ++ix)
+ if (filename_is_in_dir (*filename_realp, dir))
+ break;
}
if (dir != NULL)
- return 1;
+ {
+ if (debug_auto_load)
+ fprintf_unfiltered (gdb_stdlog, _("auto-load: File \"%s\" matches "
+ "directory \"%s\".\n"),
+ filename, dir);
+ return 1;
+ }
return 0;
}
@@ -240,11 +293,20 @@ filename_is_in_auto_load_safe_path_vec (
directory. */
int
-file_is_auto_load_safe (const char *filename)
+file_is_auto_load_safe (const char *filename, const char *debug_fmt, ...)
{
char *filename_real = NULL;
struct cleanup *back_to;
+ if (debug_auto_load)
+ {
+ va_list debug_args;
+
+ va_start (debug_args, debug_fmt);
+ vfprintf_unfiltered (gdb_stdlog, debug_fmt, debug_args);
+ va_end (debug_args);
+ }
+
back_to = make_cleanup (free_current_contents, &filename_real);
if (filename_is_in_auto_load_safe_path_vec (filename, &filename_real))
@@ -281,7 +343,10 @@ source_gdb_script_for_objfile (struct ob
struct auto_load_pspace_info *pspace_info;
volatile struct gdb_exception e;
- is_safe = file_is_auto_load_safe (filename);
+ is_safe = file_is_auto_load_safe (filename, _("auto-load: Loading canned "
+ "sequences of commands script "
+ "\"%s\" for objfile \"%s\".\n"),
+ filename, objfile->name);
/* Add this script to the hash table too so "info auto-load gdb-scripts"
can print it. */
@@ -975,4 +1040,13 @@ See the commands 'set auto-load safe-pat
access the current full list setting."),
&cmdlist);
set_cmd_completer (cmd, filename_completer);
+
+ add_setshow_boolean_cmd ("auto-load", class_maintenance,
+ &debug_auto_load, _("\
+Set auto-load verifications debugging."), _("\
+Show auto-load verifications debugging."), _("\
+When non-zero, debugging output for files of 'set auto-load ...'\n\
+is displayed."),
+ NULL, show_debug_auto_load,
+ &setdebuglist, &showdebuglist);
}
Index: gdb-7.4.50.20120120/gdb/auto-load.h
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/auto-load.h 2012-04-18 00:49:21.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/auto-load.h 2012-04-18 00:50:04.801626235 +0200
@@ -55,6 +55,7 @@ extern struct cmd_list_element **auto_lo
extern struct cmd_list_element **auto_load_show_cmdlist_get (void);
extern struct cmd_list_element **auto_load_info_cmdlist_get (void);
-extern int file_is_auto_load_safe (const char *filename);
+extern int file_is_auto_load_safe (const char *filename,
+ const char *debug_fmt, ...);
#endif /* AUTO_LOAD_H */
Index: gdb-7.4.50.20120120/gdb/linux-thread-db.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/linux-thread-db.c 2012-04-18 00:49:21.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/linux-thread-db.c 2012-04-18 00:50:04.801626235 +0200
@@ -869,7 +869,9 @@ try_thread_db_load_from_pdir_1 (struct o
gdb_assert (cp != NULL);
strcpy (cp + 1, LIBTHREAD_DB_SO);
- if (!file_is_auto_load_safe (path))
+ if (!file_is_auto_load_safe (path, _("auto-load: Loading libthread-db "
+ "library \"%s\" from $pdir.\n"),
+ path))
result = 0;
else
result = try_thread_db_load (path);
@@ -939,7 +941,10 @@ try_thread_db_load_from_dir (const char
path[dir_len] = '/';
strcpy (path + dir_len + 1, LIBTHREAD_DB_SO);
- if (!file_is_auto_load_safe (path))
+ if (!file_is_auto_load_safe (path, _("auto-load: Loading libthread-db "
+ "library \"%s\" from explicit "
+ "directory.\n"),
+ path))
result = 0;
else
result = try_thread_db_load (path);
Index: gdb-7.4.50.20120120/gdb/main.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/main.c 2012-04-18 00:49:21.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/main.c 2012-04-18 00:50:04.801626235 +0200
@@ -1027,7 +1027,10 @@ captured_main (void *data)
auto_load_local_gdbinit_pathname = gdb_realpath (local_gdbinit);
if (!inhibit_gdbinit && auto_load_local_gdbinit
- && file_is_auto_load_safe (local_gdbinit))
+ && file_is_auto_load_safe (local_gdbinit,
+ _("auto-load: Loading .gdbinit "
+ "file \"%s\".\n"),
+ local_gdbinit))
{
auto_load_local_gdbinit_loaded = 1;
Index: gdb-7.4.50.20120120/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/doc/gdb.texinfo 2012-04-18 00:49:21.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/doc/gdb.texinfo 2012-04-18 00:50:04.809626215 +0200
@@ -20887,6 +20887,7 @@ These are @value{GDBN} control commands
* libthread_db.so.1 file:: @samp{set/show/info auto-load libthread-db}
* objfile-gdb.gdb file:: @samp{set/show/info auto-load gdb-script}
* Auto-loading safe path:: @samp{set/show/info auto-load safe-path}
+* Auto-loading verbose mode:: @samp{set/show debug auto-load}
@xref{Python Auto-loading}.
@end menu
@@ -21085,6 +21086,45 @@ entries again. @value{GDBN} already can
own before starting the comparison so a canonical form of directories is
recommended to be entered.
+@node Auto-loading verbose mode
+@subsection Displaying files tried for auto-load
+@cindex auto-loading verbose mode
+
+For better visibility of all the file locations where you can place scripts to
+be auto-loaded with inferior --- or to protect yourself against accidental
+execution of untrusted scripts --- @value{GDBN} provides a feature for printing
+all the files attempted to be loaded. Both existing and non-existing files may
+be printed.
+
+For example the list of directories from which it is safe to auto-load files
+(@pxref{Auto-loading safe path}) applies also to canonicalized filenames which
+may not be too obvious while setting it up.
+
+@smallexample
+(gdb) set debug auto-load ues
+(gdb) file ~/src/t/true
+auto-load: Loading canned sequences of commands script "/tmp/true-gdb.gdb"
+ for objfile "/tmp/true".
+auto-load: Updating directories of "/usr:/opt".
+auto-load: Using directory "/usr".
+auto-load: Using directory "/opt".
+warning: File "/tmp/true-gdb.gdb" auto-loading has been declined
+ by your `auto-load safe-path' set to "/usr:/opt".
+@end smallexample
+
+@table @code
+@anchor{set debug auto-load}
+@kindex set debug auto-load
+@item set debug auto-load [on|off]
+Set whether to print the filenames attempted to be auto-loaded.
+
+@anchor{show debug auto-load}
+@kindex show debug auto-load
+@item show debug auto-load
+Show whether printing of the filenames attempted to be auto-loaded is turned
+on or off.
+@end table
+
@node Messages/Warnings
@section Optional Warnings and Messages
Index: gdb-7.4.50.20120120/gdb/python/py-auto-load.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/python/py-auto-load.c 2012-04-18 00:49:21.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/python/py-auto-load.c 2012-04-18 00:50:04.810626212 +0200
@@ -75,7 +75,10 @@ gdbpy_load_auto_script_for_objfile (stru
int is_safe;
struct auto_load_pspace_info *pspace_info;
- is_safe = file_is_auto_load_safe (filename);
+ is_safe = file_is_auto_load_safe (filename,
+ _("auto-load: Loading Python script \"%s\" "
+ "by extension for objfile \"%s\".\n"),
+ filename, objfile->name);
/* Add this script to the hash table too so "info auto-load python-scripts"
can print it. */
@@ -153,7 +156,12 @@ source_section_scripts (struct objfile *
make_cleanup_fclose (stream);
make_cleanup (xfree, full_path);
- if (!file_is_auto_load_safe (full_path))
+ if (!file_is_auto_load_safe (full_path,
+ _("auto-load: Loading Python script "
+ "\"%s\" from section \"%s\" of "
+ "objfile \"%s\".\n"),
+ full_path, GDBPY_AUTO_SECTION_NAME,
+ objfile->name))
opened = 0;
}
else

View File

@ -1,23 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-04/msg00130.html
### src/gdb/doc/ChangeLog 2012/04/17 15:56:21 1.1297
### src/gdb/doc/ChangeLog 2012/04/18 07:03:57 1.1298
## -1,3 +1,7 @@
+2012-04-18 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.texinfo (Auto-loading verbose mode): Fix smallexample typo.
+
2012-04-17 Jan Kratochvil <jan.kratochvil@redhat.com>
New option "set debug auto-load".
--- src/gdb/doc/gdb.texinfo 2012/04/17 15:56:21 1.944
+++ src/gdb/doc/gdb.texinfo 2012/04/18 07:03:58 1.945
@@ -21192,7 +21192,7 @@
may not be too obvious while setting it up.
@smallexample
-(gdb) set debug auto-load ues
+(gdb) set debug auto-load on
(gdb) file ~/src/t/true
auto-load: Loading canned sequences of commands script "/tmp/true-gdb.gdb"
for objfile "/tmp/true".

View File

@ -1,51 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-04/msg00178.html
### src/gdb/doc/ChangeLog 2012/04/18 07:03:57 1.1298
### src/gdb/doc/ChangeLog 2012/04/22 15:49:21 1.1299
## -1,3 +1,8 @@
+2012-04-22 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.texinfo (Auto-loading safe path): Replace @itemize @bullet
+ by @table @asis. Fix formatting of one item.
+
2012-04-18 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Auto-loading verbose mode): Fix smallexample typo.
--- src/gdb/doc/gdb.texinfo 2012/04/18 07:03:58 1.945
+++ src/gdb/doc/gdb.texinfo 2012/04/22 15:49:21 1.946
@@ -21136,8 +21136,8 @@
To force @value{GDBN} to load the files it declined to load in the previous
example, you could use one of the following ways:
-@itemize @bullet
-@item ~/.gdbinit: add-auto-load-safe-path ~/src/gdb
+@table @asis
+@item @file{~/.gdbinit}: @samp{add-auto-load-safe-path ~/src/gdb}
Specify this trusted directory (or a file) as additional component of the list.
You have to specify also any existing directories displayed by
by @samp{show auto-load safe-path} (such as @samp{/usr:/bin} in this example).
@@ -21155,20 +21155,20 @@
During compilation of @value{GDBN} you may disable any auto-loading safety.
This assumes all the files you will ever debug with this @value{GDBN} come from
trusted sources.
-@end itemize
+@end table
On the other hand you can also explicitly forbid automatic files loading which
also suppresses any such warning messages:
-@itemize @bullet
+@table @asis
@item @kbd{gdb -iex "set auto-load no" [@dots{}]}
You can use @value{GDBN} command-line option for a single @value{GDBN} session.
-@item @samp{~/.gdbinit}: @samp{set auto-load no}
+@item @file{~/.gdbinit}: @samp{set auto-load no}
Disable auto-loading globally for the user
(@pxref{Home Directory Init File}). While it is improbable, you could also
use system init file instead (@pxref{System-wide configuration}).
-@end itemize
+@end table
This setting applies to the file names as entered by user. If no entry matches
@value{GDBN} tries as a last resort to also resolve all the file names into

View File

@ -1,38 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-04/msg00183.html
### src/gdb/doc/ChangeLog 2012/04/22 15:49:21 1.1299
### src/gdb/doc/ChangeLog 2012/04/23 17:20:56 1.1300
## -1,3 +1,8 @@
+2012-04-23 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.texinfo (Auto-loading safe path): Remove trailing [@dots{}].
+ Three times.
+
2012-04-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Auto-loading safe path): Replace @itemize @bullet
--- src/gdb/doc/gdb.texinfo 2012/04/22 15:49:21 1.946
+++ src/gdb/doc/gdb.texinfo 2012/04/23 17:20:56 1.947
@@ -21142,11 +21142,11 @@
You have to specify also any existing directories displayed by
by @samp{show auto-load safe-path} (such as @samp{/usr:/bin} in this example).
-@item @kbd{gdb -iex "set auto-load safe-path /usr:/bin:~/src/gdb" [@dots{}]}
+@item @kbd{gdb -iex "set auto-load safe-path /usr:/bin:~/src/gdb"}
Specify this directory as in the previous case but just for a single
@value{GDBN} session.
-@item @kbd{gdb -iex "set auto-load safe-path" [@dots{}]}
+@item @kbd{gdb -iex "set auto-load safe-path"}
Disable auto-loading safety for a single @value{GDBN} session.
This assumes all the files you debug during this @value{GDBN} session will come
from trusted sources.
@@ -21161,7 +21161,7 @@
also suppresses any such warning messages:
@table @asis
-@item @kbd{gdb -iex "set auto-load no" [@dots{}]}
+@item @kbd{gdb -iex "set auto-load no"}
You can use @value{GDBN} command-line option for a single @value{GDBN} session.
@item @file{~/.gdbinit}: @samp{set auto-load no}

View File

@ -1,39 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-04/msg00184.html
### src/gdb/doc/ChangeLog 2012/04/23 17:20:56 1.1300
### src/gdb/doc/ChangeLog 2012/04/23 17:26:00 1.1301
## -3,6 +3,9 @@
* gdb.texinfo (Auto-loading safe path): Remove trailing [@dots{}].
Three times.
+ * gdb.texinfo (Auto-loading safe path): Add trailing @dots{}.
+ Three times.
+
2012-04-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Auto-loading safe path): Replace @itemize @bullet
--- src/gdb/doc/gdb.texinfo 2012/04/23 17:20:56 1.947
+++ src/gdb/doc/gdb.texinfo 2012/04/23 17:26:01 1.948
@@ -21142,11 +21142,11 @@
You have to specify also any existing directories displayed by
by @samp{show auto-load safe-path} (such as @samp{/usr:/bin} in this example).
-@item @kbd{gdb -iex "set auto-load safe-path /usr:/bin:~/src/gdb"}
+@item @kbd{gdb -iex "set auto-load safe-path /usr:/bin:~/src/gdb" @dots{}}
Specify this directory as in the previous case but just for a single
@value{GDBN} session.
-@item @kbd{gdb -iex "set auto-load safe-path"}
+@item @kbd{gdb -iex "set auto-load safe-path" @dots{}}
Disable auto-loading safety for a single @value{GDBN} session.
This assumes all the files you debug during this @value{GDBN} session will come
from trusted sources.
@@ -21161,7 +21161,7 @@
also suppresses any such warning messages:
@table @asis
-@item @kbd{gdb -iex "set auto-load no"}
+@item @kbd{gdb -iex "set auto-load no" @dots{}}
You can use @value{GDBN} command-line option for a single @value{GDBN} session.
@item @file{~/.gdbinit}: @samp{set auto-load no}

View File

@ -1,28 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-05/msg00010.html
### src/gdb/ChangeLog 2012/05/02 17:13:39 1.14194
### src/gdb/ChangeLog 2012/05/02 20:00:31 1.14195
## -1,3 +1,8 @@
+2012-05-02 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix --without-auto-load-safe-path for MS-Windows host platform.
+ * auto-load.c (filename_is_in_dir): Return 1 for DIR_LEN 0.
+
2012-05-02 Eli Zaretskii <eliz@gnu.org>
* gdb_curses.h: Undefine KEY_EVENT before including curses
--- src/gdb/auto-load.c 2012/04/17 15:56:21 1.4
+++ src/gdb/auto-load.c 2012/05/02 20:00:36 1.5
@@ -231,6 +231,12 @@
while (dir_len && IS_DIR_SEPARATOR (dir[dir_len - 1]))
dir_len--;
+ /* Ensure auto_load_safe_path "/" matches any FILENAME. On MS-Windows
+ platform FILENAME even after gdb_realpath does not have to start with
+ IS_DIR_SEPARATOR character, such as the 'C:\x.exe' filename. */
+ if (dir_len == 0)
+ return 1;
+
return (filename_ncmp (dir, filename, dir_len) == 0
&& (IS_DIR_SEPARATOR (filename[dir_len])
|| filename[dir_len] == '\0'));

View File

@ -1,136 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-05/msg00038.html
### src/gdb/ChangeLog 2012/05/05 05:36:23 1.14211
### src/gdb/ChangeLog 2012/05/06 15:30:59 1.14212
## -1,3 +1,14 @@
+2012-05-06 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * auto-load.c (set_auto_load_safe_path): Reset AUTO_LOAD_SAFE_PATH
+ back to DEFAULT_AUTO_LOAD_SAFE_PATH if it is being set to "".
+ (show_auto_load_safe_path): Check any-directory by comparison with "/".
+ (add_auto_load_safe_path): Change the error message.
+ (_initialize_auto_load): Change the "safe-path" help text.
+ * configure: Regenerate
+ * configure.ac (--without-auto-load-safe-path): Set
+ WITH_AUTO_LOAD_SAFE_PATH to /.
+
2012-05-05 Sergio Durigan Junior <sergiodj@redhat.com>
* stap-probe.h: Do not include unecessary `probe.h'.
--- src/gdb/auto-load.c 2012/05/02 20:00:36 1.5
+++ src/gdb/auto-load.c 2012/05/06 15:31:02 1.6
@@ -181,6 +181,12 @@
static void
set_auto_load_safe_path (char *args, int from_tty, struct cmd_list_element *c)
{
+ if (auto_load_safe_path[0] == '\0')
+ {
+ xfree (auto_load_safe_path);
+ auto_load_safe_path = xstrdup (DEFAULT_AUTO_LOAD_SAFE_PATH);
+ }
+
auto_load_safe_path_vec_update ();
}
@@ -190,7 +196,7 @@
show_auto_load_safe_path (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- if (*value == 0)
+ if (strcmp (value, "/") == 0)
fprintf_filtered (file, _("Auto-load files are safe to load from any "
"directory.\n"));
else
@@ -209,8 +215,9 @@
if (args == NULL || *args == 0)
error (_("\
-Adding empty directory element disables the auto-load safe-path security. \
-Use 'set auto-load safe-path' instead if you mean that."));
+Directory argument required.\n\
+Use 'set auto-load safe-path /' for disabling the auto-load safe-path security.\
+"));
s = xstrprintf ("%s%c%s", auto_load_safe_path, DIRNAME_SEPARATOR, args);
xfree (auto_load_safe_path);
@@ -1029,8 +1036,10 @@
Show the list of directories from which it is safe to auto-load files."), _("\
Various files loaded automatically for the 'set auto-load ...' options must\n\
be located in one of the directories listed by this option. Warning will be\n\
-printed and file will not be used otherwise. Use empty string (or even\n\
-empty directory entry) to allow any file for the 'set auto-load ...' options.\n\
+printed and file will not be used otherwise.\n\
+Setting this parameter to an empty list resets it to its default value.\n\
+Setting this parameter to '/' (without the quotes) allows any file\n\
+for the 'set auto-load ...' options.\n\
This option is ignored for the kinds of files having 'set auto-load ... off'.\n\
This options has security implications for untrusted inferiors."),
set_auto_load_safe_path,
--- src/gdb/configure 2012/04/27 20:47:52 1.360
+++ src/gdb/configure 2012/05/06 15:31:02 1.361
@@ -4964,7 +4964,7 @@
# Check whether --with-auto-load-safe-path was given.
if test "${with_auto_load_safe_path+set}" = set; then :
withval=$with_auto_load_safe_path; if test "$with_auto_load_safe_path" = "no"; then
- with_auto_load_safe_path=""
+ with_auto_load_safe_path="/"
fi
else
with_auto_load_safe_path="$prefix"
--- src/gdb/configure.ac 2012/04/27 20:47:53 1.171
+++ src/gdb/configure.ac 2012/05/06 15:31:03 1.172
@@ -141,7 +141,7 @@
AS_HELP_STRING([--with-auto-load-safe-path=PATH], [directories safe to hold auto-loaded files])
AS_HELP_STRING([--without-auto-load-safe-path], [do not restrict auto-loaded files locations]),
[if test "$with_auto_load_safe_path" = "no"; then
- with_auto_load_safe_path=""
+ with_auto_load_safe_path="/"
fi],
[with_auto_load_safe_path="$prefix"])
AC_DEFINE_DIR(DEFAULT_AUTO_LOAD_SAFE_PATH, with_auto_load_safe_path,
### src/gdb/doc/ChangeLog 2012/05/03 07:07:24 1.1308
### src/gdb/doc/ChangeLog 2012/05/06 15:31:04 1.1309
## -1,3 +1,9 @@
+2012-05-06 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.texinfo (Auto-loading safe path): Make 'directories'
+ for 'set auto-load safe-path' optional. Mention if it is omitted.
+ Change disabling security protection condition to "/", twice.
+
2012-05-03 Siva Chandra Reddy <sivachandra@google.com>
* gdb.texinfo (Symbol Tables In Python): Add documentation about
--- src/gdb/doc/gdb.texinfo 2012/05/03 07:07:24 1.954
+++ src/gdb/doc/gdb.texinfo 2012/05/06 15:31:04 1.955
@@ -21219,9 +21219,12 @@
@table @code
@anchor{set auto-load safe-path}
@kindex set auto-load safe-path
-@item set auto-load safe-path @var{directories}
+@item set auto-load safe-path @r{[}@var{directories}@r{]}
Set the list of directories (and their subdirectories) trusted for automatic
loading and execution of scripts. You can also enter a specific trusted file.
+If you omit @var{directories}, @samp{auto-load safe-path} will be reset to
+its default value as specified during @value{GDBN} compilation.
+
The list of directories uses directory separator (@samp{:} on GNU and Unix
systems, @samp{;} on MS-Windows and MS-DOS) to separate directories, similarly
to the @env{PATH} environment variable.
@@ -21240,7 +21243,7 @@
host platform directory separator in use.
@end table
-Setting this variable to an empty string disables this security protection.
+Setting this variable to @file{/} disables this security protection.
This variable is supposed to be set to the system directories writable by the
system superuser only. Users can add their source directories in init files in
their home directories (@pxref{Home Directory Init File}). See also deprecated
@@ -21260,7 +21263,7 @@
Specify this directory as in the previous case but just for a single
@value{GDBN} session.
-@item @kbd{gdb -iex "set auto-load safe-path" @dots{}}
+@item @kbd{gdb -iex "set auto-load safe-path /" @dots{}}
Disable auto-loading safety for a single @value{GDBN} session.
This assumes all the files you debug during this @value{GDBN} session will come
from trusted sources.

View File

@ -1,45 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-05/msg00060.html
### src/gdb/doc/ChangeLog 2012/05/09 18:15:58 1.1310
### src/gdb/doc/ChangeLog 2012/05/09 19:29:25 1.1311
## -3,6 +3,9 @@
* gdb.texinfo (Auto-loading): Wrap too long lines in @smallexample.
Twice.
+ * gdb.texinfo (Separate Debug Files, Auto-loading safe path): Replace
+ directory separator by path separator.
+
2012-05-06 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Auto-loading safe path): Make 'directories'
--- src/gdb/doc/gdb.texinfo 2012/05/09 18:15:58 1.956
+++ src/gdb/doc/gdb.texinfo 2012/05/09 19:29:25 1.957
@@ -16285,8 +16285,8 @@
@kindex set debug-file-directory
@item set debug-file-directory @var{directories}
Set the directories which @value{GDBN} searches for separate debugging
-information files to @var{directory}. Multiple directory components can be set
-concatenating them by a directory separator.
+information files to @var{directory}. Multiple path components can be set
+concatenating them by a path separator.
@kindex show debug-file-directory
@item show debug-file-directory
@@ -21227,7 +21227,7 @@
If you omit @var{directories}, @samp{auto-load safe-path} will be reset to
its default value as specified during @value{GDBN} compilation.
-The list of directories uses directory separator (@samp{:} on GNU and Unix
+The list of directories uses path separator (@samp{:} on GNU and Unix
systems, @samp{;} on MS-Windows and MS-DOS) to separate directories, similarly
to the @env{PATH} environment variable.
@@ -21242,7 +21242,7 @@
@item add-auto-load-safe-path
Add an entry (or list of entries) the list of directories trusted for automatic
loading and execution of scripts. Multiple entries may be delimited by the
-host platform directory separator in use.
+host platform path separator in use.
@end table
Setting this variable to @file{/} disables this security protection.

View File

@ -1,35 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-05/msg00059.html
### src/gdb/doc/ChangeLog 2012/05/06 15:31:04 1.1309
### src/gdb/doc/ChangeLog 2012/05/09 18:15:58 1.1310
## -1,3 +1,8 @@
+2012-05-09 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.texinfo (Auto-loading): Wrap too long lines in @smallexample.
+ Twice.
+
2012-05-06 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Auto-loading safe path): Make 'directories'
--- src/gdb/doc/gdb.texinfo 2012/05/06 15:31:04 1.955
+++ src/gdb/doc/gdb.texinfo 2012/05/09 18:15:58 1.956
@@ -21004,7 +21004,8 @@
(gdb) show auto-load
gdb-scripts: Auto-loading of canned sequences of commands scripts is on.
libthread-db: Auto-loading of inferior specific libthread_db is on.
-local-gdbinit: Auto-loading of .gdbinit script from current directory is on.
+local-gdbinit: Auto-loading of .gdbinit script from current directory
+ is on.
python-scripts: Auto-loading of Python scripts is on.
safe-path: List of directories from which it is safe to auto-load files
is /usr/local.
@@ -21022,7 +21023,8 @@
Loaded Script
Yes /home/user/gdb/gdb-gdb.gdb
libthread-db: No auto-loaded libthread-db.
-local-gdbinit: Local .gdbinit file "/home/user/gdb/.gdbinit" has been loaded.
+local-gdbinit: Local .gdbinit file "/home/user/gdb/.gdbinit" has been
+ loaded.
python-scripts:
Loaded Script
Yes /home/user/gdb/gdb-gdb.py

View File

@ -1,57 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-05/msg00079.html
### src/gdb/ChangeLog 2012/05/10 20:17:46 1.14235
### src/gdb/ChangeLog 2012/05/11 18:06:26 1.14236
## -1,3 +1,10 @@
+2012-05-11 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Make auto-load handle multiple components of DEBUG_FILE_DIRECTORY.
+ * auto-load.c (auto_load_objfile_script): Remove check for NULL
+ DEBUG_FILE_DIRECTORY. Handle multiple components of
+ DEBUG_FILE_DIRECTORY.
+
2012-05-10 Tom Tromey <tromey@redhat.com>
* dwarf2read.c (recursively_write_psymbols): New function.
--- src/gdb/auto-load.c 2012/05/06 15:31:02 1.6
+++ src/gdb/auto-load.c 2012/05/11 18:06:28 1.7
@@ -587,17 +587,29 @@
input = fopen (filename, "r");
debugfile = filename;
- if (!input && debug_file_directory)
+ if (!input)
{
- /* Also try the same file in the separate debug info directory. */
- debugfile = xmalloc (strlen (filename)
- + strlen (debug_file_directory) + 1);
- strcpy (debugfile, debug_file_directory);
- /* FILENAME is absolute, so we don't need a "/" here. */
- strcat (debugfile, filename);
-
- make_cleanup (xfree, debugfile);
- input = fopen (debugfile, "r");
+ char *debugdir;
+ VEC (char_ptr) *debugdir_vec;
+ int ix;
+
+ debugdir_vec = dirnames_to_char_ptr_vec (debug_file_directory);
+ make_cleanup_free_char_ptr_vec (debugdir_vec);
+
+ for (ix = 0; VEC_iterate (char_ptr, debugdir_vec, ix, debugdir); ++ix)
+ {
+ /* Also try the same file in the separate debug info directory. */
+ debugfile = xmalloc (strlen (debugdir) + strlen (filename) + 1);
+ strcpy (debugfile, debugdir);
+
+ /* FILENAME is absolute, so we don't need a "/" here. */
+ strcat (debugfile, filename);
+
+ make_cleanup (xfree, debugfile);
+ input = fopen (debugfile, "r");
+ if (input != NULL)
+ break;
+ }
}
if (!input && gdb_datadir)

View File

@ -1,388 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-05/msg00080.html
### src/gdb/ChangeLog 2012/05/11 18:06:26 1.14236
### src/gdb/ChangeLog 2012/05/11 18:13:22 1.14237
## -1,5 +1,29 @@
2012-05-11 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Provide $ddir substitution for --with-auto-load-safe-path.
+ * NEWS (--with-auto-load-safe-path, --without-auto-load-safe-path): New
+ entries.
+ * auto-load.c: Include observer.h.
+ (auto_load_safe_path_vec_update): Call substitute_path_component for
+ each component. New variable ddir_subst.
+ (auto_load_gdb_datadir_changed): New function.
+ (set_auto_load_safe_path): Rename DEFAULT_AUTO_LOAD_SAFE_PATH to
+ AUTO_LOAD_SAFE_PATH. New comment.
+ (_initialize_auto_load): Rename DEFAULT_AUTO_LOAD_SAFE_PATH to
+ AUTO_LOAD_SAFE_PATH. Install auto_load_gdb_datadir_changed.
+ * config.in: Regenerate.
+ * configure: Regenerate.
+ * configure.ac (--auto-load-safe-path): Rename
+ DEFAULT_AUTO_LOAD_SAFE_PATH to AUTO_LOAD_SAFE_PATH. Default to
+ GDB_DATADIR/auto-load.
+ * defs.h (substitute_path_component): New declaration.
+ * top.c: Include observer.h.
+ (set_gdb_datadir): New function.
+ (init_main): Install it for "set data-directory".
+ * utils.c (substitute_path_component): New function.
+
+2012-05-11 Jan Kratochvil <jan.kratochvil@redhat.com>
+
Make auto-load handle multiple components of DEBUG_FILE_DIRECTORY.
* auto-load.c (auto_load_objfile_script): Remove check for NULL
DEBUG_FILE_DIRECTORY. Handle multiple components of
Index: gdb-7.4.50.20120120/gdb/NEWS
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/NEWS 2012-05-14 14:17:49.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/NEWS 2012-05-14 14:18:01.915041258 +0200
@@ -307,6 +307,17 @@ show trace-stop-notes
instance as an explanation, if you are stopping a trace run that was
started by someone else.
+* New configure options
+
+--with-auto-load-safe-path
+ Configure default value for the 'set auto-load safe-path' setting
+ above. It defaults to '$ddir/auto-load', $ddir representing GDB's
+ data directory (available via show data-directory).
+
+--without-auto-load-safe-path
+ Set 'set auto-load safe-path' to '/', effectively disabling this
+ security feature.
+
* New remote packets
QTEnable
Index: gdb-7.4.50.20120120/gdb/auto-load.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/auto-load.c 2012-05-14 14:17:49.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/auto-load.c 2012-05-14 14:18:01.915041258 +0200
@@ -35,6 +35,7 @@
#include "gdb_vecs.h"
#include "readline/tilde.h"
#include "completer.h"
+#include "observer.h"
/* The suffix of per-objfile scripts to auto-load as non-Python command files.
E.g. When the program loads libfoo.so, look for libfoo-gdb.gdb. */
@@ -141,10 +142,16 @@ auto_load_safe_path_vec_update (void)
for (ix = 0; ix < len; ix++)
{
char *dir = VEC_index (char_ptr, auto_load_safe_path_vec, ix);
- char *expanded = tilde_expand (dir);
- char *real_path = gdb_realpath (expanded);
+ char *ddir_subst, *expanded, *real_path;
- /* Ensure the current entry is at least tilde_expand-ed. */
+ ddir_subst = xstrdup (dir);
+ substitute_path_component (&ddir_subst, "$ddir", gdb_datadir);
+ expanded = tilde_expand (ddir_subst);
+ xfree (ddir_subst);
+ real_path = gdb_realpath (expanded);
+
+ /* Ensure the current entry is at least a valid path (therefore
+ $ddir-expanded and tilde-expanded). */
VEC_replace (char_ptr, auto_load_safe_path_vec, ix, expanded);
if (debug_auto_load)
@@ -176,15 +183,24 @@ auto_load_safe_path_vec_update (void)
}
}
+/* Variable gdb_datadir has been set. Update content depending on $ddir. */
+
+static void
+auto_load_gdb_datadir_changed (void)
+{
+ auto_load_safe_path_vec_update ();
+}
+
/* "set" command for the auto_load_safe_path configuration variable. */
static void
set_auto_load_safe_path (char *args, int from_tty, struct cmd_list_element *c)
{
+ /* Setting the variable to "" resets it to the compile time defaults. */
if (auto_load_safe_path[0] == '\0')
{
xfree (auto_load_safe_path);
- auto_load_safe_path = xstrdup (DEFAULT_AUTO_LOAD_SAFE_PATH);
+ auto_load_safe_path = xstrdup (AUTO_LOAD_SAFE_PATH);
}
auto_load_safe_path_vec_update ();
@@ -1040,7 +1056,7 @@ This options has security implications f
Usage: info auto-load local-gdbinit"),
auto_load_info_cmdlist_get ());
- auto_load_safe_path = xstrdup (DEFAULT_AUTO_LOAD_SAFE_PATH);
+ auto_load_safe_path = xstrdup (AUTO_LOAD_SAFE_PATH);
auto_load_safe_path_vec_update ();
add_setshow_optional_filename_cmd ("safe-path", class_support,
&auto_load_safe_path, _("\
@@ -1058,6 +1074,7 @@ This options has security implications f
show_auto_load_safe_path,
auto_load_set_cmdlist_get (),
auto_load_show_cmdlist_get ());
+ observer_attach_gdb_datadir_changed (auto_load_gdb_datadir_changed);
cmd = add_cmd ("add-auto-load-safe-path", class_support,
add_auto_load_safe_path,
Index: gdb-7.4.50.20120120/gdb/config.in
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/config.in 2012-05-14 14:17:49.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/config.in 2012-05-14 14:18:01.915041258 +0200
@@ -7,6 +7,9 @@
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
+/* Directories safe to hold auto-loaded files. */
+#undef AUTO_LOAD_SAFE_PATH
+
/* Directory of programs. */
#undef BINDIR
@@ -43,9 +46,6 @@
moved. */
#undef DEBUGDIR_RELOCATABLE
-/* Directories safe to hold auto-loaded files. */
-#undef DEFAULT_AUTO_LOAD_SAFE_PATH
-
/* Define to BFD's default architecture. */
#undef DEFAULT_BFD_ARCH
Index: gdb-7.4.50.20120120/gdb/configure
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/configure 2012-05-14 14:17:49.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/configure 2012-05-14 14:18:01.918041252 +0200
@@ -1668,7 +1668,8 @@ Optional Packages:
--with-rpm query rpm database for missing debuginfos (yes/no,
def. auto=librpm.so)
--with-auto-load-safe-path=PATH
- directories safe to hold auto-loaded files
+ directories safe to hold auto-loaded files, use
+ $ddir for --with-gdb-datadir path [$ddir/auto-load]
--without-auto-load-safe-path
do not restrict auto-loaded files locations
--with-libunwind use libunwind frame unwinding support
@@ -8488,20 +8489,21 @@ $as_echo_n "checking for default auto-lo
# Check whether --with-auto-load-safe-path was given.
if test "${with_auto_load_safe_path+set}" = set; then :
withval=$with_auto_load_safe_path; if test "$with_auto_load_safe_path" = "no"; then
- with_auto_load_safe_path="/"
- fi
+ with_auto_load_safe_path="/"
+ fi
else
- with_auto_load_safe_path="$prefix"
+ with_auto_load_safe_path='$ddir/auto-load'
fi
+escape_dir=`echo $with_auto_load_safe_path | sed 's/[$]ddir\>/\\\\\\\\\\\\&/g'`
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
- ac_define_dir=`eval echo $with_auto_load_safe_path`
+ ac_define_dir=`eval echo $escape_dir`
ac_define_dir=`eval echo $ac_define_dir`
cat >>confdefs.h <<_ACEOF
-#define DEFAULT_AUTO_LOAD_SAFE_PATH "$ac_define_dir"
+#define AUTO_LOAD_SAFE_PATH "$ac_define_dir"
_ACEOF
Index: gdb-7.4.50.20120120/gdb/configure.ac
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/configure.ac 2012-05-14 14:17:49.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/configure.ac 2012-05-14 14:18:01.919041250 +0200
@@ -341,13 +341,16 @@ fi
AC_MSG_CHECKING([for default auto-load safe-path])
AC_ARG_WITH(auto-load-safe-path,
-AS_HELP_STRING([--with-auto-load-safe-path=PATH], [directories safe to hold auto-loaded files])
-AS_HELP_STRING([--without-auto-load-safe-path], [do not restrict auto-loaded files locations]),
-[if test "$with_auto_load_safe_path" = "no"; then
- with_auto_load_safe_path="/"
- fi],
-[with_auto_load_safe_path="$prefix"])
-AC_DEFINE_DIR(DEFAULT_AUTO_LOAD_SAFE_PATH, with_auto_load_safe_path,
+AS_HELP_STRING([--with-auto-load-safe-path=PATH],
+ [directories safe to hold auto-loaded files, use $ddir for --with-gdb-datadir path @<:@$ddir/auto-load@:>@])
+AS_HELP_STRING([--without-auto-load-safe-path],
+ [do not restrict auto-loaded files locations]),
+ [if test "$with_auto_load_safe_path" = "no"; then
+ with_auto_load_safe_path="/"
+ fi],
+[with_auto_load_safe_path='$ddir/auto-load'])
+escape_dir=`echo $with_auto_load_safe_path | sed 's/[[$]]ddir\>/\\\\\\\\\\\\&/g'`
+AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
[Directories safe to hold auto-loaded files.])
AC_MSG_RESULT([$with_auto_load_safe_path])
Index: gdb-7.4.50.20120120/gdb/defs.h
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/defs.h 2012-05-14 14:17:48.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/defs.h 2012-05-14 14:18:01.919041250 +0200
@@ -442,6 +442,9 @@ extern struct cleanup *make_bpstat_clear
extern int producer_is_gcc_ge_4 (const char *producer);
+extern void substitute_path_component (char **stringp, const char *from,
+ const char *to);
+
#ifdef HAVE_WAITPID
extern pid_t wait_to_die_with_timeout (pid_t pid, int *status, int timeout);
#endif
Index: gdb-7.4.50.20120120/gdb/top.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/top.c 2012-05-14 14:17:48.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/top.c 2012-05-14 14:18:01.919041250 +0200
@@ -47,6 +47,7 @@
#include "gdbthread.h"
#include "python/python.h"
#include "interps.h"
+#include "observer.h"
/* readline include files. */
#include "readline/readline.h"
@@ -1561,6 +1562,15 @@ show_exec_done_display_p (struct ui_file
"asynchronous execution commands is %s.\n"),
value);
}
+
+/* "set" command for the gdb_datadir configuration variable. */
+
+static void
+set_gdb_datadir (char *args, int from_tty, struct cmd_list_element *c)
+{
+ observer_notify_gdb_datadir_changed ();
+}
+
static void
init_main (void)
{
@@ -1668,7 +1678,7 @@ Use \"on\" to enable the notification, a
_("Show GDB's data directory."),
_("\
When set, GDB uses the specified path to search for data files."),
- NULL, NULL,
+ set_gdb_datadir, NULL,
&setlist,
&showlist);
}
Index: gdb-7.4.50.20120120/gdb/utils.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/utils.c 2012-05-14 14:17:49.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/utils.c 2012-05-14 14:18:01.920041248 +0200
@@ -3925,6 +3925,48 @@ dirnames_to_char_ptr_vec (const char *di
return retval;
}
+/* Substitute all occurences of string FROM by string TO in *STRINGP. *STRINGP
+ must come from xrealloc-compatible allocator and it may be updated. FROM
+ needs to be delimited by IS_DIR_SEPARATOR (or be located at the start or
+ end of *STRINGP. */
+
+void
+substitute_path_component (char **stringp, const char *from, const char *to)
+{
+ char *string = *stringp, *s;
+ const size_t from_len = strlen (from);
+ const size_t to_len = strlen (to);
+
+ for (s = string;;)
+ {
+ s = strstr (s, from);
+ if (s == NULL)
+ break;
+
+ if ((s == string || IS_DIR_SEPARATOR (s[-1]))
+ && (s[from_len] == '\0' || IS_DIR_SEPARATOR (s[from_len])))
+ {
+ char *string_new;
+
+ string_new = xrealloc (string, (strlen (string) + to_len + 1));
+
+ /* Relocate the current S pointer. */
+ s = s - string + string_new;
+ string = string_new;
+
+ /* Replace from by to. */
+ memmove (&s[to_len], &s[from_len], strlen (&s[from_len]) + 1);
+ memcpy (s, to, to_len);
+
+ s += to_len;
+ }
+ else
+ s++;
+ }
+
+ *stringp = string;
+}
+
#ifdef HAVE_WAITPID
#ifdef SIGALRM
Index: gdb-7.4.50.20120120/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/doc/gdb.texinfo 2012-05-14 14:17:49.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/doc/gdb.texinfo 2012-05-14 14:18:01.925041238 +0200
@@ -20803,7 +20803,7 @@ local-gdbinit: Auto-loading of .gdbinit
is on.
python-scripts: Auto-loading of Python scripts is on.
safe-path: List of directories from which it is safe to auto-load files
- is /usr/local.
+ is $ddir/auto-load.
@end smallexample
@anchor{info auto-load}
@@ -21006,9 +21006,9 @@ get loaded:
$ ./gdb -q ./gdb
Reading symbols from /home/user/gdb/gdb...done.
warning: File "/home/user/gdb/gdb-gdb.gdb" auto-loading has been
- declined by your `auto-load safe-path' set to "/usr/local".
+ declined by your `auto-load safe-path' set to "$ddir/auto-load".
warning: File "/home/user/gdb/gdb-gdb.py" auto-loading has been
- declined by your `auto-load safe-path' set to "/usr/local".
+ declined by your `auto-load safe-path' set to "$ddir/auto-load".
@end smallexample
The list of trusted directories is controlled by the following commands:
@@ -21040,7 +21040,18 @@ loading and execution of scripts. Multi
host platform path separator in use.
@end table
-Setting this variable to @file{/} disables this security protection.
+This variable defaults to @file{$ddir/auto-load}. The default @code{set
+auto-load safe-path} value can be also overriden by @value{GDBN} configuration
+option @option{--with-auto-load-safe-path}.
+
+Any used string @file{$ddir} will get replaced by @var{data-directory} which is
+determined at @value{GDBN} startup (@pxref{Data Files}). @file{$ddir} must be
+be placed as a directory component --- either alone or delimited by @file{/} or
+@file{\} directory separators, depending on the host platform.
+
+Setting this variable to @file{/} disables this security protection,
+corresponding @value{GDBN} configuration option is
+@option{--without-auto-load-safe-path}.
This variable is supposed to be set to the system directories writable by the
system superuser only. Users can add their source directories in init files in
their home directories (@pxref{Home Directory Init File}). See also deprecated
Index: gdb-7.4.50.20120120/gdb/doc/observer.texi
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/doc/observer.texi 2012-05-14 14:17:47.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/doc/observer.texi 2012-05-14 14:18:01.926041236 +0200
@@ -231,6 +231,10 @@ the current top-level prompt.
@c collector pass. Currently only @code{type_mark_used} marker is supported.
@c @end deftypefun
+@deftypefun void gdb_datadir_changed (void)
+Variable gdb_datadir has been set. The value may not necessarily change.
+@end deftypefun
+
@deftypefun void test_notification (int @var{somearg})
This observer is used for internal testing. Do not use.
See testsuite/gdb.gdb/observer.exp.

View File

@ -1,424 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-05/msg00081.html
### src/gdb/ChangeLog 2012/05/11 18:13:22 1.14237
### src/gdb/ChangeLog 2012/05/11 18:20:25 1.14238
## -1,5 +1,23 @@
2012-05-11 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Implement multi-component --with-auto-load-dir.
+ * NEWS (set auto-load scripts-directory, --with-auto-load-dir): New
+ entries.
+ (--with-auto-load-safe-path): Update the default value description.
+ * auto-load.c (auto_load_dir, set_auto_load_dir, show_auto_load_dir):
+ New.
+ (auto_load_objfile_script): Add DEBUG_AUTO_LOAD output. Remove
+ GDB_DATADIR NULL check. Replace GDB_DATADIR/auto-load by
+ AUTO_LOAD_DIR. Support $ddir and multiple components in it.
+ (_initialize_auto_load): Initialize also auto_load_dir. Install new
+ "set auto-load scripts-directory".
+ * config.in: Regenerate.
+ * configure: Regenerate.
+ * configure.ac (--with-auto-load-dir): New configure option.
+ (--auto-load-safe-path): Change the default to --with-auto-load-dir.
+
+2012-05-11 Jan Kratochvil <jan.kratochvil@redhat.com>
+
Provide $ddir substitution for --with-auto-load-safe-path.
* NEWS (--with-auto-load-safe-path, --without-auto-load-safe-path): New
entries.
Index: gdb-7.4.50.20120120/gdb/NEWS
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/NEWS 2012-05-14 14:18:01.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/NEWS 2012-05-14 14:18:29.712985871 +0200
@@ -67,6 +67,12 @@ set auto-load libthread-db on|off
show auto-load libthread-db
Control auto-loading of inferior specific thread debugging shared library.
+set auto-load scripts-directory <dir1>[:<dir2>...]
+ Set a list of directories from which to load auto-loaded scripts.
+ Automatically loaded Python scripts and GDB scripts are located in one
+ of the directories listed by this option.
+ The delimiter (':' above) may differ according to the host platform.
+
set auto-load safe-path <dir1>[:<dir2>...]
show auto-load safe-path
Set a list of directories from which it is safe to auto-load files.
@@ -309,10 +315,14 @@ show trace-stop-notes
* New configure options
+--with-auto-load-dir
+ Configure default value for the 'set auto-load scripts-directory'
+ setting above. It defaults to '$ddir/auto-load', $ddir representing
+ GDB's data directory (available via show data-directory).
+
--with-auto-load-safe-path
Configure default value for the 'set auto-load safe-path' setting
- above. It defaults to '$ddir/auto-load', $ddir representing GDB's
- data directory (available via show data-directory).
+ above. It defaults to the --with-auto-load-dir setting.
--without-auto-load-safe-path
Set 'set auto-load safe-path' to '/', effectively disabling this
Index: gdb-7.4.50.20120120/gdb/auto-load.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/auto-load.c 2012-05-14 14:18:01.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/auto-load.c 2012-05-14 14:18:29.713985869 +0200
@@ -108,6 +108,35 @@ show_auto_load_local_gdbinit (struct ui_
value);
}
+/* Directory list from which to load auto-loaded scripts. It is not checked
+ for absolute paths but they are strongly recommended. It is initialized by
+ _initialize_auto_load. */
+static char *auto_load_dir;
+
+/* "set" command for the auto_load_dir configuration variable. */
+
+static void
+set_auto_load_dir (char *args, int from_tty, struct cmd_list_element *c)
+{
+ /* Setting the variable to "" resets it to the compile time defaults. */
+ if (auto_load_dir[0] == '\0')
+ {
+ xfree (auto_load_dir);
+ auto_load_dir = xstrdup (AUTO_LOAD_DIR);
+ }
+}
+
+/* "show" command for the auto_load_dir configuration variable. */
+
+static void
+show_auto_load_dir (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ fprintf_filtered (file, _("List of directories from which to load "
+ "auto-loaded scripts is %s.\n"),
+ value);
+}
+
/* Directory list safe to hold auto-loaded files. It is not checked for
absolute paths but they are strongly recommended. It is initialized by
_initialize_auto_load. */
@@ -602,6 +631,9 @@ auto_load_objfile_script (struct objfile
input = fopen (filename, "r");
debugfile = filename;
+ if (debug_auto_load)
+ fprintf_unfiltered (gdb_stdlog, _("auto-load: Attempted file \"%s\" %s.\n"),
+ debugfile, input ? _("exists") : _("does not exist"));
if (!input)
{
@@ -612,6 +644,12 @@ auto_load_objfile_script (struct objfile
debugdir_vec = dirnames_to_char_ptr_vec (debug_file_directory);
make_cleanup_free_char_ptr_vec (debugdir_vec);
+ if (debug_auto_load)
+ fprintf_unfiltered (gdb_stdlog,
+ _("auto-load: Searching 'set debug-file-directory' "
+ "path \"%s\".\n"),
+ debug_file_directory);
+
for (ix = 0; VEC_iterate (char_ptr, debugdir_vec, ix, debugdir); ++ix)
{
/* Also try the same file in the separate debug info directory. */
@@ -623,24 +661,53 @@ auto_load_objfile_script (struct objfile
make_cleanup (xfree, debugfile);
input = fopen (debugfile, "r");
+ if (debug_auto_load)
+ fprintf_unfiltered (gdb_stdlog, _("auto-load: Attempted file "
+ "\"%s\" %s.\n"),
+ debugfile,
+ input ? _("exists") : _("does not exist"));
if (input != NULL)
break;
}
}
- if (!input && gdb_datadir)
+ if (!input)
{
+ VEC (char_ptr) *vec;
+ int ix;
+ char *dir;
+
/* Also try the same file in a subdirectory of gdb's data
directory. */
- debugfile = xmalloc (strlen (gdb_datadir) + strlen (filename)
- + strlen ("/auto-load") + 1);
- strcpy (debugfile, gdb_datadir);
- strcat (debugfile, "/auto-load");
- /* FILENAME is absolute, so we don't need a "/" here. */
- strcat (debugfile, filename);
- make_cleanup (xfree, debugfile);
- input = fopen (debugfile, "r");
+ vec = dirnames_to_char_ptr_vec (auto_load_dir);
+ make_cleanup_free_char_ptr_vec (vec);
+
+ if (debug_auto_load)
+ fprintf_unfiltered (gdb_stdlog, _("auto-load: Searching 'set auto-load "
+ "scripts-directory' path \"%s\".\n"),
+ auto_load_dir);
+
+ for (ix = 0; VEC_iterate (char_ptr, vec, ix, dir); ++ix)
+ {
+ debugfile = xstrdup (dir);
+ substitute_path_component (&debugfile, "$ddir", gdb_datadir);
+ debugfile = xrealloc (debugfile, (strlen (debugfile)
+ + strlen (filename) + 1));
+
+ /* FILENAME is absolute, so we don't need a "/" here. */
+ strcat (debugfile, filename);
+
+ make_cleanup (xfree, debugfile);
+ input = fopen (debugfile, "r");
+ if (debug_auto_load)
+ fprintf_unfiltered (gdb_stdlog, _("auto-load: Attempted file "
+ "\"%s\" %s.\n"),
+ debugfile,
+ input ? _("exists") : _("does not exist"));
+ if (input != NULL)
+ break;
+ }
}
if (input)
@@ -1056,6 +1123,19 @@ This options has security implications f
Usage: info auto-load local-gdbinit"),
auto_load_info_cmdlist_get ());
+ auto_load_dir = xstrdup (AUTO_LOAD_DIR);
+ add_setshow_optional_filename_cmd ("scripts-directory", class_support,
+ &auto_load_dir, _("\
+Set the list of directories from which to load auto-loaded scripts."), _("\
+Show the list of directories from which to load auto-loaded scripts."), _("\
+Automatically loaded Python scripts and GDB scripts are located in one of the\n\
+directories listed by this option. This option is ignored for the kinds of\n\
+scripts having 'set auto-load ... off'. Directories listed here need to be\n\
+present also in the 'set auto-load safe-path' option."),
+ set_auto_load_dir, show_auto_load_dir,
+ auto_load_set_cmdlist_get (),
+ auto_load_show_cmdlist_get ());
+
auto_load_safe_path = xstrdup (AUTO_LOAD_SAFE_PATH);
auto_load_safe_path_vec_update ();
add_setshow_optional_filename_cmd ("safe-path", class_support,
Index: gdb-7.4.50.20120120/gdb/config.in
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/config.in 2012-05-14 14:18:01.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/config.in 2012-05-14 14:18:29.713985869 +0200
@@ -7,6 +7,9 @@
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
+/* Directories from which to load auto-loaded scripts. */
+#undef AUTO_LOAD_DIR
+
/* Directories safe to hold auto-loaded files. */
#undef AUTO_LOAD_SAFE_PATH
Index: gdb-7.4.50.20120120/gdb/configure
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/configure 2012-05-14 14:18:01.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/configure 2012-05-14 14:21:13.068849103 +0200
@@ -955,6 +955,7 @@ with_separate_debug_dir
with_gdb_datadir
with_relocated_sources
with_rpm
+with_auto_load_dir
with_auto_load_safe_path
enable_targets
enable_64_bit_bfd
@@ -1667,9 +1668,13 @@ Optional Packages:
automatically relocate this path for source files
--with-rpm query rpm database for missing debuginfos (yes/no,
def. auto=librpm.so)
+ --with-auto-load-dir=PATH
+ directories from which to load auto-loaded scripts,
+ use '$ddir' for -data-directory [$ddir/auto-load]
--with-auto-load-safe-path=PATH
directories safe to hold auto-loaded files, use
- $ddir for --with-gdb-datadir path [$ddir/auto-load]
+ $ddir for --with-gdb-datadir path
+ [--with-auto-load-dir]
--without-auto-load-safe-path
do not restrict auto-loaded files locations
--with-libunwind use libunwind frame unwinding support
@@ -8483,6 +8488,31 @@ $as_echo "$as_me: WARNING: $RPM_PKG_ERRO
fi
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for default auto-load directory" >&5
+$as_echo_n "checking for default auto-load directory... " >&6; }
+
+# Check whether --with-auto-load-dir was given.
+if test "${with_auto_load_dir+set}" = set; then :
+ withval=$with_auto_load_dir;
+else
+ with_auto_load_dir='$ddir/auto-load'
+fi
+
+escape_dir=`echo $with_auto_load_dir | sed 's/[$]ddir\>/\\\\\\\\\\\\&/g'`
+
+ test "x$prefix" = xNONE && prefix="$ac_default_prefix"
+ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+ ac_define_dir=`eval echo $escape_dir`
+ ac_define_dir=`eval echo $ac_define_dir`
+
+cat >>confdefs.h <<_ACEOF
+#define AUTO_LOAD_DIR "$ac_define_dir"
+_ACEOF
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_dir" >&5
+$as_echo "$with_auto_load_dir" >&6; }
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for default auto-load safe-path" >&5
$as_echo_n "checking for default auto-load safe-path... " >&6; }
@@ -8492,7 +8522,7 @@ if test "${with_auto_load_safe_path+set}
with_auto_load_safe_path="/"
fi
else
- with_auto_load_safe_path='$ddir/auto-load'
+ with_auto_load_safe_path="$with_auto_load_dir"
fi
escape_dir=`echo $with_auto_load_safe_path | sed 's/[$]ddir\>/\\\\\\\\\\\\&/g'`
Index: gdb-7.4.50.20120120/gdb/configure.ac
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/configure.ac 2012-05-14 14:18:01.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/configure.ac 2012-05-14 14:21:01.597871716 +0200
@@ -339,16 +339,26 @@ extern rpmdbMatchIterator rpmtsInitItera
fi
fi
+AC_MSG_CHECKING([for default auto-load directory])
+AC_ARG_WITH(auto-load-dir,
+AS_HELP_STRING([--with-auto-load-dir=PATH],
+ [directories from which to load auto-loaded scripts, use '$ddir' for -data-directory @<:@$ddir/auto-load@:>@]),,
+ [with_auto_load_dir='$ddir/auto-load'])
+escape_dir=`echo $with_auto_load_dir | sed 's/[[$]]ddir\>/\\\\\\\\\\\\&/g'`
+AC_DEFINE_DIR(AUTO_LOAD_DIR, escape_dir,
+ [Directories from which to load auto-loaded scripts.])
+AC_MSG_RESULT([$with_auto_load_dir])
+
AC_MSG_CHECKING([for default auto-load safe-path])
AC_ARG_WITH(auto-load-safe-path,
AS_HELP_STRING([--with-auto-load-safe-path=PATH],
- [directories safe to hold auto-loaded files, use $ddir for --with-gdb-datadir path @<:@$ddir/auto-load@:>@])
+ [directories safe to hold auto-loaded files, use $ddir for --with-gdb-datadir path @<:@--with-auto-load-dir@:>@])
AS_HELP_STRING([--without-auto-load-safe-path],
[do not restrict auto-loaded files locations]),
[if test "$with_auto_load_safe_path" = "no"; then
with_auto_load_safe_path="/"
fi],
-[with_auto_load_safe_path='$ddir/auto-load'])
+[with_auto_load_safe_path="$with_auto_load_dir"])
escape_dir=`echo $with_auto_load_safe_path | sed 's/[[$]]ddir\>/\\\\\\\\\\\\&/g'`
AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
[Directories safe to hold auto-loaded files.])
Index: gdb-7.4.50.20120120/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/doc/gdb.texinfo 2012-05-14 14:18:01.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/doc/gdb.texinfo 2012-05-14 14:20:13.653966212 +0200
@@ -20804,6 +20804,8 @@ local-gdbinit: Auto-loading of .gdbinit
python-scripts: Auto-loading of Python scripts is on.
safe-path: List of directories from which it is safe to auto-load files
is $ddir/auto-load.
+scripts-directory: List of directories from which to load auto-loaded scripts
+ is $ddir/auto-load.
@end smallexample
@anchor{info auto-load}
@@ -20864,6 +20866,10 @@ These are @value{GDBN} control commands
@tab Show setting of @value{GDBN} Python scripts.
@item @xref{info auto-load python-scripts}.
@tab Show state of @value{GDBN} Python scripts.
+@item @xref{set auto-load scripts-directory}.
+@tab Control for @value{GDBN} auto-loaded scripts location.
+@item @xref{show auto-load scripts-directory}.
+@tab Show @value{GDBN} auto-loaded scripts location.
@item @xref{set auto-load local-gdbinit}.
@tab Control for init file in the current directory.
@item @xref{show auto-load local-gdbinit}.
@@ -21040,15 +21046,13 @@ loading and execution of scripts. Multi
host platform path separator in use.
@end table
-This variable defaults to @file{$ddir/auto-load}. The default @code{set
+This variable defaults to what @code{--with-auto-load-dir} has been configured
+to (@pxref{with-auto-load-dir}). @file{$ddir} substituation applies the same
+as for @xref{set auto-load scripts-directory}.
+The default @code{set
auto-load safe-path} value can be also overriden by @value{GDBN} configuration
option @option{--with-auto-load-safe-path}.
-Any used string @file{$ddir} will get replaced by @var{data-directory} which is
-determined at @value{GDBN} startup (@pxref{Data Files}). @file{$ddir} must be
-be placed as a directory component --- either alone or delimited by @file{/} or
-@file{\} directory separators, depending on the host platform.
-
Setting this variable to @file{/} disables this security protection,
corresponding @value{GDBN} configuration option is
@option{--without-auto-load-safe-path}.
@@ -25135,7 +25139,7 @@ registering objfile-specific pretty-prin
@cindex @file{@var{objfile}-gdb.py}
When a new object file is read, @value{GDBN} looks for
-a file named @file{@var{objfile}-gdb.py},
+a file named @file{@var{objfile}-gdb.py} (we call it @var{script-name} below),
where @var{objfile} is the object file's real name, formed by ensuring
that the file name is absolute, following all symlinks, and resolving
@code{.} and @code{..} components. If this file exists and is
@@ -25143,14 +25147,42 @@ readable, @value{GDBN} will evaluate it
If this file does not exist, and if the parameter
@code{debug-file-directory} is set (@pxref{Separate Debug Files}),
-then @value{GDBN} will look for @var{real-name} in all of the
+then @value{GDBN} will look for @var{script-name} in all of the
directories mentioned in the value of @code{debug-file-directory}.
Finally, if this file does not exist, then @value{GDBN} will look for
-a file named @file{@var{data-directory}/python/auto-load/@var{real-name}}, where
-@var{data-directory} is @value{GDBN}'s data directory (available via
-@code{show data-directory}, @pxref{Data Files}), and @var{real-name}
-is the object file's real name, as described above.
+@var{script-name} file in all of the directories specified by:
+
+@table @code
+@anchor{set auto-load scripts-directory}
+@kindex set auto-load scripts-directory
+@item set auto-load scripts-directory @r{[}@var{directories}@r{]}
+Control @value{GDBN} auto-loaded scripts location. Multiple directory entries
+may be delimited by the host platform path separator in use
+(@samp{:} on Unix, @samp{;} on MS-Windows and MS-DOS).
+
+Each entry here needs to be covered also by the security setting
+@code{set auto-load safe-path} (@pxref{set auto-load safe-path}).
+
+@anchor{with-auto-load-dir}
+This variable defaults to @file{$ddir/auto-load}. The default @code{set
+auto-load safe-path} value can be also overriden by @value{GDBN} configuration
+option @option{--with-auto-load-dir}.
+
+Any used string @file{$ddir} will get replaced by @var{data-directory} which is
+determined at @value{GDBN} startup (@pxref{Data Files}). @file{$ddir} must be
+be placed as a directory component --- either alone or delimited by @file{/} or
+@file{\} directory separators, depending on the host platform.
+
+The list of directories uses path separator (@samp{:} on GNU and Unix
+systems, @samp{;} on MS-Windows and MS-DOS) to separate directories, similarly
+to the @env{PATH} environment variable.
+
+@anchor{show auto-load scripts-directory}
+@kindex show auto-load scripts-directory
+@item show auto-load scripts-directory
+Show @value{GDBN} auto-loaded scripts location.
+@end table
@value{GDBN} does not track which files it has already auto-loaded this way.
@value{GDBN} will load the associated script every time the corresponding

View File

@ -1,82 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-05/msg00082.html
### src/gdb/doc/ChangeLog 2012/05/11 18:20:26 1.1313
### src/gdb/doc/ChangeLog 2012/05/11 18:23:11 1.1314
## -1,5 +1,12 @@
2012-05-11 Jan Kratochvil <jan.kratochvil@redhat.com>
+ * gdb.texinfo (Auto-loading, Init File in the Current Directory)
+ (libthread_db.so.1 file, objfile-gdb.gdb file, objfile-gdb.py file)
+ (dotdebug_gdb_scripts section): Add reference
+ to 'Auto-loading safe path'.
+
+2012-05-11 Jan Kratochvil <jan.kratochvil@redhat.com>
+
Implement multi-component --with-auto-load-dir.
* gdb.texinfo (Auto-loading): New references
for 'set auto-load scripts-directory'
--- src/gdb/doc/gdb.texinfo 2012/05/11 18:20:26 1.959
+++ src/gdb/doc/gdb.texinfo 2012/05/11 18:23:11 1.960
@@ -20973,6 +20973,10 @@
results or introduce security risks (e.g., if the file comes from untrusted
sources).
+Note that loading of these associated files (including the local @file{.gdbinit}
+file) requires accordingly configured @code{auto-load safe-path}
+(@pxref{Auto-loading safe path}).
+
For these reasons, @value{GDBN} includes commands and options to let you
control when to auto-load files and which files should be auto-loaded.
@@ -21112,6 +21116,9 @@
from init file (if any) in the current working directory,
see @ref{Init File in the Current Directory during Startup}.
+Note that loading of this local @file{.gdbinit} file also requires accordingly
+configured @code{auto-load safe-path} (@pxref{Auto-loading safe path}).
+
@table @code
@anchor{set auto-load local-gdbinit}
@kindex set auto-load local-gdbinit
@@ -21148,6 +21155,9 @@
auto-load libthread-db} is enabled before trying to open such thread debugging
library.
+Note that loading of this debugging library also requires accordingly configured
+@code{auto-load safe-path} (@pxref{Auto-loading safe path}).
+
@table @code
@anchor{set auto-load libthread-db}
@kindex set auto-load libthread-db
@@ -21175,6 +21185,9 @@
canned sequences of commands (@pxref{Sequences}), as long as @samp{set
auto-load gdb-scripts} is set to @samp{on}.
+Note that loading of this script file also requires accordingly configured
+@code{auto-load safe-path} (@pxref{Auto-loading safe path}).
+
For more background refer to the similar Python scripts auto-loading
description (@pxref{objfile-gdb.py file}).
@@ -25465,7 +25478,10 @@
directories mentioned in the value of @code{debug-file-directory}.
Finally, if this file does not exist, then @value{GDBN} will look for
-@var{script-name} file in all of the directories specified by:
+@var{script-name} file in all of the directories as specified below.
+
+Note that loading of this script file also requires accordingly configured
+@code{auto-load safe-path} (@pxref{Auto-loading safe path}).
@table @code
@anchor{set auto-load scripts-directory}
@@ -25542,6 +25558,9 @@
The script name may include directories if desired.
+Note that loading of this script file also requires accordingly configured
+@code{auto-load safe-path} (@pxref{Auto-loading safe path}).
+
If the macro is put in a header, any application or library
using this header will get a reference to the specified script.

View File

@ -1,64 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2012-05/msg00091.html
### src/gdb/doc/ChangeLog 2012/05/11 22:24:22 1.1315
### src/gdb/doc/ChangeLog 2012/05/12 14:20:30 1.1316
## -1,3 +1,9 @@
+2012-05-12 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Eli Zaretskii <eliz@gnu.org>
+
+ * gdb.texinfo (Separate Debug Files): Use plural form for global
+ debugging information directory.
+
2012-05-11 Stan Shebs <stan@codesourcery.com>
Kwok Cheung Yeung <kcy@codesourcery.com>
--- src/gdb/doc/gdb.texinfo 2012/05/11 22:24:22 1.961
+++ src/gdb/doc/gdb.texinfo 2012/05/12 14:20:31 1.962
@@ -16287,7 +16287,7 @@
@cindex debugging information in separate files
@cindex @file{.debug} subdirectories
@cindex debugging information directory, global
-@cindex global debugging information directory
+@cindex global debugging information directories
@cindex build ID, and separate debugging files
@cindex @file{.build-id} directory
@@ -16332,14 +16332,14 @@
@item
For the ``debug link'' method, @value{GDBN} looks up the named file in
the directory of the executable file, then in a subdirectory of that
-directory named @file{.debug}, and finally under the global debug
-directory, in a subdirectory whose name is identical to the leading
+directory named @file{.debug}, and finally under each one of the global debug
+directories, in a subdirectory whose name is identical to the leading
directories of the executable's absolute file name.
@item
For the ``build ID'' method, @value{GDBN} looks in the
-@file{.build-id} subdirectory of the global debug directory for a file
-named @file{@var{nn}/@var{nnnnnnnn}.debug}, where @var{nn} are the
+@file{.build-id} subdirectory of each one of the global debug directories for
+a file named @file{@var{nn}/@var{nnnnnnnn}.debug}, where @var{nn} are the
first 2 hex characters of the build ID bit string, and @var{nnnnnnnn}
are the rest of the bit string. (Real build ID strings are 32 or more
hex characters, not 10.)
@@ -16348,7 +16348,7 @@
So, for example, suppose you ask @value{GDBN} to debug
@file{/usr/bin/ls}, which has a debug link that specifies the
file @file{ls.debug}, and a build ID whose value in hex is
-@code{abcdef1234}. If the global debug directory is
+@code{abcdef1234}. If the list of the global debug directories includes
@file{/usr/lib/debug}, then @value{GDBN} will look for the following
debug information files, in the indicated order:
@@ -16363,8 +16363,8 @@
@file{/usr/lib/debug/usr/bin/ls.debug}.
@end itemize
-You can set the global debugging info directory's name, and view the
-name @value{GDBN} is currently using.
+You can set the global debugging info directories, and view the
+list @value{GDBN} is currently using.
@table @code

View File

@ -1,42 +0,0 @@
http://sourceware.org/ml/gdb-patches/2012-05/msg00449.html
Subject: [patch] Cosmetic fix 'show auto-load safe-path' for ":" [Re: [patch 1/2] Provide $ddir substitution for --with-auto-load-safe-path]
On Fri, 11 May 2012 21:33:53 +0200, Jan Kratochvil wrote:
> On Fri, 11 May 2012 21:14:47 +0200, Pedro Alves wrote:
> > Looks like there is some special casing somewhere:
>
> True, I forgot and I agree. But it is only this "cosmetic" message, it has no
> functionality effect. I can fix this "any directory" message conditional.
Regards,
Jan
gdb/
2012-05-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* auto-load.c (show_auto_load_safe_path): Accept any combination of
DIRNAME_SEPARATOR and IS_DIR_SEPARATOR for wild-match.
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index 5ee117f..462ee06 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -241,7 +241,15 @@ static void
show_auto_load_safe_path (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- if (strcmp (value, "/") == 0)
+ const char *cs;
+
+ /* Check if user has entered either "/" or for example ":".
+ But while more complicate content like ":/foo" would still also
+ permit any location do not hide those. */
+
+ for (cs = value; *cs && (*cs == DIRNAME_SEPARATOR || IS_DIR_SEPARATOR (*cs));
+ cs++);
+ if (*cs == 0)
fprintf_filtered (file, _("Auto-load files are safe to load from any "
"directory.\n"));
else

View File

@ -1,225 +0,0 @@
http://sourceware.org/ml/gdb-patches/2012-05/msg00476.html
Subject: [patch 1/2] auto-load: Rename $ddir to $datadir
Hi,
when Doug suggested $ddir for data-directory, similar to $cdir, $pdir and
$sdir already in use, it made sense.
But currently I need to introduce also a variable for debug-file-directory and
having both $ddir and $debugdir valid in the same string seems to be confusing.
Therefore proposing to have $datadir and $debugdir instead in the next patch,
this patch is just a machanical rename $ddir -> $datadir.
I do not think it needs backward compatibiluty as $ddir has not yet been in
any GDB release.
Thanks,
Jan
gdb/
2012-05-12 Jan Kratochvil <jan.kratochvil@redhat.com>
Rename $ddir to $datadir.
* NEWS (--with-auto-load-dir): Rename $ddir to $datadir.
* auto-load.c (auto_load_safe_path_vec_update)
(auto_load_gdb_datadir_changed, auto_load_objfile_script): Likewise.
* configure: Regenerate.
* configure.ac (--with-auto-load-dir, --with-auto-load-safe-path):
Likewise. Remove the 'use $ddir' help string.
gdb/doc/
2012-05-12 Jan Kratochvil <jan.kratochvil@redhat.com>
Rename $ddir to $datadir.
* gdb.texinfo (Auto-loading, Auto-loading safe path)
(objfile-gdb.py file): Rename $ddir to $datadir.
Index: gdb-7.4.50.20120120/gdb/NEWS
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/NEWS 2012-05-14 14:24:15.112490286 +0200
+++ gdb-7.4.50.20120120/gdb/NEWS 2012-05-14 14:24:20.224480210 +0200
@@ -317,8 +317,8 @@ show trace-stop-notes
--with-auto-load-dir
Configure default value for the 'set auto-load scripts-directory'
- setting above. It defaults to '$ddir/auto-load', $ddir representing
- GDB's data directory (available via show data-directory).
+ setting above. It defaults to '$datadir/auto-load', $datadir
+ representing GDB's data directory (available via show data-directory).
--with-auto-load-safe-path
Configure default value for the 'set auto-load safe-path' setting
Index: gdb-7.4.50.20120120/gdb/auto-load.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/auto-load.c 2012-05-14 14:24:15.112490286 +0200
+++ gdb-7.4.50.20120120/gdb/auto-load.c 2012-05-14 14:24:20.224480210 +0200
@@ -174,13 +174,13 @@ auto_load_safe_path_vec_update (void)
char *ddir_subst, *expanded, *real_path;
ddir_subst = xstrdup (dir);
- substitute_path_component (&ddir_subst, "$ddir", gdb_datadir);
+ substitute_path_component (&ddir_subst, "$datadir", gdb_datadir);
expanded = tilde_expand (ddir_subst);
xfree (ddir_subst);
real_path = gdb_realpath (expanded);
/* Ensure the current entry is at least a valid path (therefore
- $ddir-expanded and tilde-expanded). */
+ $datadir-expanded and tilde-expanded). */
VEC_replace (char_ptr, auto_load_safe_path_vec, ix, expanded);
if (debug_auto_load)
@@ -212,7 +212,7 @@ auto_load_safe_path_vec_update (void)
}
}
-/* Variable gdb_datadir has been set. Update content depending on $ddir. */
+/* Variable gdb_datadir has been set. Update content depending on $datadir. */
static void
auto_load_gdb_datadir_changed (void)
@@ -699,7 +699,7 @@ auto_load_objfile_script (struct objfile
for (ix = 0; VEC_iterate (char_ptr, vec, ix, dir); ++ix)
{
debugfile = xstrdup (dir);
- substitute_path_component (&debugfile, "$ddir", gdb_datadir);
+ substitute_path_component (&debugfile, "$datadir", gdb_datadir);
debugfile = xrealloc (debugfile, (strlen (debugfile)
+ strlen (filename) + 1));
Index: gdb-7.4.50.20120120/gdb/configure
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/configure 2012-05-14 14:24:15.112490286 +0200
+++ gdb-7.4.50.20120120/gdb/configure 2012-05-14 14:24:38.564444061 +0200
@@ -1669,11 +1669,10 @@ Optional Packages:
--with-rpm query rpm database for missing debuginfos (yes/no,
def. auto=librpm.so)
--with-auto-load-dir=PATH
- directories from which to load auto-loaded scripts,
- use '$ddir' for -data-directory [$ddir/auto-load]
+ directories from which to load auto-loaded scripts
+ [$datadir/auto-load]
--with-auto-load-safe-path=PATH
- directories safe to hold auto-loaded files, use
- $ddir for --with-gdb-datadir path
+ directories safe to hold auto-loaded files
[--with-auto-load-dir]
--without-auto-load-safe-path
do not restrict auto-loaded files locations
@@ -8495,10 +8494,10 @@ $as_echo_n "checking for default auto-lo
if test "${with_auto_load_dir+set}" = set; then :
withval=$with_auto_load_dir;
else
- with_auto_load_dir='$ddir/auto-load'
+ with_auto_load_dir='$datadir/auto-load'
fi
-escape_dir=`echo $with_auto_load_dir | sed 's/[$]ddir\>/\\\\\\\\\\\\&/g'`
+escape_dir=`echo $with_auto_load_dir | sed 's/[$]datadir\>/\\\\\\\\\\\\&/g'`
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
@@ -8525,7 +8524,7 @@ else
with_auto_load_safe_path="$with_auto_load_dir"
fi
-escape_dir=`echo $with_auto_load_safe_path | sed 's/[$]ddir\>/\\\\\\\\\\\\&/g'`
+escape_dir=`echo $with_auto_load_safe_path | sed 's/[$]datadir\>/\\\\\\\\\\\\&/g'`
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
Index: gdb-7.4.50.20120120/gdb/configure.ac
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/configure.ac 2012-05-14 14:24:15.112490286 +0200
+++ gdb-7.4.50.20120120/gdb/configure.ac 2012-05-14 14:24:20.228480202 +0200
@@ -342,9 +342,9 @@ fi
AC_MSG_CHECKING([for default auto-load directory])
AC_ARG_WITH(auto-load-dir,
AS_HELP_STRING([--with-auto-load-dir=PATH],
- [directories from which to load auto-loaded scripts, use '$ddir' for -data-directory @<:@$ddir/auto-load@:>@]),,
- [with_auto_load_dir='$ddir/auto-load'])
-escape_dir=`echo $with_auto_load_dir | sed 's/[[$]]ddir\>/\\\\\\\\\\\\&/g'`
+ [directories from which to load auto-loaded scripts @<:@$datadir/auto-load@:>@]),,
+ [with_auto_load_dir='$datadir/auto-load'])
+escape_dir=`echo $with_auto_load_dir | sed 's/[[$]]datadir\>/\\\\\\\\\\\\&/g'`
AC_DEFINE_DIR(AUTO_LOAD_DIR, escape_dir,
[Directories from which to load auto-loaded scripts.])
AC_MSG_RESULT([$with_auto_load_dir])
@@ -352,14 +352,14 @@ AC_MSG_RESULT([$with_auto_load_dir])
AC_MSG_CHECKING([for default auto-load safe-path])
AC_ARG_WITH(auto-load-safe-path,
AS_HELP_STRING([--with-auto-load-safe-path=PATH],
- [directories safe to hold auto-loaded files, use $ddir for --with-gdb-datadir path @<:@--with-auto-load-dir@:>@])
+ [directories safe to hold auto-loaded files @<:@--with-auto-load-dir@:>@])
AS_HELP_STRING([--without-auto-load-safe-path],
[do not restrict auto-loaded files locations]),
[if test "$with_auto_load_safe_path" = "no"; then
with_auto_load_safe_path="/"
fi],
[with_auto_load_safe_path="$with_auto_load_dir"])
-escape_dir=`echo $with_auto_load_safe_path | sed 's/[[$]]ddir\>/\\\\\\\\\\\\&/g'`
+escape_dir=`echo $with_auto_load_safe_path | sed 's/[[$]]datadir\>/\\\\\\\\\\\\&/g'`
AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
[Directories safe to hold auto-loaded files.])
AC_MSG_RESULT([$with_auto_load_safe_path])
Index: gdb-7.4.50.20120120/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/doc/gdb.texinfo 2012-05-14 14:24:15.113490284 +0200
+++ gdb-7.4.50.20120120/gdb/doc/gdb.texinfo 2012-05-14 14:24:20.234480190 +0200
@@ -20807,9 +20807,9 @@ local-gdbinit: Auto-loading of .gdbinit
is on.
python-scripts: Auto-loading of Python scripts is on.
safe-path: List of directories from which it is safe to auto-load files
- is $ddir/auto-load.
+ is $datadir/auto-load.
scripts-directory: List of directories from which to load auto-loaded scripts
- is $ddir/auto-load.
+ is $datadir/auto-load.
@end smallexample
@anchor{info auto-load}
@@ -21025,9 +21025,9 @@ get loaded:
$ ./gdb -q ./gdb
Reading symbols from /home/user/gdb/gdb...done.
warning: File "/home/user/gdb/gdb-gdb.gdb" auto-loading has been
- declined by your `auto-load safe-path' set to "$ddir/auto-load".
+ declined by your `auto-load safe-path' set to "$datadir/auto-load".
warning: File "/home/user/gdb/gdb-gdb.py" auto-loading has been
- declined by your `auto-load safe-path' set to "$ddir/auto-load".
+ declined by your `auto-load safe-path' set to "$datadir/auto-load".
@end smallexample
The list of trusted directories is controlled by the following commands:
@@ -21060,7 +21060,7 @@ host platform path separator in use.
@end table
This variable defaults to what @code{--with-auto-load-dir} has been configured
-to (@pxref{with-auto-load-dir}). @file{$ddir} substituation applies the same
+to (@pxref{with-auto-load-dir}). @file{$datadir} substituation applies the same
as for @xref{set auto-load scripts-directory}.
The default @code{set
auto-load safe-path} value can be also overriden by @value{GDBN} configuration
@@ -25181,14 +25181,14 @@ Each entry here needs to be covered also
@code{set auto-load safe-path} (@pxref{set auto-load safe-path}).
@anchor{with-auto-load-dir}
-This variable defaults to @file{$ddir/auto-load}. The default @code{set
+This variable defaults to @file{$datadir/auto-load}. The default @code{set
auto-load safe-path} value can be also overriden by @value{GDBN} configuration
option @option{--with-auto-load-dir}.
-Any used string @file{$ddir} will get replaced by @var{data-directory} which is
-determined at @value{GDBN} startup (@pxref{Data Files}). @file{$ddir} must be
-be placed as a directory component --- either alone or delimited by @file{/} or
-@file{\} directory separators, depending on the host platform.
+Any used string @file{$datadir} will get replaced by @var{data-directory} which
+is determined at @value{GDBN} startup (@pxref{Data Files}). @file{$datadir}
+must be placed as a directory component --- either alone or delimited by
+@file{/} or @file{\} directory separators, depending on the host platform.
The list of directories uses path separator (@samp{:} on GNU and Unix
systems, @samp{;} on MS-Windows and MS-DOS) to separate directories, similarly

View File

@ -1,393 +0,0 @@
http://sourceware.org/ml/gdb-patches/2012-05/msg00477.html
Subject: [patch+doc 2/2] auto-load: Fix default /usr/lib/debug/ loading
Hi,
with recent security fix to use only $datadir/auto-load/ directory instead of
anything under $prefix/ (which contains insecure $prefix/tmp/ etc.) it
introduced a regression that GDB's default --with-separate-debug-dir would no
longer be secure; which IMO can be assumed as secure. This is because
I forgot to move into 'set auto-load scripts-directory' (and 'safe-path') also
debug-file-diretory; besides $datadir/auto-load which I have moved there.
To also solve the problem with relocatability and make it configurable I just
introduce besides $datadir now also $debugdir and add it into
default 'set auto-load scripts-directory'. It also IMO makes it more clear
what everything is being auto-loaded in:
(gdb) show auto-load
gdb-scripts: Auto-loading of canned sequences of commands scripts is on.
libthread-db: Auto-loading of inferior specific libthread_db is on.
local-gdbinit: Auto-loading of .gdbinit script from current directory is on.
python-scripts: Auto-loading of Python scripts is on.
safe-path: List of directories from which it is safe to auto-load files is $debugdir:$datadir/auto-load.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
scripts-directory: List of directories from which to load auto-loaded scripts is $debugdir:$datadir/auto-load.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu.
I find it more just a bugfix of a regression by myself.
Thanks,
Jan
gdb/
2012-05-12 Jan Kratochvil <jan.kratochvil@redhat.com>
* NEWS (--with-auto-load-dir): Prepend $debugdir to the default path.
Describe it.
* auto-load.c (auto_load_expand_dir_vars): New function.
(auto_load_safe_path_vec_update): Use it, remove the
substitute_path_component call thanks to it.
(auto_load_objfile_script): Remove the debug_file_directory processing.
Use auto_load_expand_dir_vars, remove the substitute_path_component
call thanks to it.
* configure: Regenerate.
* configure.ac (--with-auto-load-dir): Prepend $debugdir to the default
path. Escape $ also for $debugdir.
(--with_auto_load_safe_path): Escape $ also for $debugdir.
* utils.c (substitute_path_component): Accept also DIRNAME_SEPARATOR.
gdb/doc/
2012-05-12 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Separate Debug Files): New anchor debug-file-directory.
Mention also --with-separate-debug-dir.
(Auto-loading): Prepend $debugdir in the sample output.
(Auto-loading safe path): Likewise. Mention also $debugdir for the
auto-load safe-path variable.
(objfile-gdb.py file): Remove the extra debug-file-directory paragraph.
Mention also $debugdir for 'set auto-load scripts-directory'.
Index: gdb-7.4.50.20120120/gdb/NEWS
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/NEWS 2012-05-14 14:24:20.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/NEWS 2012-05-14 14:24:49.510422485 +0200
@@ -317,8 +317,10 @@ show trace-stop-notes
--with-auto-load-dir
Configure default value for the 'set auto-load scripts-directory'
- setting above. It defaults to '$datadir/auto-load', $datadir
- representing GDB's data directory (available via show data-directory).
+ setting above. It defaults to '$debugdir:$datadir/auto-load',
+ $debugdir representing global debugging info directories (available
+ via 'show debug-file-directory') and $datadir representing GDB's data
+ directory (available via 'show data-directory').
--with-auto-load-safe-path
Configure default value for the 'set auto-load safe-path' setting
Index: gdb-7.4.50.20120120/gdb/auto-load.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/auto-load.c 2012-05-14 14:24:20.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/auto-load.c 2012-05-14 14:24:49.511422483 +0200
@@ -147,6 +147,30 @@ static char *auto_load_safe_path;
counterpart. */
static VEC (char_ptr) *auto_load_safe_path_vec;
+/* Expand $datadir and $debugdir in STRING according to the rules of
+ substitute_path_component. Return vector from dirnames_to_char_ptr_vec,
+ this vector must be freed by free_char_ptr_vec by the caller. */
+
+static VEC (char_ptr) *
+auto_load_expand_dir_vars (const char *string)
+{
+ VEC (char_ptr) *dir_vec;
+ char *s;
+
+ s = xstrdup (string);
+ substitute_path_component (&s, "$datadir", gdb_datadir);
+ substitute_path_component (&s, "$debugdir", debug_file_directory);
+
+ if (debug_auto_load && strcmp (s, string) != 0)
+ fprintf_unfiltered (gdb_stdlog,
+ _("auto-load: Expanded $-variables to \"%s\".\n"), s);
+
+ dir_vec = dirnames_to_char_ptr_vec (s);
+ xfree(s);
+
+ return dir_vec;
+}
+
/* Update auto_load_safe_path_vec from current AUTO_LOAD_SAFE_PATH. */
static void
@@ -163,7 +187,7 @@ auto_load_safe_path_vec_update (void)
free_char_ptr_vec (auto_load_safe_path_vec);
- auto_load_safe_path_vec = dirnames_to_char_ptr_vec (auto_load_safe_path);
+ auto_load_safe_path_vec = auto_load_expand_dir_vars (auto_load_safe_path);
len = VEC_length (char_ptr, auto_load_safe_path_vec);
/* Apply tilde_expand and gdb_realpath to each AUTO_LOAD_SAFE_PATH_VEC
@@ -171,16 +195,10 @@ auto_load_safe_path_vec_update (void)
for (ix = 0; ix < len; ix++)
{
char *dir = VEC_index (char_ptr, auto_load_safe_path_vec, ix);
- char *ddir_subst, *expanded, *real_path;
-
- ddir_subst = xstrdup (dir);
- substitute_path_component (&ddir_subst, "$datadir", gdb_datadir);
- expanded = tilde_expand (ddir_subst);
- xfree (ddir_subst);
- real_path = gdb_realpath (expanded);
+ char *expanded = tilde_expand (dir);
+ char *real_path = gdb_realpath (expanded);
- /* Ensure the current entry is at least a valid path (therefore
- $datadir-expanded and tilde-expanded). */
+ /* Ensure the current entry is at least tilde_expand-ed. */
VEC_replace (char_ptr, auto_load_safe_path_vec, ix, expanded);
if (debug_auto_load)
@@ -645,42 +663,6 @@ auto_load_objfile_script (struct objfile
if (!input)
{
- char *debugdir;
- VEC (char_ptr) *debugdir_vec;
- int ix;
-
- debugdir_vec = dirnames_to_char_ptr_vec (debug_file_directory);
- make_cleanup_free_char_ptr_vec (debugdir_vec);
-
- if (debug_auto_load)
- fprintf_unfiltered (gdb_stdlog,
- _("auto-load: Searching 'set debug-file-directory' "
- "path \"%s\".\n"),
- debug_file_directory);
-
- for (ix = 0; VEC_iterate (char_ptr, debugdir_vec, ix, debugdir); ++ix)
- {
- /* Also try the same file in the separate debug info directory. */
- debugfile = xmalloc (strlen (debugdir) + strlen (filename) + 1);
- strcpy (debugfile, debugdir);
-
- /* FILENAME is absolute, so we don't need a "/" here. */
- strcat (debugfile, filename);
-
- make_cleanup (xfree, debugfile);
- input = fopen (debugfile, "r");
- if (debug_auto_load)
- fprintf_unfiltered (gdb_stdlog, _("auto-load: Attempted file "
- "\"%s\" %s.\n"),
- debugfile,
- input ? _("exists") : _("does not exist"));
- if (input != NULL)
- break;
- }
- }
-
- if (!input)
- {
VEC (char_ptr) *vec;
int ix;
char *dir;
@@ -688,7 +670,7 @@ auto_load_objfile_script (struct objfile
/* Also try the same file in a subdirectory of gdb's data
directory. */
- vec = dirnames_to_char_ptr_vec (auto_load_dir);
+ vec = auto_load_expand_dir_vars (auto_load_dir);
make_cleanup_free_char_ptr_vec (vec);
if (debug_auto_load)
@@ -698,10 +680,8 @@ auto_load_objfile_script (struct objfile
for (ix = 0; VEC_iterate (char_ptr, vec, ix, dir); ++ix)
{
- debugfile = xstrdup (dir);
- substitute_path_component (&debugfile, "$datadir", gdb_datadir);
- debugfile = xrealloc (debugfile, (strlen (debugfile)
- + strlen (filename) + 1));
+ debugfile = xmalloc (strlen (dir) + strlen (filename) + 1);
+ strcpy (debugfile, dir);
/* FILENAME is absolute, so we don't need a "/" here. */
strcat (debugfile, filename);
Index: gdb-7.4.50.20120120/gdb/configure
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/configure 2012-05-14 14:24:38.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/configure 2012-05-14 14:24:55.856409977 +0200
@@ -1670,7 +1670,7 @@ Optional Packages:
def. auto=librpm.so)
--with-auto-load-dir=PATH
directories from which to load auto-loaded scripts
- [$datadir/auto-load]
+ [$debugdir:$datadir/auto-load]
--with-auto-load-safe-path=PATH
directories safe to hold auto-loaded files
[--with-auto-load-dir]
@@ -8494,10 +8494,10 @@ $as_echo_n "checking for default auto-lo
if test "${with_auto_load_dir+set}" = set; then :
withval=$with_auto_load_dir;
else
- with_auto_load_dir='$datadir/auto-load'
+ with_auto_load_dir='$debugdir:$datadir/auto-load'
fi
-escape_dir=`echo $with_auto_load_dir | sed 's/[$]datadir\>/\\\\\\\\\\\\&/g'`
+escape_dir=`echo $with_auto_load_dir | sed 's/[$]\(datadir\|debugdir\)\>/\\\\\\\\\\\\&/g'`
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
@@ -8524,7 +8524,7 @@ else
with_auto_load_safe_path="$with_auto_load_dir"
fi
-escape_dir=`echo $with_auto_load_safe_path | sed 's/[$]datadir\>/\\\\\\\\\\\\&/g'`
+escape_dir=`echo $with_auto_load_safe_path | sed 's/[$]\(datadir\|debugdir\)\>/\\\\\\\\\\\\&/g'`
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
Index: gdb-7.4.50.20120120/gdb/configure.ac
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/configure.ac 2012-05-14 14:24:20.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/configure.ac 2012-05-14 14:24:49.515422477 +0200
@@ -342,9 +342,9 @@ fi
AC_MSG_CHECKING([for default auto-load directory])
AC_ARG_WITH(auto-load-dir,
AS_HELP_STRING([--with-auto-load-dir=PATH],
- [directories from which to load auto-loaded scripts @<:@$datadir/auto-load@:>@]),,
- [with_auto_load_dir='$datadir/auto-load'])
-escape_dir=`echo $with_auto_load_dir | sed 's/[[$]]datadir\>/\\\\\\\\\\\\&/g'`
+ [directories from which to load auto-loaded scripts @<:@$debugdir:$datadir/auto-load@:>@]),,
+ [with_auto_load_dir='$debugdir:$datadir/auto-load'])
+escape_dir=`echo $with_auto_load_dir | sed 's/[[$]]\(datadir\|debugdir\)\>/\\\\\\\\\\\\&/g'`
AC_DEFINE_DIR(AUTO_LOAD_DIR, escape_dir,
[Directories from which to load auto-loaded scripts.])
AC_MSG_RESULT([$with_auto_load_dir])
@@ -359,7 +359,7 @@ AS_HELP_STRING([--without-auto-load-safe
with_auto_load_safe_path="/"
fi],
[with_auto_load_safe_path="$with_auto_load_dir"])
-escape_dir=`echo $with_auto_load_safe_path | sed 's/[[$]]datadir\>/\\\\\\\\\\\\&/g'`
+escape_dir=`echo $with_auto_load_safe_path | sed 's/[[$]]\(datadir\|debugdir\)\>/\\\\\\\\\\\\&/g'`
AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
[Directories safe to hold auto-loaded files.])
AC_MSG_RESULT([$with_auto_load_safe_path])
Index: gdb-7.4.50.20120120/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/doc/gdb.texinfo 2012-05-14 14:24:20.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/doc/gdb.texinfo 2012-05-14 14:24:49.520422467 +0200
@@ -16028,8 +16028,11 @@ debug information files, in the indicate
@file{/usr/lib/debug/usr/bin/ls.debug}.
@end itemize
-You can set the global debugging info directories, and view the
-list @value{GDBN} is currently using.
+@anchor{debug-file-directory}
+Global debugging info directories default to what is set by @value{GDBN}
+configure option @option{--with-separate-debug-dir}. During @value{GDBN} run
+you can also set the global debugging info directories, and view the list
+@value{GDBN} is currently using.
@table @code
@@ -20807,9 +20810,9 @@ local-gdbinit: Auto-loading of .gdbinit
is on.
python-scripts: Auto-loading of Python scripts is on.
safe-path: List of directories from which it is safe to auto-load files
- is $datadir/auto-load.
+ is $debugdir:$datadir/auto-load.
scripts-directory: List of directories from which to load auto-loaded scripts
- is $datadir/auto-load.
+ is $debugdir:$datadir/auto-load.
@end smallexample
@anchor{info auto-load}
@@ -21025,9 +21028,11 @@ get loaded:
$ ./gdb -q ./gdb
Reading symbols from /home/user/gdb/gdb...done.
warning: File "/home/user/gdb/gdb-gdb.gdb" auto-loading has been
- declined by your `auto-load safe-path' set to "$datadir/auto-load".
+ declined by your `auto-load safe-path' set
+ to "$debugdir:$datadir/auto-load".
warning: File "/home/user/gdb/gdb-gdb.py" auto-loading has been
- declined by your `auto-load safe-path' set to "$datadir/auto-load".
+ declined by your `auto-load safe-path' set
+ to "$debugdir:$datadir/auto-load".
@end smallexample
The list of trusted directories is controlled by the following commands:
@@ -21060,11 +21065,10 @@ host platform path separator in use.
@end table
This variable defaults to what @code{--with-auto-load-dir} has been configured
-to (@pxref{with-auto-load-dir}). @file{$datadir} substituation applies the same
-as for @xref{set auto-load scripts-directory}.
-The default @code{set
-auto-load safe-path} value can be also overriden by @value{GDBN} configuration
-option @option{--with-auto-load-safe-path}.
+to (@pxref{with-auto-load-dir}). @file{$debugdir} and @file{$datadir}
+substituation applies the same as for @xref{set auto-load scripts-directory}.
+The default @code{set auto-load safe-path} value can be also overriden by
+@value{GDBN} configuration option @option{--with-auto-load-safe-path}.
Setting this variable to @file{/} disables this security protection,
corresponding @value{GDBN} configuration option is
@@ -25158,12 +25162,7 @@ that the file name is absolute, followin
@code{.} and @code{..} components. If this file exists and is
readable, @value{GDBN} will evaluate it as a Python script.
-If this file does not exist, and if the parameter
-@code{debug-file-directory} is set (@pxref{Separate Debug Files}),
-then @value{GDBN} will look for @var{script-name} in all of the
-directories mentioned in the value of @code{debug-file-directory}.
-
-Finally, if this file does not exist, then @value{GDBN} will look for
+If this file does not exist, then @value{GDBN} will look for
@var{script-name} file in all of the directories as specified below.
Note that loading of this script file also requires accordingly configured
@@ -25181,12 +25180,14 @@ Each entry here needs to be covered also
@code{set auto-load safe-path} (@pxref{set auto-load safe-path}).
@anchor{with-auto-load-dir}
-This variable defaults to @file{$datadir/auto-load}. The default @code{set
-auto-load safe-path} value can be also overriden by @value{GDBN} configuration
-option @option{--with-auto-load-dir}.
-
-Any used string @file{$datadir} will get replaced by @var{data-directory} which
-is determined at @value{GDBN} startup (@pxref{Data Files}). @file{$datadir}
+This variable defaults to @file{$debugdir:$datadir/auto-load}. The default
+@code{set auto-load safe-path} value can be also overriden by @value{GDBN}
+configuration option @option{--with-auto-load-dir}.
+
+Any used string @file{$debugdir} will get replaced by @var{debug-file-directory}
+value (@pxref{Separate Debug Files}) and any used string @file{$datadir} will
+get replaced by @var{data-directory} which is determined at @value{GDBN} startup
+(@pxref{Data Files}). @file{$debugdir} and @file{$datadir}
must be placed as a directory component --- either alone or delimited by
@file{/} or @file{\} directory separators, depending on the host platform.
Index: gdb-7.4.50.20120120/gdb/utils.c
===================================================================
--- gdb-7.4.50.20120120.orig/gdb/utils.c 2012-05-14 14:24:11.000000000 +0200
+++ gdb-7.4.50.20120120/gdb/utils.c 2012-05-14 14:24:49.521422465 +0200
@@ -3927,8 +3927,8 @@ dirnames_to_char_ptr_vec (const char *di
/* Substitute all occurences of string FROM by string TO in *STRINGP. *STRINGP
must come from xrealloc-compatible allocator and it may be updated. FROM
- needs to be delimited by IS_DIR_SEPARATOR (or be located at the start or
- end of *STRINGP. */
+ needs to be delimited by IS_DIR_SEPARATOR or DIRNAME_SEPARATOR (or be
+ located at the start or end of *STRINGP. */
void
substitute_path_component (char **stringp, const char *from, const char *to)
@@ -3943,8 +3943,10 @@ substitute_path_component (char **string
if (s == NULL)
break;
- if ((s == string || IS_DIR_SEPARATOR (s[-1]))
- && (s[from_len] == '\0' || IS_DIR_SEPARATOR (s[from_len])))
+ if ((s == string || IS_DIR_SEPARATOR (s[-1])
+ || s[-1] == DIRNAME_SEPARATOR)
+ && (s[from_len] == '\0' || IS_DIR_SEPARATOR (s[from_len])
+ || s[from_len] == DIRNAME_SEPARATOR))
{
char *string_new;

View File

@ -1,20 +1,20 @@
Index: gdb-7.4.50.20111218/gdb/config/i386/linux64.mh
Index: gdb-7.4.50.20120602/gdb/config/i386/linux64.mh
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/config/i386/linux64.mh 2011-08-24 14:07:26.000000000 +0200
+++ gdb-7.4.50.20111218/gdb/config/i386/linux64.mh 2011-12-19 01:40:49.492625837 +0100
--- gdb-7.4.50.20120602.orig/gdb/config/i386/linux64.mh 2012-03-13 16:00:34.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/config/i386/linux64.mh 2012-06-02 19:56:03.196172503 +0200
@@ -4,7 +4,7 @@ NATDEPFILES= inf-ptrace.o fork-child.o \
linux-nat.o linux-osdata.o \
proc-service.o linux-thread-db.o linux-fork.o \
linux-procfs.o
linux-procfs.o linux-ptrace.o
-NAT_FILE= config/nm-linux.h
+NAT_FILE= nm-linux64.h
NAT_CDEPS = $(srcdir)/proc-service.list
# The dynamically loaded libthread_db needs access to symbols in the
Index: gdb-7.4.50.20111218/gdb/config/i386/linux.mh
Index: gdb-7.4.50.20120602/gdb/config/i386/linux.mh
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/config/i386/linux.mh 2011-08-24 14:07:26.000000000 +0200
+++ gdb-7.4.50.20111218/gdb/config/i386/linux.mh 2011-12-19 01:40:32.453689006 +0100
--- gdb-7.4.50.20120602.orig/gdb/config/i386/linux.mh 2012-03-13 16:00:33.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/config/i386/linux.mh 2012-06-02 19:55:42.418178412 +0200
@@ -1,6 +1,6 @@
# Host: Intel 386 running GNU/Linux.
@ -23,10 +23,10 @@ Index: gdb-7.4.50.20111218/gdb/config/i386/linux.mh
NATDEPFILES= inf-ptrace.o fork-child.o \
i386-nat.o i386-linux-nat.o \
proc-service.o linux-thread-db.o \
Index: gdb-7.4.50.20111218/gdb/config/i386/nm-linux.h
Index: gdb-7.4.50.20120602/gdb/config/i386/nm-linux.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20111218/gdb/config/i386/nm-linux.h 2011-12-19 01:40:32.454689002 +0100
+++ gdb-7.4.50.20120602/gdb/config/i386/nm-linux.h 2012-06-02 19:55:42.433178408 +0200
@@ -0,0 +1,28 @@
+/* Native support for GNU/Linux i386.
+
@ -56,10 +56,10 @@ Index: gdb-7.4.50.20111218/gdb/config/i386/nm-linux.h
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
+#endif /* NM_LINUX64_H */
Index: gdb-7.4.50.20111218/gdb/config/i386/nm-linux64.h
Index: gdb-7.4.50.20120602/gdb/config/i386/nm-linux64.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20111218/gdb/config/i386/nm-linux64.h 2011-12-19 01:40:32.455688998 +0100
+++ gdb-7.4.50.20120602/gdb/config/i386/nm-linux64.h 2012-06-02 19:55:42.434178407 +0200
@@ -0,0 +1,28 @@
+/* Native support for GNU/Linux amd64.
+
@ -89,11 +89,11 @@ Index: gdb-7.4.50.20111218/gdb/config/i386/nm-linux64.h
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
+#endif /* NM_LINUX64_H */
Index: gdb-7.4.50.20111218/gdb/target.h
Index: gdb-7.4.50.20120602/gdb/target.h
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/target.h 2011-12-06 21:03:13.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/target.h 2011-12-19 01:40:32.456688995 +0100
@@ -1391,8 +1391,10 @@ extern char *target_thread_name (struct
--- gdb-7.4.50.20120602.orig/gdb/target.h 2012-06-01 18:37:59.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/target.h 2012-06-02 19:55:42.436178407 +0200
@@ -1470,8 +1470,10 @@ extern char *target_thread_name (struct
bp_hardware_breakpoint. CNT is the number of such watchpoints used so far
(including this one?). OTHERTYPE is who knows what... */
@ -104,10 +104,10 @@ Index: gdb-7.4.50.20111218/gdb/target.h
/* Returns the number of debug registers needed to watch the given
memory region, or zero if not supported. */
Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp 2011-12-19 01:40:32.464688965 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp 2012-06-02 19:55:42.442178406 +0200
@@ -0,0 +1,40 @@
+# Copyright 2009, 2010 Free Software Foundation, Inc.
+

View File

@ -1,43 +0,0 @@
2010-06-01 Chris Moller <cmoller@redhat.com>
* python/libstdcxx/v6/printers.py (StdVectorPrinter): Add
detection for matrices as nested vectors.
Index: libstdc++-v3/python/libstdcxx/v6/printers.py
===================================================================
--- ./libstdc++-v3-python-r155978/libstdcxx/v6/printers.py (revision 159937)
+++ ./libstdc++-v3-python-r155978/libstdcxx/v6/printers.py (working copy)
@@ -19,6 +19,9 @@
import itertools
import re
+vector_sig = 'std::vector'
+vector_regex = re.compile('^' + vector_sig + '<.*>$')
+
class StdPointerPrinter:
"Print a smart pointer of some kind"
@@ -186,7 +189,13 @@
% (self.typename, int (finish - start), int (end - start)))
def display_hint(self):
- return 'array'
+ itype0 = self.val.type.template_argument(0)
+ itag = itype0.tag
+ if itag and re.match(vector_regex, itag):
+ rc = 'matrix'
+ else:
+ rc = 'array'
+ return rc
class StdVectorIteratorPrinter:
"Print std::vector::iterator"
@@ -692,7 +701,7 @@
pretty_printers_dict[re.compile('^std::set<.*>$')] = lambda val: StdSetPrinter("std::set", val)
pretty_printers_dict[re.compile('^std::stack<.*>$')] = lambda val: StdStackOrQueuePrinter("std::stack", val)
pretty_printers_dict[re.compile('^std::unique_ptr<.*>$')] = UniquePointerPrinter
- pretty_printers_dict[re.compile('^std::vector<.*>$')] = lambda val: StdVectorPrinter("std::vector", val)
+ pretty_printers_dict[vector_regex] = lambda val: StdVectorPrinter(vector_sig, val)
# vector<bool>
# Printer registrations for classes compiled with -D_GLIBCXX_DEBUG.

View File

@ -1,398 +0,0 @@
2010-05-31 Chris Moller <cmoller@redhat.com>
* python/py-prettyprint.c (print_children): Add formatting for
matrices. (apply_val_pretty_printer): Detect and deal with matrix
hints.
2010-05-31 Chris Moller <cmoller@redhat.com>
* gdb.python/Makefile.in (EXECUTABLES): Added pr10659.
* gdb.python/pr10659.cc: New file.
* gdb.python/pr10659.exp. New file.
* gdb.python/pr10659.py: New file.
Index: gdb-7.2.50.20110218/gdb/valprint.h
===================================================================
--- gdb-7.2.50.20110218.orig/gdb/valprint.h 2011-02-14 12:35:45.000000000 +0100
+++ gdb-7.2.50.20110218/gdb/valprint.h 2011-02-18 10:44:32.000000000 +0100
@@ -90,6 +90,9 @@ struct value_print_options
/* If nonzero, print the value in "summary" form. */
int summary;
+
+ /* Affects pretty printing of matrices. */
+ int prettyprint_matrix;
};
/* The global print options set by the user. In general this should
Index: gdb-7.2.50.20110218/gdb/python/py-prettyprint.c
===================================================================
--- gdb-7.2.50.20110218.orig/gdb/python/py-prettyprint.c 2011-02-14 12:10:53.000000000 +0100
+++ gdb-7.2.50.20110218/gdb/python/py-prettyprint.c 2011-02-18 10:45:02.000000000 +0100
@@ -501,7 +501,7 @@ print_children (PyObject *printer, const
/* Use the prettyprint_arrays option if we are printing an array,
and the pretty option otherwise. */
- if (is_array)
+ if (is_array || options->prettyprint_matrix)
pretty = options->prettyprint_arrays;
else
{
@@ -521,6 +521,9 @@ print_children (PyObject *printer, const
goto done;
}
make_cleanup_py_decref (frame);
+
+ if (options->prettyprint_matrix && recurse == 0)
+ fputs_filtered ("\n", stream);
done_flag = 0;
for (i = 0; i < options->print_max; ++i)
@@ -555,12 +558,23 @@ print_children (PyObject *printer, const
3. Other. Always print a ",". */
if (i == 0)
{
- if (is_py_none)
- fputs_filtered ("{", stream);
- else
- fputs_filtered (" = {", stream);
+ if (options->prettyprint_matrix && recurse == 0)
+ print_spaces_filtered (2 + 2 * recurse, stream);
+ if (is_py_none)
+ {
+ if (options->prettyprint_matrix && strcmp (hint, "array"))
+ {
+ fputs_filtered ("{\n", stream);
+ print_spaces_filtered (4 + 2 * recurse, stream);
+ }
+ else
+ fputs_filtered ("{", stream);
+ }
+ else
+ fputs_filtered (" = {", stream);
}
-
+ else if (options->prettyprint_matrix)
+ print_spaces_filtered (4 + 2 * recurse, stream);
else if (! is_map || i % 2 == 0)
fputs_filtered (pretty ? "," : ", ", stream);
@@ -589,6 +603,10 @@ print_children (PyObject *printer, const
if (is_map && i % 2 == 0)
fputs_filtered ("[", stream);
+ else if (options->prettyprint_matrix)
+ {
+ /* Force a do-nothing. */
+ }
else if (is_array)
{
/* We print the index, not whatever the child method
@@ -667,7 +685,12 @@ print_children (PyObject *printer, const
fputs_filtered ("\n", stream);
print_spaces_filtered (2 * recurse, stream);
}
- fputs_filtered ("}", stream);
+ if (options->prettyprint_matrix)
+ {
+ print_spaces_filtered (4 * recurse, stream);
+ fputs_filtered ("}\n", stream);
+ }
+ else fputs_filtered ("}", stream);
}
done:
@@ -689,6 +712,7 @@ apply_val_pretty_printer (struct type *t
char *hint = NULL;
struct cleanup *cleanups;
int result = 0;
+ struct value_print_options *options_copy;
enum string_repr_result print_result;
/* No pretty-printer support for unavailable values. */
@@ -726,9 +750,21 @@ apply_val_pretty_printer (struct type *t
/* If we are printing a map, we want some special formatting. */
hint = gdbpy_get_display_hint (printer);
+
+ if (recurse == 0)
+ {
+ options_copy = alloca (sizeof (struct value_print_options));
+ memcpy (options_copy, options, sizeof (struct value_print_options));
+ options_copy->prettyprint_matrix = hint && !strcmp (hint, "matrix");
+ }
+ else options_copy = (struct value_print_options *)options;
+
make_cleanup (free_current_contents, &hint);
/* Print the section */
+ if (options_copy->prettyprint_matrix)
+ print_result = string_repr_none;
+else /* Red Hat 2D matrix patch */
print_result = print_string_repr (printer, hint, stream, recurse,
options, language, gdbarch);
if (print_result != string_repr_error)
Index: gdb-7.2.50.20110218/gdb/testsuite/gdb.python/pr10659.cc
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110218/gdb/testsuite/gdb.python/pr10659.cc 2011-02-18 10:44:32.000000000 +0100
@@ -0,0 +1,43 @@
+#include <list>
+#include <vector> // /usr/include/c++/4.4.1/bits/vector.tcc
+#include <iostream>
+
+using namespace std;
+
+int use_windows = 9999;
+
+int
+main(){
+ vector<int> test1(2,0);
+ test1[0]=8;
+ test1[1]=9;
+
+ vector< vector<int> > test2(3, vector<int>(2,0));
+ test2[0][0]=0;
+ test2[0][1]=1;
+ test2[1][0]=2;
+ test2[1][1]=3;
+ test2[2][0]=4;
+ test2[2][1]=5;
+
+#define NR_ROWS 2
+#define NR_COLS 3
+#define NR_PLANES 4
+ vector<int> rows(NR_ROWS, 0);
+ vector< vector<int> > columns(NR_COLS, rows);
+ vector< vector < vector<int> > > test3(NR_PLANES, columns);
+
+ cout << "rows.size() = " << rows.size()
+ << ", columns.size() = " << columns.size()
+ << ", test3.size() = " << test3.size() << "\n";
+
+ for (int i = 0; i < rows.size(); i++) {
+ for (int j = 0; j < columns.size(); j++) {
+ for (int k = 0; k < test3.size(); k++) {
+ test3[k][j][i] = k * 100 + j * 10 + i;
+ }
+ }
+ }
+
+ return 0; // break
+}
Index: gdb-7.2.50.20110218/gdb/testsuite/gdb.python/pr10659.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110218/gdb/testsuite/gdb.python/pr10659.exp 2011-02-18 10:44:32.000000000 +0100
@@ -0,0 +1,82 @@
+#Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set nl "\[\r\n\]+"
+
+set testfile pr10659
+set srcfile ${testfile}.cc
+if [prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}] {
+ return -1
+}
+
+#if { [skip_python_tests] } { continue }
+
+gdb_test "python execfile(\"$srcdir/$subdir/pr10659.py\")" ""
+gdb_test "python gdb.pretty_printers = \[lookup_function\]" ""
+
+if ![runto_main] then {
+ fail "Can't run to main"
+ return
+}
+
+gdb_breakpoint [gdb_get_line_number "break"]
+gdb_continue_to_breakpoint "break"
+
+gdb_test "p test1" "vector of length 2, capacity 2 =.*"
+
+gdb_test "p test2" "= $nl {$nl {.*"
+
+# Complete result is:
+#
+# (gdb) p test2
+# $2 =
+# {
+# {0 1 }
+# {2 3 }
+# {4 5 }
+# }
+
+
+gdb_test "p test3" "= $nl {$nl {$nl {.*"
+
+# Complete result is:
+#
+# (gdb) p test3
+# $3 =
+# {
+# {
+# {0 1 }
+# {10 11 }
+# {20 21 }
+# }
+# {
+# {100 101 }
+# {110 111 }
+# {120 121 }
+# }
+# {
+# {200 201 }
+# {210 211 }
+# {220 221 }
+# }
+# {
+# {300 301 }
+# {310 311 }
+# {320 321 }
+# }
+# }
+#
+
+
Index: gdb-7.2.50.20110218/gdb/testsuite/gdb.python/pr10659.py
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110218/gdb/testsuite/gdb.python/pr10659.py 2011-02-18 10:44:32.000000000 +0100
@@ -0,0 +1,109 @@
+# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import gdb
+import itertools
+import re
+
+vector_sig = 'std::vector'
+vector_regex = re.compile('^' + vector_sig + '<.*>$')
+
+class FakeVectorPrinter:
+ "Print a std::vector"
+
+ class _iterator:
+ def __init__ (self, start, finish):
+ self.item = start
+ self.finish = finish
+ self.count = 0
+
+ def __iter__(self):
+ return self
+
+ def next(self):
+ if self.item == self.finish:
+ raise StopIteration
+ count = self.count
+ self.count = self.count + 1
+ elt = self.item.dereference()
+ self.item = self.item + 1
+ return ('[%d]' % count, elt)
+
+ def __init__(self, typename, val):
+ self.typename = typename
+ self.val = val
+
+ def children(self):
+ return self._iterator(self.val['_M_impl']['_M_start'],
+ self.val['_M_impl']['_M_finish'])
+
+ def to_string(self):
+ start = self.val['_M_impl']['_M_start']
+ finish = self.val['_M_impl']['_M_finish']
+ end = self.val['_M_impl']['_M_end_of_storage']
+ return ('std::vector of length %d, capacity %d'
+ % (int (finish - start), int (end - start)))
+
+ def display_hint(self):
+ itype0 = self.val.type.template_argument(0)
+ itag = itype0.tag
+ if itag and re.match(vector_regex, itag):
+ rc = 'matrix'
+ else:
+ rc = 'array'
+ return rc
+
+def register_libstdcxx_printers (obj):
+ "Register libstdc++ pretty-printers with objfile Obj."
+
+ if obj == None:
+ obj = gdb
+
+ obj.pretty_printers.append (lookup_function)
+
+def lookup_function (val):
+ "Look-up and return a pretty-printer that can print val."
+
+ # Get the type.
+ type = val.type;
+
+ # If it points to a reference, get the reference.
+ if type.code == gdb.TYPE_CODE_REF:
+ type = type.target ()
+
+ # Get the unqualified type, stripped of typedefs.
+ type = type.unqualified ().strip_typedefs ()
+
+ # Get the type name.
+ typename = type.tag
+ if typename == None:
+ return None
+
+ # Iterate over local dictionary of types to determine
+ # if a printer is registered for that type. Return an
+ # instantiation of the printer if found.
+ for function in fake_pretty_printers_dict:
+ if function.search (typename):
+ return fake_pretty_printers_dict[function] (val)
+
+ # Cannot find a pretty printer. Return None.
+ return None
+
+def build_libfakecxx_dictionary ():
+ fake_pretty_printers_dict[vector_regex] = lambda val: FakeVectorPrinter(vector_sig, val)
+
+fake_pretty_printers_dict = {}
+
+build_libfakecxx_dictionary ()
Index: gdb-7.2.50.20110218/gdb/valprint.c
===================================================================
--- gdb-7.2.50.20110218.orig/gdb/valprint.c 2011-02-18 10:44:16.000000000 +0100
+++ gdb-7.2.50.20110218/gdb/valprint.c 2011-02-18 10:44:32.000000000 +0100
@@ -85,7 +85,8 @@ struct value_print_options user_print_op
1, /* static_field_print */
1, /* pascal_static_field_print */
0, /* raw */
- 0 /* summary */
+ 0, /* summary */
+ 0 /* prettyprint_matrix */
};
/* Initialize *OPTS to be a copy of the user print options. */

View File

@ -78,11 +78,11 @@ gdb/testsuite/
* gdb.threads/sigstep-threads.exp: New file.
* gdb.threads/sigstep-threads.c: New file.
Index: gdb-7.4.50.20111218/gdb/linux-nat.c
Index: gdb-7.4.50.20120602/gdb/linux-nat.c
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/linux-nat.c 2011-12-19 01:25:42.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/linux-nat.c 2011-12-19 02:17:05.412607735 +0100
@@ -2843,6 +2843,8 @@ stop_wait_callback (struct lwp_info *lp,
--- gdb-7.4.50.20120602.orig/gdb/linux-nat.c 2012-06-02 21:34:51.999517510 +0200
+++ gdb-7.4.50.20120602/gdb/linux-nat.c 2012-06-02 21:35:59.930491577 +0200
@@ -2856,6 +2856,8 @@ stop_wait_callback (struct lwp_info *lp,
{
int status;
@ -91,7 +91,7 @@ Index: gdb-7.4.50.20111218/gdb/linux-nat.c
status = wait_lwp (lp);
if (status == 0)
return 0;
@@ -2868,110 +2870,61 @@ stop_wait_callback (struct lwp_info *lp,
@@ -2881,110 +2883,61 @@ stop_wait_callback (struct lwp_info *lp,
if (WSTOPSIG (status) != SIGSTOP)
{
@ -228,7 +228,7 @@ Index: gdb-7.4.50.20111218/gdb/linux-nat.c
+
+ registers_changed ();
+ linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
+ 1, TARGET_SIGNAL_0);
+ 1, GDB_SIGNAL_0);
+ if (debug_linux_nat)
+ fprintf_unfiltered (gdb_stdlog,
+ "SWC: %s %s, 0, 0 (discard SIGSTOP)\n",
@ -248,7 +248,7 @@ Index: gdb-7.4.50.20111218/gdb/linux-nat.c
lp->signalled = 0;
}
}
@@ -3627,54 +3580,6 @@ retry:
@@ -3616,54 +3569,6 @@ retry:
lp = NULL;
}
@ -269,7 +269,7 @@ Index: gdb-7.4.50.20111218/gdb/linux-nat.c
- if (linux_nat_prepare_to_resume != NULL)
- linux_nat_prepare_to_resume (lp);
- linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
- lp->step, TARGET_SIGNAL_0);
- lp->step, GDB_SIGNAL_0);
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "LLW: %s %s, 0, 0 (expect SIGSTOP)\n",
@ -303,10 +303,10 @@ Index: gdb-7.4.50.20111218/gdb/linux-nat.c
if (!target_can_async_p ())
{
/* Causes SIGINT to be passed on to the attached process. */
Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/siginfo-threads.c
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/siginfo-threads.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/siginfo-threads.c 2011-12-19 02:16:35.236720272 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/siginfo-threads.c 2012-06-02 21:35:40.268499060 +0200
@@ -0,0 +1,447 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -755,10 +755,10 @@ Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/siginfo-threads.c
+
+ return EXIT_SUCCESS;
+}
Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/siginfo-threads.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/siginfo-threads.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/siginfo-threads.exp 2011-12-19 02:16:35.237720268 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/siginfo-threads.exp 2012-06-02 21:35:40.296499050 +0200
@@ -0,0 +1,94 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
@ -854,10 +854,10 @@ Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/siginfo-threads.exp
+}
+
+gdb_continue_to_breakpoint break-at-exit ".*break-at-exit.*"
Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/sigstep-threads.c
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/sigstep-threads.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/sigstep-threads.c 2011-12-19 02:16:35.237720268 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/sigstep-threads.c 2012-06-02 21:35:40.297499050 +0200
@@ -0,0 +1,54 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -913,10 +913,10 @@ Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/sigstep-threads.c
+ start (NULL); /* main-start */
+ return 0;
+}
Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/sigstep-threads.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/sigstep-threads.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/sigstep-threads.exp 2011-12-19 02:16:35.237720268 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/sigstep-threads.exp 2012-06-02 21:35:40.297499050 +0200
@@ -0,0 +1,74 @@
+# Copyright 2010 Free Software Foundation, Inc.
+

View File

@ -26,19 +26,19 @@ gdb/
(linux_nat_set_siginfo_fixup): Use PTRACE_GETSIGINFO.
* linux-nat.h (struct lwp_info) <siginfo>: Remove.
Index: gdb-7.4.50.20111218/gdb/linux-nat.c
Index: gdb-7.4.50.20120602/gdb/linux-nat.c
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/linux-nat.c 2011-12-19 02:17:05.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/linux-nat.c 2011-12-19 02:17:43.188466854 +0100
@@ -1883,7 +1883,6 @@ resume_lwp (struct lwp_info *lp, int ste
step, TARGET_SIGNAL_0);
--- gdb-7.4.50.20120602.orig/gdb/linux-nat.c 2012-06-02 21:36:21.067483466 +0200
+++ gdb-7.4.50.20120602/gdb/linux-nat.c 2012-06-02 21:37:55.345447402 +0200
@@ -1929,7 +1929,6 @@ resume_lwp (struct lwp_info *lp, int ste
step, GDB_SIGNAL_0);
lp->stopped = 0;
lp->step = step;
- memset (&lp->siginfo, 0, sizeof (lp->siginfo));
lp->stopped_by_watchpoint = 0;
}
else
@@ -2027,7 +2026,6 @@ linux_nat_resume (struct target_ops *ops
@@ -2071,7 +2070,6 @@ linux_nat_resume (struct target_ops *ops
if (linux_nat_prepare_to_resume != NULL)
linux_nat_prepare_to_resume (lp);
linux_ops->to_resume (linux_ops, ptid, step, signo);
@ -46,7 +46,7 @@ Index: gdb-7.4.50.20111218/gdb/linux-nat.c
lp->stopped_by_watchpoint = 0;
if (debug_linux_nat)
@@ -2612,22 +2610,6 @@ wait_lwp (struct lwp_info *lp)
@@ -2625,22 +2623,6 @@ wait_lwp (struct lwp_info *lp)
return status;
}
@ -69,7 +69,7 @@ Index: gdb-7.4.50.20111218/gdb/linux-nat.c
/* Send a SIGSTOP to LP. */
static int
@@ -2872,9 +2854,6 @@ stop_wait_callback (struct lwp_info *lp,
@@ -2885,9 +2867,6 @@ stop_wait_callback (struct lwp_info *lp,
{
/* The thread was stopped with a signal other than SIGSTOP. */
@ -79,7 +79,7 @@ Index: gdb-7.4.50.20111218/gdb/linux-nat.c
save_sigtrap (lp);
if (debug_linux_nat)
@@ -3278,12 +3257,7 @@ linux_nat_filter_event (int lwpid, int s
@@ -3291,12 +3270,7 @@ linux_nat_filter_event (int lwpid, int s
}
if (linux_nat_status_is_event (status))
@ -93,20 +93,20 @@ Index: gdb-7.4.50.20111218/gdb/linux-nat.c
/* Check if the thread has exited. */
if ((WIFEXITED (status) || WIFSIGNALED (status))
@@ -3961,7 +3935,6 @@ resume_stopped_resumed_lwps (struct lwp_
@@ -3950,7 +3924,6 @@ resume_stopped_resumed_lwps (struct lwp_
linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
lp->step, TARGET_SIGNAL_0);
lp->step, GDB_SIGNAL_0);
lp->stopped = 0;
- memset (&lp->siginfo, 0, sizeof (lp->siginfo));
lp->stopped_by_watchpoint = 0;
}
@@ -6029,11 +6002,19 @@ linux_nat_set_prepare_to_resume (struct
struct siginfo *
@@ -5227,11 +5200,19 @@ linux_nat_set_prepare_to_resume (struct
siginfo_t *
linux_nat_get_siginfo (ptid_t ptid)
{
- struct lwp_info *lp = find_lwp_pid (ptid);
+ static struct siginfo siginfo;
+ static siginfo_t siginfo;
+ int pid;
- gdb_assert (lp != NULL);
@ -124,17 +124,17 @@ Index: gdb-7.4.50.20111218/gdb/linux-nat.c
}
/* Provide a prototype to silence -Wmissing-prototypes. */
Index: gdb-7.4.50.20111218/gdb/linux-nat.h
Index: gdb-7.4.50.20120602/gdb/linux-nat.h
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/linux-nat.h 2011-12-18 23:40:59.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/linux-nat.h 2011-12-19 02:17:21.355548276 +0100
@@ -77,10 +77,6 @@ struct lwp_info
--- gdb-7.4.50.20120602.orig/gdb/linux-nat.h 2012-06-02 21:36:21.067483466 +0200
+++ gdb-7.4.50.20120602/gdb/linux-nat.h 2012-06-02 21:36:27.140481144 +0200
@@ -76,10 +76,6 @@ struct lwp_info
/* The kind of stepping of this LWP. */
enum resume_step step;
- /* Non-zero si_signo if this LWP stopped with a trap. si_addr may
- be the address of a hardware watchpoint. */
- struct siginfo siginfo;
- siginfo_t siginfo;
-
/* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
watchpoint trap. */

42
gdb-dejagnu-go.patch Normal file
View File

@ -0,0 +1,42 @@
http://sourceware.org/ml/gdb-patches/2012-06/msg00050.html
Subject: [patch] dejagnu compat. - missing find_go_linker [Re: [patch, doc RFA] Go language support]
On Wed, 25 Apr 2012 04:17:35 +0200, Doug Evans wrote:
> +if {[info procs find_go_linker] == ""} {
> + rename gdb_find_go find_go
> + rename gdb_find_go_linker find_go_linker
> + # No need to set use_gdb_compile.
> +}
Is there a reason for it? With recent Fedora 17 update
https://bugzilla.redhat.com/show_bug.cgi?id=635651
dejagnu has started to support 'find_gfortran'. But it still does not support
'find_go_linker'. This has resulted in regression failing to compile any
gdb.go/*.exp files.
Thanks,
Jan
gdb/testsuite/
2012-06-02 Jan Kratochvil <jan.kratochvil@redhat.com>
* lib/future.exp: Set $use_gdb_compile even if only find_go_linker is
missing.
diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
index 40456c0..bf47988 100644
--- a/gdb/testsuite/lib/future.exp
+++ b/gdb/testsuite/lib/future.exp
@@ -514,7 +514,7 @@ if {[info procs find_gfortran] == ""} {
if {[info procs find_go_linker] == ""} {
rename gdb_find_go find_go
rename gdb_find_go_linker find_go_linker
- # No need to set use_gdb_compile.
+ set use_gdb_compile 1
}
if {$use_gdb_compile} {

View File

@ -1,99 +0,0 @@
[commit] [patch] Fix CU relative vs. absolute offsets [Re: RFC: problem with DW_OP_GNU_deref_type and dwarf's get_base_type callback]
http://sourceware.org/ml/gdb-patches/2012-03/msg00284.html
http://sourceware.org/ml/gdb-cvs/2012-03/msg00134.html
### src/gdb/ChangeLog 2012/03/08 19:08:09 1.13979
### src/gdb/ChangeLog 2012/03/08 19:37:04 1.13980
## -1,5 +1,15 @@
2012-03-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Fix CU relative vs. absolute DIE offsets.
+ * dwarf2loc.h (dwarf2_fetch_die_location_block): Rename parameter
+ offset to offset_in_cu.
+ * dwarf2read.c (process_enumeration_scope): Add CU offset to
+ TYPE_OFFSET.
+ (dwarf2_fetch_die_location_block): Rename parameter offset to
+ offset_in_cu. New variable offset, add CU offset to OFFSET_IN_CU.
+
+2012-03-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+
* libunwind-frame.c: Rename to ...
* ia64-libunwind-tdep.c: ... here.
* libunwind-frame.h: Rename to ...
--- src/gdb/dwarf2loc.h 2012/01/05 21:53:14 1.29
+++ src/gdb/dwarf2loc.h 2012/03/08 19:37:07 1.30
@@ -61,7 +61,7 @@
CORE_ADDR pc);
struct dwarf2_locexpr_baton dwarf2_fetch_die_location_block
- (unsigned int offset, struct dwarf2_per_cu_data *per_cu,
+ (unsigned int offset_in_cu, struct dwarf2_per_cu_data *per_cu,
CORE_ADDR (*get_frame_pc) (void *baton),
void *baton);
--- src/gdb/dwarf2read.c 2012/03/06 23:41:50 1.619
+++ src/gdb/dwarf2read.c 2012/03/08 19:37:07 1.620
@@ -8031,7 +8031,8 @@
= lookup_signatured_type_at_offset (dwarf2_per_objfile->objfile,
cu->per_cu->debug_types_section,
cu->per_cu->offset);
- if (type_sig->type_offset != die->offset)
+ if (type_sig->per_cu.offset + type_sig->type_offset
+ != die->offset)
return;
}
@@ -14202,11 +14203,12 @@
dwarf2_locexpr_baton->data has lifetime of PER_CU->OBJFILE. */
struct dwarf2_locexpr_baton
-dwarf2_fetch_die_location_block (unsigned int offset,
+dwarf2_fetch_die_location_block (unsigned int offset_in_cu,
struct dwarf2_per_cu_data *per_cu,
CORE_ADDR (*get_frame_pc) (void *baton),
void *baton)
{
+ unsigned int offset = per_cu->offset + offset_in_cu;
struct dwarf2_cu *cu;
struct die_info *die;
struct attribute *attr;
### src/gdb/testsuite/ChangeLog 2012/03/08 07:42:50 1.3127
### src/gdb/testsuite/ChangeLog 2012/03/08 19:37:07 1.3128
## -1,5 +1,11 @@
2012-03-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Fix CU relative vs. absolute DIE offsets.
+ * gdb.dwarf2/dw2-op-call.S: New compilation unit preceding the existing
+ one.
+
+2012-03-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+
Fix false FAIL on distros with relro linkage as default.
* gdb.reverse/solib-precsave.exp: Try to compile the test using
-Wl,-z,norelro first.
--- src/gdb/testsuite/gdb.dwarf2/dw2-op-call.S 2012/01/04 08:17:51 1.5
+++ src/gdb/testsuite/gdb.dwarf2/dw2-op-call.S 2012/03/08 19:37:08 1.6
@@ -23,6 +23,23 @@
array3: .2byte 3
.section .debug_info
+.Lcu0_begin:
+ /* CU header */
+ .4byte .Lcu0_end - .Lcu0_start /* Length of Compilation Unit */
+.Lcu0_start:
+ .2byte 2 /* DWARF Version */
+ .4byte .Labbrev1_begin /* Offset into abbrev section */
+ .byte 4 /* Pointer size */
+
+ /* CU die */
+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
+ .ascii "file0.txt\0" /* DW_AT_name */
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
+ .byte 2 /* DW_LANG_C (C) */
+
+ .byte 0 /* End of children of CU */
+.Lcu0_end:
+
.Lcu1_begin:
/* CU header */
.4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */

View File

@ -1,26 +0,0 @@
RFC: problem with DW_OP_GNU_deref_type and dwarf's get_base_type callback
http://sourceware.org/ml/gdb-patches/2012-03/msg00166.html
http://sourceware.org/ml/gdb-cvs/2012-03/msg00118.html
### src/gdb/ChangeLog 2012/03/06 22:48:49 1.13968
### src/gdb/ChangeLog 2012/03/06 23:41:47 1.13969
## -1,3 +1,8 @@
+2012-03-06 Joel Brobecker <brobecker@adacore.com>
+
+ * dwarf2read.c (dwarf2_get_die_type): Pass absolute offset
+ in call to get_die_type_at_offset.
+
2012-03-06 Stan Shebs <stan@codesourcery.com>
* mi/mi-cmd-break.c: Enforce coding standards, fix comments.
--- src/gdb/dwarf2read.c 2012/03/02 01:55:15 1.618
+++ src/gdb/dwarf2read.c 2012/03/06 23:41:50 1.619
@@ -14269,7 +14269,7 @@
struct dwarf2_per_cu_data *per_cu)
{
dw2_setup (per_cu->objfile);
- return get_die_type_at_offset (die_offset, per_cu);
+ return get_die_type_at_offset (per_cu->offset + die_offset, per_cu);
}
/* Follow the signature attribute ATTR in SRC_DIE.

View File

@ -4,10 +4,10 @@ Date: Mon Aug 8 12:08:53 2011 +0200
+testcase
Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c 2011-08-10 18:30:56.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c 2012-06-02 20:03:42.711393776 +0200
@@ -0,0 +1,40 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -49,10 +49,10 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c
+ i = pthread_join (t, NULL);
+ assert (i == 0);
+}
Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/dlopen-libpthread.c
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/dlopen-libpthread.c 2011-08-10 18:30:56.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread.c 2012-06-02 20:03:42.712393775 +0200
@@ -0,0 +1,46 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -100,10 +100,10 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/dlopen-libpthread.c
+
+ return 0;
+}
Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/dlopen-libpthread.exp 2011-08-10 18:30:56.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread.exp 2012-06-02 20:03:42.724393771 +0200
@@ -0,0 +1,74 @@
+# Copyright 2011 Free Software Foundation, Inc.
+#
@ -179,11 +179,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
+gdb_continue_to_breakpoint "notify" ".* notify-here .*"
+
+gdb_test "info sharedlibrary" {/libpthread\.so.*} "libpthread.so found"
Index: gdb-7.3.50.20110722/gdb/testsuite/lib/gdb.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/lib/gdb.exp
===================================================================
--- gdb-7.3.50.20110722.orig/gdb/testsuite/lib/gdb.exp 2011-08-10 18:30:55.000000000 +0200
+++ gdb-7.3.50.20110722/gdb/testsuite/lib/gdb.exp 2011-08-10 18:30:56.000000000 +0200
@@ -3563,30 +3563,49 @@ proc build_executable { testname executa
--- gdb-7.4.50.20120602.orig/gdb/testsuite/lib/gdb.exp 2012-06-02 19:11:56.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/lib/gdb.exp 2012-06-02 20:03:42.727393770 +0200
@@ -3693,30 +3693,49 @@ proc build_executable { testname executa
set sources ${executable}.c
}
@ -250,10 +250,10 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/lib/gdb.exp
return 0
}
Index: gdb-7.3.50.20110722/gdb/testsuite/lib/prelink-support.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/lib/prelink-support.exp
===================================================================
--- gdb-7.3.50.20110722.orig/gdb/testsuite/lib/prelink-support.exp 2011-01-01 16:33:52.000000000 +0100
+++ gdb-7.3.50.20110722/gdb/testsuite/lib/prelink-support.exp 2011-08-10 19:25:41.000000000 +0200
--- gdb-7.4.50.20120602.orig/gdb/testsuite/lib/prelink-support.exp 2012-01-04 09:27:56.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/lib/prelink-support.exp 2012-06-02 20:03:42.733393768 +0200
@@ -95,8 +95,9 @@ proc file_copy {src dest} {
# Wrap function build_executable so that the resulting executable is fully
# self-sufficient (without dependencies on system libraries). Parameter
@ -306,11 +306,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/lib/prelink-support.exp
return $prelink_args
}
Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/break-interp.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.base/break-interp.exp
===================================================================
--- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.base/break-interp.exp 2011-07-01 21:12:12.000000000 +0200
+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.base/break-interp.exp 2011-08-10 18:32:21.000000000 +0200
@@ -108,14 +108,21 @@ proc strip_debug {dest} {
--- gdb-7.4.50.20120602.orig/gdb/testsuite/gdb.base/break-interp.exp 2012-02-24 15:09:08.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.base/break-interp.exp 2012-06-02 20:04:56.135369687 +0200
@@ -109,14 +109,21 @@ proc strip_debug {dest} {
}
}
@ -334,7 +334,7 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/break-interp.exp
gdb_test_no_output "set stop-on-solib-events 1"
} elseif {! [gdb_breakpoint $func allow-pending]} {
return
@@ -141,21 +147,21 @@ proc reach_1 {func command displacement}
@@ -142,21 +149,21 @@ proc reach_1 {func command displacement}
exp_continue
}
-re "Breakpoint \[0-9\]+, \\.?(__GI_)?$func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" {
@ -353,13 +353,13 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/break-interp.exp
pass $test
}
}
-re "Stopped due to shared library event\r\n$gdb_prompt $" {
-re "Stopped due to (spurious )?shared library event.*\r\n$gdb_prompt $" {
- if {$func == "_dl_debug_state"} {
+ if {$func == $solib_bp} {
if {$debug_state_count == 0} {
# First stop does not yet relocate the _start function
# descriptor on ppc64.
@@ -174,7 +180,7 @@ proc reach_1 {func command displacement}
@@ -175,7 +182,7 @@ proc reach_1 {func command displacement}
fail $test_displacement
}
@ -368,7 +368,7 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/break-interp.exp
gdb_test_no_output "set stop-on-solib-events 0"
}
}
@@ -373,7 +379,7 @@ proc test_attach {file displacement {rel
@@ -357,7 +364,7 @@ proc test_attach {file displacement {rel
}
proc test_ld {file ifmain trynosym displacement} {
@ -377,7 +377,7 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/break-interp.exp
# First test normal `file'-command loaded $FILE with symbols.
@@ -401,9 +407,9 @@ proc test_ld {file ifmain trynosym displ
@@ -385,9 +392,9 @@ proc test_ld {file ifmain trynosym displ
gdb_test_no_output "set args ${objdir}/${subdir}/$binfile_test" "set args OBJDIR/${subdir}/$binfile_test"
}
@ -389,7 +389,7 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/break-interp.exp
if $ifmain {
reach "main" continue "NONE"
@@ -415,7 +421,7 @@ proc test_ld {file ifmain trynosym displ
@@ -399,7 +406,7 @@ proc test_ld {file ifmain trynosym displ
# Try re-run if the new PIE displacement takes effect.
gdb_test "kill" "" "kill" {Kill the program being debugged\? \(y or n\) } "y"
@ -398,12 +398,12 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/break-interp.exp
if $ifmain {
test_core $file $displacement
@@ -448,7 +454,7 @@ proc test_ld {file ifmain trynosym displ
gdb_test "exec-file $file" "exec-file $escapedfile" "load"
@@ -431,7 +438,7 @@ proc test_ld {file ifmain trynosym displ
gdb_test "exec-file $file" "exec-file $escapedfile" "load"
if $ifmain {
- reach "_dl_debug_state" run $displacement
+ reach $solib_bp run $displacement
if $ifmain {
- reach "_dl_debug_state" run $displacement
+ reach $solib_bp run $displacement
# Use two separate gdb_test_multiple statements to avoid timeouts due
# to slow processing of wildcard capturing long output
# Use two separate gdb_test_multiple statements to avoid timeouts due
# to slow processing of wildcard capturing long output

View File

@ -2,11 +2,11 @@ From: Gary Benson <gbenson@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Message-ID: <20110810133605.GB7294@redhat.com>
Index: gdb-7.4.50.20120103/gdb/infrun.c
Index: gdb-7.4.50.20120602/gdb/infrun.c
===================================================================
--- gdb-7.4.50.20120103.orig/gdb/infrun.c 2012-01-04 00:26:15.000000000 +0100
+++ gdb-7.4.50.20120103/gdb/infrun.c 2012-01-04 00:26:21.960833391 +0100
@@ -354,6 +354,13 @@ static struct symbol *step_start_functio
--- gdb-7.4.50.20120602.orig/gdb/infrun.c 2012-06-02 21:38:07.236442883 +0200
+++ gdb-7.4.50.20120602/gdb/infrun.c 2012-06-02 21:38:13.450440507 +0200
@@ -361,6 +361,13 @@ static struct symbol *step_start_functio
/* Nonzero if we want to give control to the user when we're notified
of shared library events by the dynamic linker. */
int stop_on_solib_events;
@ -20,7 +20,7 @@ Index: gdb-7.4.50.20120103/gdb/infrun.c
static void
show_stop_on_solib_events (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
@@ -7304,7 +7311,7 @@ Show stopping for shared library events.
@@ -7267,7 +7274,7 @@ Show stopping for shared library events.
If nonzero, gdb will give control to the user when the dynamic linker\n\
notifies gdb of shared library events. The most common event of interest\n\
to the user would be loading/unloading of a new library."),
@ -29,20 +29,20 @@ Index: gdb-7.4.50.20120103/gdb/infrun.c
show_stop_on_solib_events,
&setlist, &showlist);
Index: gdb-7.4.50.20120103/gdb/solib-svr4.c
Index: gdb-7.4.50.20120602/gdb/solib-svr4.c
===================================================================
--- gdb-7.4.50.20120103.orig/gdb/solib-svr4.c 2012-01-04 00:26:15.000000000 +0100
+++ gdb-7.4.50.20120103/gdb/solib-svr4.c 2012-01-04 00:29:56.303014562 +0100
@@ -48,6 +48,8 @@
--- gdb-7.4.50.20120602.orig/gdb/solib-svr4.c 2012-06-02 21:38:07.236442883 +0200
+++ gdb-7.4.50.20120602/gdb/solib-svr4.c 2012-06-02 21:44:23.973298737 +0200
@@ -47,6 +47,8 @@
#include "auxv.h"
#include "exceptions.h"
+#include "stap-probe.h"
+#include "probe.h"
+
static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
static int svr4_have_link_map_offsets (void);
static void svr4_relocate_main_executable (void);
@@ -93,6 +95,32 @@ static const char * const solib_break_na
@@ -92,6 +94,32 @@ static const char * const solib_break_na
NULL
};
@ -75,20 +75,20 @@ Index: gdb-7.4.50.20120103/gdb/solib-svr4.c
static const char * const bkpt_names[] =
{
"_start",
@@ -314,6 +342,12 @@ struct svr4_info
@@ -313,6 +341,12 @@ struct svr4_info
CORE_ADDR interp_text_sect_high;
CORE_ADDR interp_plt_sect_low;
CORE_ADDR interp_plt_sect_high;
+
+ /* SystemTap probes. */
+ VEC (stap_probe_p) *probes[NUM_PROBES];
+ VEC (probe_p) *probes[NUM_PROBES];
+
+ /* Nonzero if we are using the SystemTap interface. */
+ int using_probes;
};
/* Per-program-space data key. */
@@ -323,8 +357,15 @@ static void
@@ -322,8 +356,15 @@ static void
svr4_pspace_data_cleanup (struct program_space *pspace, void *arg)
{
struct svr4_info *info;
@ -99,12 +99,12 @@ Index: gdb-7.4.50.20120103/gdb/solib-svr4.c
+ return;
+
+ for (i = 0; i < NUM_PROBES; i++)
+ VEC_free (stap_probe_p, info->probes[i]);
+ VEC_free (probe_p, info->probes[i]);
+
xfree (info);
}
@@ -1445,6 +1486,126 @@ exec_entry_point (struct bfd *abfd, stru
@@ -1449,6 +1490,126 @@ exec_entry_point (struct bfd *abfd, stru
targ);
}
@ -127,11 +127,11 @@ Index: gdb-7.4.50.20120103/gdb/solib-svr4.c
+ {
+ if (!probe_info[i].mandatory)
+ {
+ struct stap_probe *probe;
+ struct probe *probe;
+ int ix;
+
+ for (ix = 0;
+ VEC_iterate (stap_probe_p, info->probes[i], ix, probe);
+ VEC_iterate (probe_p, info->probes[i], ix, probe);
+ ++ix)
+ {
+ if (loc->pspace == current_program_space
@ -190,13 +190,13 @@ Index: gdb-7.4.50.20120103/gdb/solib-svr4.c
+ info->probes[i] = find_probes_in_objfile (os->objfile, "rtld",
+ probe_info[i].name);
+
+ if (!VEC_length(stap_probe_p, info->probes[i]))
+ if (!VEC_length(probe_p, info->probes[i]))
+ {
+ int j;
+
+ for (j = i - 1; j >= 0; j--)
+ {
+ VEC_free (stap_probe_p, info->probes[j]);
+ VEC_free (probe_p, info->probes[j]);
+ info->probes[j] = NULL;
+ }
+
@ -211,11 +211,11 @@ Index: gdb-7.4.50.20120103/gdb/solib-svr4.c
+
+ for (i = 0; i < NUM_PROBES; i++)
+ {
+ struct stap_probe *probe;
+ struct probe *probe;
+ int ix;
+
+ for (ix = 0;
+ VEC_iterate (stap_probe_p, info->probes[i], ix, probe);
+ VEC_iterate (probe_p, info->probes[i], ix, probe);
+ ++ix)
+ create_solib_event_breakpoint (gdbarch, probe->address);
+ }
@ -231,7 +231,7 @@ Index: gdb-7.4.50.20120103/gdb/solib-svr4.c
/* Helper function for gdb_bfd_lookup_symbol. */
static int
@@ -1493,10 +1654,18 @@ enable_break (struct svr4_info *info, in
@@ -1497,10 +1658,18 @@ enable_break (struct svr4_info *info, in
asection *interp_sect;
gdb_byte *interp_name;
CORE_ADDR sym_addr;
@ -242,7 +242,7 @@ Index: gdb-7.4.50.20120103/gdb/solib-svr4.c
+ for (i = 0; i < NUM_PROBES; i++)
+ {
+ VEC_free (stap_probe_p, info->probes[i]);
+ VEC_free (probe_p, info->probes[i]);
+ info->probes[i] = NULL;
+ }
+ info->using_probes = 0;
@ -250,7 +250,7 @@ Index: gdb-7.4.50.20120103/gdb/solib-svr4.c
/* If we already have a shared library list in the target, and
r_debug contains r_brk, set the breakpoint there - this should
mean r_brk has already been relocated. Assume the dynamic linker
@@ -1528,7 +1697,7 @@ enable_break (struct svr4_info *info, in
@@ -1532,7 +1701,7 @@ enable_break (struct svr4_info *info, in
That knowledge is encoded in the address, if it's Thumb the low bit
is 1. However, we've stripped that info above and it's not clear
what all the consequences are of passing a non-addr_bits_remove'd
@ -259,7 +259,7 @@ Index: gdb-7.4.50.20120103/gdb/solib-svr4.c
find_pc_section verifies we know about the address and have some
hope of computing the right kind of breakpoint to use (via
symbol info). It does mean that GDB needs to be pointed at a
@@ -1566,7 +1735,7 @@ enable_break (struct svr4_info *info, in
@@ -1570,7 +1739,7 @@ enable_break (struct svr4_info *info, in
+ bfd_section_size (tmp_bfd, interp_sect);
}
@ -268,7 +268,7 @@ Index: gdb-7.4.50.20120103/gdb/solib-svr4.c
return 1;
}
}
@@ -1721,7 +1890,8 @@ enable_break (struct svr4_info *info, in
@@ -1725,7 +1894,8 @@ enable_break (struct svr4_info *info, in
if (sym_addr != 0)
{
@ -278,7 +278,7 @@ Index: gdb-7.4.50.20120103/gdb/solib-svr4.c
xfree (interp_name);
return 1;
}
@@ -1747,7 +1917,7 @@ enable_break (struct svr4_info *info, in
@@ -1751,7 +1921,7 @@ enable_break (struct svr4_info *info, in
sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch,
sym_addr,
&current_target);
@ -287,7 +287,7 @@ Index: gdb-7.4.50.20120103/gdb/solib-svr4.c
return 1;
}
}
@@ -1763,7 +1933,7 @@ enable_break (struct svr4_info *info, in
@@ -1767,7 +1937,7 @@ enable_break (struct svr4_info *info, in
sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch,
sym_addr,
&current_target);
@ -296,17 +296,17 @@ Index: gdb-7.4.50.20120103/gdb/solib-svr4.c
return 1;
}
}
@@ -2539,4 +2709,5 @@ _initialize_svr4_solib (void)
@@ -2543,4 +2713,5 @@ _initialize_svr4_solib (void)
svr4_so_ops.lookup_lib_global_symbol = elf_lookup_lib_symbol;
svr4_so_ops.same = svr4_same;
svr4_so_ops.keep_data_in_core = svr4_keep_data_in_core;
+ svr4_so_ops.update_breakpoints = svr4_update_solib_event_breakpoints;
}
Index: gdb-7.4.50.20120103/gdb/solib.c
Index: gdb-7.4.50.20120602/gdb/solib.c
===================================================================
--- gdb-7.4.50.20120103.orig/gdb/solib.c 2012-01-04 00:26:15.000000000 +0100
+++ gdb-7.4.50.20120103/gdb/solib.c 2012-01-04 00:29:07.751200038 +0100
@@ -1214,6 +1214,18 @@ no_shared_libraries (char *ignored, int
--- gdb-7.4.50.20120602.orig/gdb/solib.c 2012-06-02 21:38:07.236442883 +0200
+++ gdb-7.4.50.20120602/gdb/solib.c 2012-06-02 21:38:13.455440507 +0200
@@ -1216,6 +1216,18 @@ no_shared_libraries (char *ignored, int
objfile_purge_solibs ();
}
@ -325,23 +325,23 @@ Index: gdb-7.4.50.20120103/gdb/solib.c
/* Reload shared libraries, but avoid reloading the same symbol file
we already have loaded. */
Index: gdb-7.4.50.20120103/gdb/solib.h
Index: gdb-7.4.50.20120602/gdb/solib.h
===================================================================
--- gdb-7.4.50.20120103.orig/gdb/solib.h 2011-08-30 04:48:05.000000000 +0200
+++ gdb-7.4.50.20120103/gdb/solib.h 2012-01-04 00:27:40.415533686 +0100
@@ -91,4 +91,8 @@ extern CORE_ADDR bfd_lookup_symbol_from_
void *),
void *data);
--- gdb-7.4.50.20120602.orig/gdb/solib.h 2012-06-02 21:38:07.236442883 +0200
+++ gdb-7.4.50.20120602/gdb/solib.h 2012-06-02 21:38:13.464440503 +0200
@@ -91,4 +91,8 @@ extern CORE_ADDR gdb_bfd_lookup_symbol_f
void *),
void *data);
+/* Enable or disable optional solib event breakpoints as appropriate. */
+
+extern void update_solib_breakpoints (void);
+
#endif /* SOLIB_H */
Index: gdb-7.4.50.20120103/gdb/solist.h
Index: gdb-7.4.50.20120602/gdb/solist.h
===================================================================
--- gdb-7.4.50.20120103.orig/gdb/solist.h 2011-08-09 14:51:47.000000000 +0200
+++ gdb-7.4.50.20120103/gdb/solist.h 2012-01-04 00:26:21.962833383 +0100
--- gdb-7.4.50.20120602.orig/gdb/solist.h 2012-06-02 21:38:07.236442883 +0200
+++ gdb-7.4.50.20120602/gdb/solist.h 2012-06-02 21:38:13.465440503 +0200
@@ -149,6 +149,13 @@ struct target_so_ops
core file (in particular, for readonly sections). */
int (*keep_data_in_core) (CORE_ADDR vaddr,

View File

@ -1,93 +0,0 @@
http://sourceware.org/ml/gdb-patches/2012-02/msg00664.html
Subject: RFA: fix PR breakpoints/13776
I'd appreciate comments on this patch.
I have no idea whether it is the best way to fix the problem.
Bug 13776 concerns 'next'ing over an exit. For the trivial:
#include <stdlib.h>
int
main (void)
{
exit (0);
}
We get this behavior:
(gdb) start
Temporary breakpoint 1, main () at exit0.c:5
5 exit (0);
(gdb) next
[Inferior 1 (process 2428) exited normally]
warning: Error removing breakpoint 0
warning: Error removing breakpoint 0
warning: Error removing breakpoint 0
The bug is that exit_inferior ends up calling delete_longjmp_breakpoint,
which tries to delete the longjmp breakpoints -- but as the inferior is
dead, this fails.
This patch fixes this problem by moving the breakpoint_init_inferior
call earlier in generic_mourn_inferior. This causes the breakpoints to
be marked as uninserted before they are deleted.
While doing this I noticed that after the inferior exits, we are left
with a step-resume breakpoint:
(gdb) maint info b
Num Type Disp Enb Address What
[...]
0 step resume dstp y 0x00000000004004d2 inf 1 thread 1
stop only in thread 1
The breakpoint.c patch causes this to be removed as well.
Built and regtested on x86-64 Fedora 16.
Tom
2012-02-28 Tom Tromey <tromey@redhat.com>
PR breakpoints/13776:
* target.c (generic_mourn_inferior): Call breakpoint_init_inferior
earlier.
* breakpoint.c (breakpoint_init_inferior): Delete step-resume
breakpoints.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index db05b97..048cc63 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3341,6 +3341,10 @@ breakpoint_init_inferior (enum inf_context context)
(gdb) tar rem :9999 # remote Windows gdbserver.
*/
+ case bp_step_resume:
+
+ /* Also remove step-resume breakpoints. */
+
delete_breakpoint (b);
break;
diff --git a/gdb/target.c b/gdb/target.c
index 1f408f6..65a6c23 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -3583,13 +3583,14 @@ generic_mourn_inferior (void)
ptid = inferior_ptid;
inferior_ptid = null_ptid;
+ breakpoint_init_inferior (inf_exited);
+
if (!ptid_equal (ptid, null_ptid))
{
int pid = ptid_get_pid (ptid);
exit_inferior (pid);
}
- breakpoint_init_inferior (inf_exited);
registers_changed ();
reopen_exec_file ();

View File

@ -1,46 +0,0 @@
https://bugzilla.redhat.com/show_bug.cgi?id=787487
http://sourceware.org/ml/gdb-patches/2012-02/msg00112.html
Subject: RFC: extend symtabs_from_filename skipping for C++
I'd appreciate comments on this. Barring comments I will check it in
after a couple days.
A while ago Doug committed a patch to change linespec to skip
symtabs_from_filename when possible. This was an important performance
improvement.
We got a bug report in Red Hat bugzilla asking that this be extended to
C++ qualified names:
https://bugzilla.redhat.com/show_bug.cgi?id=787487
This patch implements this idea.
Built and regtested on x86-64 Fedora 15.
Tom
2012-02-08 Tom Tromey <tromey@redhat.com>
* linespec.c (decode_line_internal): Skip symtabs_from_filename
when we have a C++ qualified name.
diff --git a/gdb/linespec.c b/gdb/linespec.c
index da88d17..3f53b8e 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -912,9 +912,11 @@ decode_line_internal (struct linespec_state *self, char **argptr)
/* First things first: if ARGPTR starts with a filename, get its
symtab and strip the filename from ARGPTR.
Avoid calling symtab_from_filename if we know can,
- it can be expensive. */
+ it can be expensive. We know we can avoid the call if we see a
+ single word (e.g., "break NAME") or if we see a qualified C++
+ name ("break QUAL::NAME"). */
- if (*p != '\0')
+ if (*p != '\0' && p[1] != ':')
{
TRY_CATCH (file_exception, RETURN_MASK_ERROR)
{

View File

@ -1,8 +1,8 @@
Index: gdb-7.2.50.20110117/gdb/f-lang.c
Index: gdb-7.4.50.20120602/gdb/f-lang.c
===================================================================
--- gdb-7.2.50.20110117.orig/gdb/f-lang.c 2011-01-07 20:36:16.000000000 +0100
+++ gdb-7.2.50.20110117/gdb/f-lang.c 2011-01-17 15:56:07.000000000 +0100
@@ -57,20 +57,6 @@ typedef struct saved_bf_symnum SAVED_BF,
--- gdb-7.4.50.20120602.orig/gdb/f-lang.c 2012-03-02 20:29:00.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/f-lang.c 2012-06-02 19:13:31.520050654 +0200
@@ -59,20 +59,6 @@ typedef struct saved_bf_symnum SAVED_BF,
/* Local functions */
extern void _initialize_f_language (void);
@ -23,7 +23,7 @@ Index: gdb-7.2.50.20110117/gdb/f-lang.c
static void f_printchar (int c, struct type *type, struct ui_file * stream);
static void f_emit_char (int c, struct type *type,
@@ -461,185 +447,7 @@ _initialize_f_language (void)
@@ -385,185 +371,7 @@ _initialize_f_language (void)
add_language (&f_language_defn);
}
@ -209,7 +209,7 @@ Index: gdb-7.2.50.20110117/gdb/f-lang.c
/* This routine finds the first encountred COMMON block named "name"
that belongs to function funcname. */
@@ -662,193 +470,3 @@ find_common_for_function (char *name, ch
@@ -586,193 +394,3 @@ find_common_for_function (const char *na
}
return (NULL);
}
@ -403,18 +403,19 @@ Index: gdb-7.2.50.20110117/gdb/f-lang.c
- saved_function_list = NULL;
-}
-#endif
Index: gdb-7.2.50.20110117/gdb/f-lang.h
Index: gdb-7.4.50.20120602/gdb/f-lang.h
===================================================================
--- gdb-7.2.50.20110117.orig/gdb/f-lang.h 2011-01-17 15:47:37.000000000 +0100
+++ gdb-7.2.50.20110117/gdb/f-lang.h 2011-01-17 15:54:14.000000000 +0100
@@ -76,14 +76,9 @@ typedef struct saved_f77_common SAVED_F7
--- gdb-7.4.50.20120602.orig/gdb/f-lang.h 2012-06-02 19:11:54.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/f-lang.h 2012-06-02 19:13:55.345317970 +0200
@@ -76,15 +76,10 @@ typedef struct saved_f77_common SAVED_F7
typedef struct common_entry COMMON_ENTRY, *COMMON_ENTRY_PTR;
extern SAVED_F77_COMMON_PTR head_common_list; /* Ptr to 1st saved COMMON */
-extern SAVED_F77_COMMON_PTR tail_common_list; /* Ptr to last saved COMMON */
-extern SAVED_F77_COMMON_PTR current_common; /* Ptr to current COMMON */
extern SAVED_F77_COMMON_PTR find_common_for_function (char *, char *);
extern SAVED_F77_COMMON_PTR find_common_for_function (const char *,
const char *);
-#define UNINITIALIZED_SECNUM -1
-#define COMMON_NEEDS_PATCHING(blk) ((blk)->secnum == UNINITIALIZED_SECNUM)
@ -422,10 +423,10 @@ Index: gdb-7.2.50.20110117/gdb/f-lang.h
#define BLANK_COMMON_NAME_ORIGINAL "#BLNK_COM" /* XLF assigned */
#define BLANK_COMMON_NAME_MF77 "__BLNK__" /* MF77 assigned */
#define BLANK_COMMON_NAME_LOCAL "__BLANK" /* Local GDB */
Index: gdb-7.2.50.20110117/gdb/f-valprint.c
Index: gdb-7.4.50.20120602/gdb/f-valprint.c
===================================================================
--- gdb-7.2.50.20110117.orig/gdb/f-valprint.c 2011-01-17 15:47:37.000000000 +0100
+++ gdb-7.2.50.20110117/gdb/f-valprint.c 2011-01-17 15:54:36.000000000 +0100
--- gdb-7.4.50.20120602.orig/gdb/f-valprint.c 2012-06-02 19:11:54.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/f-valprint.c 2012-06-02 19:14:11.625313432 +0200
@@ -35,10 +35,6 @@
#include "command.h"
#include "block.h"
@ -436,8 +437,8 @@ Index: gdb-7.2.50.20110117/gdb/f-valprint.c
-
extern void _initialize_f_valprint (void);
static void info_common_command (char *, int);
static void list_all_visible_commons (char *);
@@ -604,67 +600,6 @@ info_common_command (char *comname, int
static void list_all_visible_commons (const char *);
@@ -535,67 +531,6 @@ info_common_command (char *comname, int
comname, funname);
}

View File

@ -1,8 +1,8 @@
Index: gdb-7.3.50.20110722/gdb/dwarf2read.c
Index: gdb-7.4.50.20120602/gdb/dwarf2read.c
===================================================================
--- gdb-7.3.50.20110722.orig/gdb/dwarf2read.c 2011-07-22 20:12:05.000000000 +0200
+++ gdb-7.3.50.20110722/gdb/dwarf2read.c 2011-07-22 20:17:22.000000000 +0200
@@ -7969,12 +7969,14 @@ read_set_type (struct die_info *die, str
--- gdb-7.4.50.20120602.orig/gdb/dwarf2read.c 2012-06-02 21:32:41.746567299 +0200
+++ gdb-7.4.50.20120602/gdb/dwarf2read.c 2012-06-02 21:32:54.304562500 +0200
@@ -9736,12 +9736,14 @@ read_set_type (struct die_info *die, str
return set_die_type (die, set_type, cu);
}
@ -19,7 +19,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c
struct attribute *attr;
struct symbol *sym;
CORE_ADDR base = (CORE_ADDR) 0;
@@ -7999,20 +8001,67 @@ read_common_block (struct die_info *die,
@@ -9766,20 +9768,67 @@ read_common_block (struct die_info *die,
}
if (die->child != NULL)
{
@ -87,7 +87,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c
}
}
@@ -11695,6 +11744,13 @@ new_symbol_full (struct die_info *die, s
@@ -13661,6 +13710,13 @@ new_symbol_full (struct die_info *die, s
{
var_decode_location (attr, sym, cu);
attr2 = dwarf2_attr (die, DW_AT_external, cu);
@ -101,7 +101,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c
if (SYMBOL_CLASS (sym) == LOC_STATIC
&& SYMBOL_VALUE_ADDRESS (sym) == 0
&& !dwarf2_per_objfile->has_section_at_zero)
@@ -11867,6 +11923,11 @@ new_symbol_full (struct die_info *die, s
@@ -13825,6 +13881,11 @@ new_symbol_full (struct die_info *die, s
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
list_to_add = &global_symbols;
break;
@ -113,11 +113,11 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c
default:
/* Not a tag we recognize. Hopefully we aren't processing
trash data, but since we must specifically ignore things
Index: gdb-7.3.50.20110722/gdb/f-lang.c
Index: gdb-7.4.50.20120602/gdb/f-lang.c
===================================================================
--- gdb-7.3.50.20110722.orig/gdb/f-lang.c 2011-07-22 20:17:16.000000000 +0200
+++ gdb-7.3.50.20110722/gdb/f-lang.c 2011-07-22 20:17:22.000000000 +0200
@@ -371,27 +371,3 @@ _initialize_f_language (void)
--- gdb-7.4.50.20120602.orig/gdb/f-lang.c 2012-06-02 21:32:41.746567299 +0200
+++ gdb-7.4.50.20120602/gdb/f-lang.c 2012-06-02 21:32:54.305562499 +0200
@@ -370,27 +370,3 @@ _initialize_f_language (void)
add_language (&f_language_defn);
}
@ -128,7 +128,7 @@ Index: gdb-7.3.50.20110722/gdb/f-lang.c
- that belongs to function funcname. */
-
-SAVED_F77_COMMON_PTR
-find_common_for_function (char *name, char *funcname)
-find_common_for_function (const char *name, const char *funcname)
-{
-
- SAVED_F77_COMMON_PTR tmp;
@ -145,11 +145,11 @@ Index: gdb-7.3.50.20110722/gdb/f-lang.c
- }
- return (NULL);
-}
Index: gdb-7.3.50.20110722/gdb/f-lang.h
Index: gdb-7.4.50.20120602/gdb/f-lang.h
===================================================================
--- gdb-7.3.50.20110722.orig/gdb/f-lang.h 2011-07-22 20:17:16.000000000 +0200
+++ gdb-7.3.50.20110722/gdb/f-lang.h 2011-07-22 20:17:22.000000000 +0200
@@ -52,36 +52,8 @@ enum f90_range_type
--- gdb-7.4.50.20120602.orig/gdb/f-lang.h 2012-06-02 21:32:41.746567299 +0200
+++ gdb-7.4.50.20120602/gdb/f-lang.h 2012-06-02 21:32:54.322562493 +0200
@@ -52,37 +52,8 @@ enum f90_range_type
NONE_BOUND_DEFAULT /* "(low:high)" */
};
@ -178,7 +178,8 @@ Index: gdb-7.3.50.20110722/gdb/f-lang.h
-
-extern SAVED_F77_COMMON_PTR head_common_list; /* Ptr to 1st saved COMMON */
-
-extern SAVED_F77_COMMON_PTR find_common_for_function (char *, char *);
-extern SAVED_F77_COMMON_PTR find_common_for_function (const char *,
- const char *);
-
#define BLANK_COMMON_NAME_ORIGINAL "#BLNK_COM" /* XLF assigned */
#define BLANK_COMMON_NAME_MF77 "__BLNK__" /* MF77 assigned */
@ -186,10 +187,10 @@ Index: gdb-7.3.50.20110722/gdb/f-lang.h
/* When reasonable array bounds cannot be fetched, such as when
you ask to 'mt print symbols' and there is no stack frame and
Index: gdb-7.3.50.20110722/gdb/f-valprint.c
Index: gdb-7.4.50.20120602/gdb/f-valprint.c
===================================================================
--- gdb-7.3.50.20110722.orig/gdb/f-valprint.c 2011-07-22 20:17:16.000000000 +0200
+++ gdb-7.3.50.20110722/gdb/f-valprint.c 2011-07-22 20:18:26.000000000 +0200
--- gdb-7.4.50.20120602.orig/gdb/f-valprint.c 2012-06-02 21:32:41.746567299 +0200
+++ gdb-7.4.50.20120602/gdb/f-valprint.c 2012-06-02 21:33:50.514541286 +0200
@@ -34,10 +34,11 @@
#include "gdbcore.h"
#include "command.h"
@ -199,16 +200,16 @@ Index: gdb-7.3.50.20110722/gdb/f-valprint.c
extern void _initialize_f_valprint (void);
static void info_common_command (char *, int);
-static void list_all_visible_commons (char *);
-static void list_all_visible_commons (const char *);
static void f77_create_arrayprint_offset_tbl (struct type *,
struct ui_file *);
static void f77_get_dynamic_length_of_aggregate (struct type *);
@@ -515,22 +516,54 @@ f_val_print (struct type *type, const gd
return 0;
@@ -420,22 +421,54 @@ f_val_print (struct type *type, const gd
gdb_flush (stream);
}
-static void
-list_all_visible_commons (char *funname)
-list_all_visible_commons (const char *funname)
+static int
+info_common_command_for_block (struct block *block, struct frame_info *frame,
+ const char *comname)
@ -216,7 +217,7 @@ Index: gdb-7.3.50.20110722/gdb/f-valprint.c
- SAVED_F77_COMMON_PTR tmp;
-
- tmp = head_common_list;
+ struct dict_iterator iter;
+ struct block_iterator iter;
+ struct symbol *sym;
+ int values_printed = 0;
+ const char *name;
@ -271,21 +272,21 @@ Index: gdb-7.3.50.20110722/gdb/f-valprint.c
}
/* This function is used to print out the values in a given COMMON
@@ -540,11 +573,9 @@ list_all_visible_commons (char *funname)
@@ -445,11 +478,9 @@ list_all_visible_commons (const char *fu
static void
info_common_command (char *comname, int from_tty)
{
- SAVED_F77_COMMON_PTR the_common;
- COMMON_ENTRY_PTR entry;
struct frame_info *fi;
- char *funname = 0;
- const char *funname = 0;
- struct symbol *func;
+ struct block *block;
+ int values_printed = 0;
/* We have been told to display the contents of F77 COMMON
block supposedly visible in this function. Let us
@@ -556,74 +587,31 @@ info_common_command (char *comname, int
@@ -461,74 +492,31 @@ info_common_command (char *comname, int
/* The following is generally ripped off from stack.c's routine
print_frame_info(). */
@ -376,11 +377,11 @@ Index: gdb-7.3.50.20110722/gdb/f-valprint.c
}
void
Index: gdb-7.3.50.20110722/gdb/stack.c
Index: gdb-7.4.50.20120602/gdb/stack.c
===================================================================
--- gdb-7.3.50.20110722.orig/gdb/stack.c 2011-07-22 20:12:05.000000000 +0200
+++ gdb-7.3.50.20110722/gdb/stack.c 2011-07-22 20:17:22.000000000 +0200
@@ -1524,6 +1524,8 @@ iterate_over_block_locals (struct block
--- gdb-7.4.50.20120602.orig/gdb/stack.c 2012-06-02 21:32:41.746567299 +0200
+++ gdb-7.4.50.20120602/gdb/stack.c 2012-06-02 21:32:54.335562488 +0200
@@ -1838,6 +1838,8 @@ iterate_over_block_locals (struct block
case LOC_COMPUTED:
if (SYMBOL_IS_ARGUMENT (sym))
break;
@ -389,11 +390,11 @@ Index: gdb-7.3.50.20110722/gdb/stack.c
(*cb) (SYMBOL_PRINT_NAME (sym), sym, cb_data);
break;
Index: gdb-7.3.50.20110722/gdb/symtab.h
Index: gdb-7.4.50.20120602/gdb/symtab.h
===================================================================
--- gdb-7.3.50.20110722.orig/gdb/symtab.h 2011-07-22 20:12:05.000000000 +0200
+++ gdb-7.3.50.20110722/gdb/symtab.h 2011-07-22 20:18:58.000000000 +0200
@@ -396,7 +396,10 @@ typedef enum domain_enum_tag
--- gdb-7.4.50.20120602.orig/gdb/symtab.h 2012-06-02 21:32:41.746567299 +0200
+++ gdb-7.4.50.20120602/gdb/symtab.h 2012-06-02 21:32:54.342562486 +0200
@@ -389,7 +389,10 @@ typedef enum domain_enum_tag
/* LABEL_DOMAIN may be used for names of labels (for gotos). */
@ -405,10 +406,10 @@ Index: gdb-7.3.50.20110722/gdb/symtab.h
} domain_enum;
/* Searching domains, used for `search_symbols'. Element numbers are
Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/common-block.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.fortran/common-block.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/common-block.exp 2011-07-22 20:17:22.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.fortran/common-block.exp 2012-06-02 21:32:54.344562484 +0200
@@ -0,0 +1,101 @@
+# Copyright 2008 Free Software Foundation, Inc.
+
@ -511,10 +512,10 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/common-block.exp
+gdb_test "p ix_x" " = 1 *" "p ix_x in"
+gdb_test "p iy_y" " = 2 *" "p iy_y in"
+gdb_test "p iz_z2" " = 3 *" "p iz_z2 in"
Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/common-block.f90
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.fortran/common-block.f90
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/common-block.f90 2011-07-22 20:17:22.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.fortran/common-block.f90 2012-06-02 21:32:54.345562483 +0200
@@ -0,0 +1,67 @@
+! Copyright 2008 Free Software Foundation, Inc.
+!

215
gdb-objfile-order.patch Normal file
View File

@ -0,0 +1,215 @@
http://sourceware.org/ml/gdb-patches/2012-05/msg01105.html
Subject: [RFA/commit 1/3] Revert "Search global symbols from the expression's block objfile first."
The search order used in this patch breaks global symbol lookups
for certain symbols when copy-relocation is used. A slightly different
search order will be implemented later.
gdb/ChangeLog:
Revert the following patch:
* findvar.c (default_read_var_value): For LOC_UNRESOLVED symbols,
try locating the symbol in the symbol's own objfile first, before
extending the search to all objfiles.
* symtab.c (lookup_symbol_aux_objfile): New function, extracted
out of lookup_symbol_aux_symtabs.
(lookup_symbol_aux_symtabs): Add new parameter "exclude_objfile".
Replace extracted-out code by call to lookup_symbol_aux_objfile.
Do not search EXCLUDE_OBJFILE.
(lookup_static_symbol_aux): Update call to lookup_symbol_aux_symtabs.
(lookup_symbol_global): Search for matches in the block's objfile
first, before searching all other objfiles.
Will commit if patches #2 & #3 are OK.
---
gdb/findvar.c | 10 +-----
gdb/symtab.c | 108 +++++++++++++++++----------------------------------------
2 files changed, 33 insertions(+), 85 deletions(-)
diff --git a/gdb/findvar.c b/gdb/findvar.c
index ed7903c..9009e6f 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -562,15 +562,7 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
struct minimal_symbol *msym;
struct obj_section *obj_section;
- /* First, try locating the associated minimal symbol within
- the same objfile. This prevents us from selecting another
- symbol with the same name but located in a different objfile. */
- msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (var), NULL,
- SYMBOL_SYMTAB (var)->objfile);
- /* If the lookup failed, try expanding the search to all
- objfiles. */
- if (msym == NULL)
- msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (var), NULL, NULL);
+ msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (var), NULL, NULL);
if (msym == NULL)
error (_("No global symbol \"%s\"."), SYMBOL_LINKAGE_NAME (var));
if (overlay_debugging)
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 85ddd1d..39d8c6f 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -95,8 +95,7 @@ struct symbol *lookup_symbol_aux_local (const char *name,
static
struct symbol *lookup_symbol_aux_symtabs (int block_index,
const char *name,
- const domain_enum domain,
- struct objfile *exclude_objfile);
+ const domain_enum domain);
static
struct symbol *lookup_symbol_aux_quick (struct objfile *objfile,
@@ -1360,7 +1359,7 @@ lookup_static_symbol_aux (const char *name, const domain_enum domain)
struct objfile *objfile;
struct symbol *sym;
- sym = lookup_symbol_aux_symtabs (STATIC_BLOCK, name, domain, NULL);
+ sym = lookup_symbol_aux_symtabs (STATIC_BLOCK, name, domain);
if (sym != NULL)
return sym;
@@ -1499,61 +1498,40 @@ lookup_global_symbol_from_objfile (const struct objfile *main_objfile,
return NULL;
}
-/* Check to see if the symbol is defined in one of the OBJFILE's
- symtabs. BLOCK_INDEX should be either GLOBAL_BLOCK or STATIC_BLOCK,
+/* Check to see if the symbol is defined in one of the symtabs.
+ BLOCK_INDEX should be either GLOBAL_BLOCK or STATIC_BLOCK,
depending on whether or not we want to search global symbols or
static symbols. */
static struct symbol *
-lookup_symbol_aux_objfile (struct objfile *objfile, int block_index,
- const char *name, const domain_enum domain)
-{
- struct symbol *sym = NULL;
- struct blockvector *bv;
- const struct block *block;
- struct symtab *s;
-
- if (objfile->sf)
- objfile->sf->qf->pre_expand_symtabs_matching (objfile, block_index,
- name, domain);
-
- ALL_OBJFILE_SYMTABS (objfile, s)
- if (s->primary)
- {
- bv = BLOCKVECTOR (s);
- block = BLOCKVECTOR_BLOCK (bv, block_index);
- sym = lookup_block_symbol (block, name, domain);
- if (sym)
- {
- block_found = block;
- return fixup_symbol_section (sym, objfile);
- }
- }
-
- return NULL;
-}
-
-/* Same as lookup_symbol_aux_objfile, except that it searches all
- objfiles except for EXCLUDE_OBJFILE. Return the first match found.
-
- If EXCLUDE_OBJFILE is NULL, then all objfiles are searched. */
-
-static struct symbol *
lookup_symbol_aux_symtabs (int block_index, const char *name,
- const domain_enum domain,
- struct objfile *exclude_objfile)
+ const domain_enum domain)
{
struct symbol *sym;
struct objfile *objfile;
+ struct blockvector *bv;
+ const struct block *block;
+ struct symtab *s;
ALL_OBJFILES (objfile)
{
- if (objfile != exclude_objfile)
- {
- sym = lookup_symbol_aux_objfile (objfile, block_index, name, domain);
- if (sym)
- return sym;
- }
+ if (objfile->sf)
+ objfile->sf->qf->pre_expand_symtabs_matching (objfile,
+ block_index,
+ name, domain);
+
+ ALL_OBJFILE_SYMTABS (objfile, s)
+ if (s->primary)
+ {
+ bv = BLOCKVECTOR (s);
+ block = BLOCKVECTOR_BLOCK (bv, block_index);
+ sym = lookup_block_symbol (block, name, domain);
+ if (sym)
+ {
+ block_found = block;
+ return fixup_symbol_section (sym, objfile);
+ }
+ }
}
return NULL;
@@ -1679,46 +1657,24 @@ lookup_symbol_global (const char *name,
const domain_enum domain)
{
struct symbol *sym = NULL;
- struct objfile *block_objfile = NULL;
struct objfile *objfile = NULL;
/* Call library-specific lookup procedure. */
- block_objfile = lookup_objfile_from_block (block);
- if (block_objfile != NULL)
- sym = solib_global_lookup (block_objfile, name, domain);
+ objfile = lookup_objfile_from_block (block);
+ if (objfile != NULL)
+ sym = solib_global_lookup (objfile, name, domain);
if (sym != NULL)
return sym;
- /* If BLOCK_OBJFILE is not NULL, then search this objfile first.
- In case the global symbol is defined in multiple objfiles,
- we have a better chance of finding the most relevant symbol. */
-
- if (block_objfile != NULL)
- {
- sym = lookup_symbol_aux_objfile (block_objfile, GLOBAL_BLOCK,
- name, domain);
- if (sym == NULL)
- sym = lookup_symbol_aux_quick (block_objfile, GLOBAL_BLOCK,
- name, domain);
- if (sym != NULL)
- return sym;
- }
-
- /* Symbol not found in the BLOCK_OBJFILE, so try all the other
- objfiles, starting with symtabs first, and then partial symtabs. */
-
- sym = lookup_symbol_aux_symtabs (GLOBAL_BLOCK, name, domain, block_objfile);
+ sym = lookup_symbol_aux_symtabs (GLOBAL_BLOCK, name, domain);
if (sym != NULL)
return sym;
ALL_OBJFILES (objfile)
{
- if (objfile != block_objfile)
- {
- sym = lookup_symbol_aux_quick (objfile, GLOBAL_BLOCK, name, domain);
- if (sym)
- return sym;
- }
+ sym = lookup_symbol_aux_quick (objfile, GLOBAL_BLOCK, name, domain);
+ if (sym)
+ return sym;
}
return NULL;
--
1.7.1

View File

@ -1,50 +0,0 @@
https://bugzilla.redhat.com/show_bug.cgi?id=827600
Re: [PATCH] disable ptrace BookE interface for PowerPC server processors
http://sourceware.org/ml/gdb-patches/2012-05/msg01107.html
http://sourceware.org/ml/gdb-cvs/2012-05/msg00221.html
### src/gdb/ChangeLog 2012/05/31 18:44:47 1.14306
### src/gdb/ChangeLog 2012/05/31 22:07:29 1.14307
## -1,3 +1,9 @@
+2012-05-31 Edjunior Machado <emachado@linux.vnet.ibm.com>
+
+ * ppc-linux-nat.c (have_ptrace_booke_interface): Disable ptrace
+ BookE interface for PowerPC server processors if not available
+ in the Linux Kernel.
+
2012-05-31 Keith Seitz <keiths@redhat.com>
* linespec.c (decode_objc): Add cleanup to free
--- src/gdb/ppc-linux-nat.c 2012/05/30 13:37:17 1.112
+++ src/gdb/ppc-linux-nat.c 2012/05/31 22:07:31 1.113
@@ -1421,17 +1421,20 @@
/* Check for kernel support for BOOKE debug registers. */
if (ptrace (PPC_PTRACE_GETHWDBGINFO, tid, 0, &booke_debug_info) >= 0)
{
- have_ptrace_booke_interface = 1;
- max_slots_number = booke_debug_info.num_instruction_bps
- + booke_debug_info.num_data_bps
- + booke_debug_info.num_condition_regs;
- }
- else
- {
- /* Old school interface and no BOOKE debug registers support. */
- have_ptrace_booke_interface = 0;
- memset (&booke_debug_info, 0, sizeof (struct ppc_debug_info));
+ /* Check whether ptrace BOOKE interface is functional and
+ provides any supported feature. */
+ if (booke_debug_info.features != 0)
+ {
+ have_ptrace_booke_interface = 1;
+ max_slots_number = booke_debug_info.num_instruction_bps
+ + booke_debug_info.num_data_bps
+ + booke_debug_info.num_condition_regs;
+ return have_ptrace_booke_interface;
+ }
}
+ /* Old school interface and no BOOKE debug registers support. */
+ have_ptrace_booke_interface = 0;
+ memset (&booke_debug_info, 0, sizeof (struct ppc_debug_info));
}
return have_ptrace_booke_interface;

View File

@ -1,102 +0,0 @@
http://sourceware.org/ml/gdb-patches/2012-02/msg00673.html
Subject: [patch] Fix regression by me for gcc-4.0...gcc-4.4 i386 -O2 -g parameters (PR 13777)
Hi,
http://sourceware.org/bugzilla/show_bug.cgi?id=13777
for CentOS-5 i386 ls:
$ gdb ls
(gdb) start
Temporary breakpoint 1, main (argc=Cannot access memory at address 0x81b7c7cd
instead of GDB before my PR 12573 fix/change:
Temporary breakpoint 1, main (argc=1, ...
I asked before on #gcc since which versions GCC produced DW_AT_location which
is for any PC either optimized-out or it has valid value. I was told since
gcc-4.0. But that is not true.
I have bisected gcc and I found 4.4.0 was still broken, 4.5.0 was correct,
thanks to:
commit 25e880b1917bd6bbf07e86b5574c698f3e9472d9
Author: rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Sat May 30 00:33:46 2009 +0000
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147995 138bc75d-0d04-0410-961f-82ee72b054a4
unwind info for epilogues
Curiously 4.4.x branch got later also fixed in this case by:
commit 61db8bd232daeed3751b43570fab16146145e096
Author: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue Jun 2 07:18:16 2009 +0000
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_4-branch@148070 138bc75d-0d04-0410-961f-82ee72b054a4
(but that missed 4.4.0)
As 4.5.0 was first FSF GCC with VTA I was trusting more the validity only
after VTA and these heuristic results seems to confirm that.
I find the change below definitely safe.
Someone may object the original PR 12573 (do not try to skip prologue for -O2
-g code as it may cause more confusion than anything else) as while it fixed
some GDB crashes there is no such purpose anymore with Tom's
ambiguous-linespec patch. Still I believe PR 12573 was right to do.
No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu.
I will check it in.
Thanks,
Jan
gdb/
2012-02-28 Jan Kratochvil <jan.kratochvil@redhat.com>
PR symtab/13777
* dwarf2read.c (process_full_comp_unit): Set LOCATIONS_VALID only for
GCC >=4.5.
gdb/testsuite/
2012-02-28 Jan Kratochvil <jan.kratochvil@redhat.com>
PR symtab/13777
* gdb.dwarf2/dw2-skip-prologue.S (DW_AT_producer): Set it to 4.5.0.
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -4841,7 +4841,9 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
/* GCC-4.0 has started to support -fvar-tracking. GCC-3.x still can
produce DW_AT_location with location lists but it can be possibly
- invalid without -fvar-tracking.
+ invalid without -fvar-tracking. Still up to GCC-4.4.x incl. 4.4.0
+ there were bugs in prologue debug info, fixed later in GCC-4.5
+ by "unwind info for epilogues" patch (which is not directly related).
For -gdwarf-4 type units LOCATIONS_VALID indication is fortunately not
needed, it would be wrong due to missing DW_AT_producer there.
@@ -4849,7 +4851,7 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
Still one can confuse GDB by using non-standard GCC compilation
options - this waits on GCC PR other/32998 (-frecord-gcc-switches).
*/
- if (cu->has_loclist && gcc_4_minor >= 0)
+ if (cu->has_loclist && gcc_4_minor >= 5)
symtab->locations_valid = 1;
if (gcc_4_minor >= 5)
--- a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
@@ -30,7 +30,7 @@
.4byte func_start /* DW_AT_low_pc */
.4byte func_end /* DW_AT_high_pc */
.ascii "main.c\0" /* DW_AT_name */
- .ascii "GNU C 4.0.0\0" /* DW_AT_producer must be >= 4.0 */
+ .ascii "GNU C 4.5.0\0" /* DW_AT_producer must be >= 4.5 */
.byte 2 /* DW_AT_language (DW_LANG_C) */
.uleb128 2 /* Abbrev: DW_TAG_subprogram */

View File

@ -1,9 +1,9 @@
Index: gdb-7.2.50.20110328/gdb/linux-nat.c
Index: gdb-7.4.50.20120602/gdb/linux-nat.c
===================================================================
--- gdb-7.2.50.20110328.orig/gdb/linux-nat.c 2011-03-28 18:46:16.000000000 +0200
+++ gdb-7.2.50.20110328/gdb/linux-nat.c 2011-03-28 18:47:56.000000000 +0200
@@ -1774,8 +1774,22 @@ get_pending_status (struct lwp_info *lp,
target_signal_to_string (signo));
--- gdb-7.4.50.20120602.orig/gdb/linux-nat.c 2012-06-02 20:54:30.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/linux-nat.c 2012-06-02 20:56:03.966493352 +0200
@@ -1816,8 +1816,22 @@ get_pending_status (struct lwp_info *lp,
gdb_signal_to_string (signo));
}
- if (*status == 0 && GET_PID (lp->ptid) == pid_was_stopped)

View File

@ -1,265 +0,0 @@
commit 7d8bdfbdfd0e38fb314d70785b0516181b8d4e77
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Mon Mar 26 20:49:51 2012 +0200
https://bugzilla.redhat.com/show_bug.cgi?id=806920
gdb.dwarf2/dw2-subrange-no-type.exp
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -9014,6 +9014,44 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
/* Preserve BASE_TYPE's original type, just set its LENGTH. */
check_typedef (base_type);
+ /* Dwarf-2 specifications explicitly allows to create subrange types
+ without specifying a base type.
+ In that case, the base type must be set to the type of
+ the lower bound, upper bound or count, in that order, if any of these
+ three attributes references an object that has a type.
+ If no base type is found, the Dwarf-2 specifications say that
+ a signed integer type of size equal to the size of an address should
+ be used.
+ For the following C code: `extern char gdb_int [];'
+ GCC produces an empty range DIE.
+ FIXME: muller/2010-05-28: Possible references to object for low bound,
+ high bound or count are not yet handled by this code. */
+ if (TYPE_CODE (base_type) == TYPE_CODE_VOID)
+ {
+ struct objfile *objfile = cu->objfile;
+ struct gdbarch *gdbarch = get_objfile_arch (objfile);
+ int addr_size = gdbarch_addr_bit (gdbarch) /8;
+ struct type *int_type = objfile_type (objfile)->builtin_int;
+
+ /* Test "int", "long int", and "long long int" objfile types,
+ and select the first one having a size above or equal to the
+ architecture address size. */
+ if (int_type && TYPE_LENGTH (int_type) >= addr_size)
+ base_type = int_type;
+ else
+ {
+ int_type = objfile_type (objfile)->builtin_long;
+ if (int_type && TYPE_LENGTH (int_type) >= addr_size)
+ base_type = int_type;
+ else
+ {
+ int_type = objfile_type (objfile)->builtin_long_long;
+ if (int_type && TYPE_LENGTH (int_type) >= addr_size)
+ base_type = int_type;
+ }
+ }
+ }
+
/* The die_type call above may have already set the type for this DIE. */
range_type = get_die_type (die, cu);
if (range_type)
@@ -9141,44 +9179,6 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
TYPE_HIGH_BOUND (range_type) = high;
}
- /* Dwarf-2 specifications explicitly allows to create subrange types
- without specifying a base type.
- In that case, the base type must be set to the type of
- the lower bound, upper bound or count, in that order, if any of these
- three attributes references an object that has a type.
- If no base type is found, the Dwarf-2 specifications say that
- a signed integer type of size equal to the size of an address should
- be used.
- For the following C code: `extern char gdb_int [];'
- GCC produces an empty range DIE.
- FIXME: muller/2010-05-28: Possible references to object for low bound,
- high bound or count are not yet handled by this code. */
- if (TYPE_CODE (base_type) == TYPE_CODE_VOID)
- {
- struct objfile *objfile = cu->objfile;
- struct gdbarch *gdbarch = get_objfile_arch (objfile);
- int addr_size = gdbarch_addr_bit (gdbarch) /8;
- struct type *int_type = objfile_type (objfile)->builtin_int;
-
- /* Test "int", "long int", and "long long int" objfile types,
- and select the first one having a size above or equal to the
- architecture address size. */
- if (int_type && TYPE_LENGTH (int_type) >= addr_size)
- base_type = int_type;
- else
- {
- int_type = objfile_type (objfile)->builtin_long;
- if (int_type && TYPE_LENGTH (int_type) >= addr_size)
- base_type = int_type;
- else
- {
- int_type = objfile_type (objfile)->builtin_long_long;
- if (int_type && TYPE_LENGTH (int_type) >= addr_size)
- base_type = int_type;
- }
- }
- }
-
/* DW_AT_bit_stride is currently unsupported as we count in bytes. */
attr = dwarf2_attr (die, DW_AT_byte_stride, cu);
if (attr && attr_form_is_block (attr) && cu->language != language_ada)
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S
@@ -0,0 +1,121 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2012 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Debug information */
+
+ .section .data
+vardata:
+ .rept 129
+ .ascii "x"
+ .endr
+ .ascii "UNSEEN\0"
+
+ .section .debug_info
+.Lcu1_begin:
+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
+.Lcu1_start:
+ .2byte 2 /* DWARF version number */
+ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
+ .byte 4 /* Pointer Size (in bytes) */
+
+ /* CU die */
+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
+ .byte 2 /* DW_AT_language (C) - */
+
+.Larray_type:
+ .uleb128 2 /* Abbrev: DW_TAG_array_type */
+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */
+
+ .uleb128 8 /* Abbrev: DW_TAG_subrange_type without DW_AT_type */
+ .byte 0 /* DW_AT_lower_bound */
+ .byte 128 /* DW_AT_upper_bound */
+
+ .byte 0 /* End of children of die */
+
+.Lchar_type:
+ .uleb128 4 /* Abbrev: DW_TAG_base_type */
+ .ascii "char\0" /* DW_AT_name */
+ .byte 1 /* DW_AT_byte_size */
+ .byte 6 /* DW_AT_encoding */
+
+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */
+ .ascii "notype_string\0" /* DW_AT_name */
+ .4byte .Larray_type-.Lcu1_begin /* DW_AT_type */
+ .byte 2f - 1f /* DW_AT_location */
+1: .byte 3 /* DW_OP_addr */
+ .4byte vardata /* <addr> */
+2:
+
+ .byte 0 /* End of children of CU */
+.Lcu1_end:
+
+ .section .debug_abbrev
+.Ldebug_abbrev0:
+ .uleb128 1 /* Abbrev code */
+ .uleb128 0x11 /* DW_TAG_compile_unit */
+ .byte 0x1 /* has_children */
+ .uleb128 0x25 /* DW_AT_producer */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x13 /* DW_AT_language */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 2 /* Abbrev code */
+ .uleb128 0x1 /* TAG: DW_TAG_array_type */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 4 /* Abbrev code */
+ .uleb128 0x24 /* DW_TAG_base_type */
+ .byte 0x0 /* no_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0xb /* DW_AT_byte_size */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x3e /* DW_AT_encoding */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 6 /* Abbrev code */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0x0 /* no_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x2 /* DW_AT_location */
+ .uleb128 0xa /* DW_FORM_block1 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 8 /* Abbrev code */
+ .uleb128 0x21 /* DW_TAG_subrange_type without DW_AT_type */
+ .byte 0x0 /* no children */
+ .uleb128 0x22 /* DW_AT_lower_bound */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x2f /* DW_AT_upper_bound */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .byte 0x0 /* Terminator */
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp
@@ -0,0 +1,39 @@
+# Copyright 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+load_lib dwarf.exp
+
+# https://bugzilla.redhat.com/show_bug.cgi?id=806920
+# read_subrange_type <TYPE_CODE (base_type) == TYPE_CODE_VOID> reinitialization
+# of BASE_TYPE was done too late, it affects DW_TAG_subrange_type without
+# specified DW_AT_type, present only in XLF produced code.
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if {![dwarf2_support]} {
+ return 0
+}
+
+set testfile dw2-subrange-no-type
+set srcfile ${testfile}.S
+set executable ${testfile}.x
+set binfile ${objdir}/${subdir}/${executable}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
+ return -1
+}
+
+clean_restart $executable
+
+gdb_test "ptype notype_string" {type = char \[129\]}
+gdb_test "p notype_string" " = 'x' <repeats 129 times>"

View File

@ -1,44 +0,0 @@
[RFA/commit 5/5] Add -Wunused-function to compile flags.
http://sourceware.org/ml/gdb-patches/2010-01/msg00371.html
http://sourceware.org/ml/gdb-cvs/2010-01/msg00163.html
REVERTED
--- src/gdb/configure.ac 2010/01/15 00:34:37 1.112
+++ src/gdb/configure.ac 2010/01/19 09:52:31 1.113
@@ -1544,8 +1544,7 @@
# gdb/doc/gdbint.texinfo.
build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
-Wformat-nonliteral -Wno-pointer-sign \
--Wno-unused -Wunused-value -Wunused-function \
--Wno-switch -Wno-char-subscripts"
+-Wno-unused -Wunused-value -Wno-switch -Wno-char-subscripts"
# Enable -Wno-format by default when using gcc on mingw since many
# GCC versions complain about %I64.
--- src/gdb/configure 2010/01/15 00:34:37 1.297
+++ src/gdb/configure 2010/01/19 09:52:32 1.298
@@ -13435,8 +13435,7 @@
# gdb/doc/gdbint.texinfo.
build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
-Wformat-nonliteral -Wno-pointer-sign \
--Wno-unused -Wunused-value -Wunused-function \
--Wno-switch -Wno-char-subscripts"
+-Wno-unused -Wunused-value -Wno-switch -Wno-char-subscripts"
# Enable -Wno-format by default when using gcc on mingw since many
# GCC versions complain about %I64.
### src/gdb/ChangeLog 2010/01/19 09:50:48 1.11271
### src/gdb/ChangeLog 2010/01/19 09:52:33 1.11272
## -1,11 +1,5 @@
2010-01-19 Joel Brobecker <brobecker@adacore.com>
- Add -Wunused-function to compile flags.
- * configure.ac: Add -Wunused-function to build_warnings.
- * configure: Regenerate.
-
-2010-01-19 Joel Brobecker <brobecker@adacore.com>
-
"delete" ada-lex.c:input function, not used.
* ada-lex.l: #define YY_NO_INPUT.

View File

@ -1,299 +1,239 @@
FYI: fix possible crash in find_charset_names
http://sourceware.org/ml/gdb-patches/2012-02/msg00073.html
http://sourceware.org/ml/gdb-cvs/2012-02/msg00037.html
https://bugzilla.redhat.com/show_bug.cgi?id=786091
### src/gdb/ChangeLog 2012/02/07 04:48:14 1.13810
### src/gdb/ChangeLog 2012/02/07 15:42:33 1.13811
## -1,3 +1,7 @@
+2012-02-07 Tom Tromey <tromey@redhat.com>
+
+ * charset.c (find_charset_names): Check 'in' against NULL.
+
2012-02-06 Doug Evans <dje@google.com>
* gdbtypes.h (struct main_type): Change type of name,tag_name,
--- src/gdb/charset.c 2012/01/24 21:36:37 1.47
+++ src/gdb/charset.c 2012/02/07 15:42:39 1.48
@@ -839,7 +839,7 @@
parse the glibc and libiconv formats; feel free to add others
as needed. */
- while (!feof (in))
+ while (in != NULL && !feof (in))
{
/* The size of buf is chosen arbitrarily. */
char buf[1024];
http://sourceware.org/ml/gdb-patches/2012-02/msg00151.html
Subject: [patch] ppc-linux-nat.c: Fix gcc-4.7 aliasing warnings
http://sourceware.org/ml/gdb-patches/2012-06/msg00065.html
Subject: [commit 1/2] testsuite: code_elim.exp: unique names
Hi,
ppc-linux-nat.c: In function 'fetch_register':
ppc-linux-nat.c:598:9: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
ppc-linux-nat.c: In function 'store_register':
ppc-linux-nat.c:1078:8: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
this is just removal of non-unique test names and one small simplification.
gcc-4.7.0-0.10.fc17.ppc64
Probably clear, I looked at making it using union instead of memcpy but that
would be too ugly.
No regressions on ppc64-fedorarawhide-linux-gnu only for gdb.base/*.exp.
I will check it in.
Checked in.
Thanks,
Jan
gdb/
2012-02-09 Jan Kratochvil <jan.kratochvil@redhat.com>
http://sourceware.org/ml/gdb-cvs/2012-06/msg00011.html
* ppc-linux-nat.c (fetch_register, store_register): Fix GCC aliasing
compilation warning.
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -593,9 +593,10 @@ fetch_register (struct regcache *regcache, int tid, int regno)
bytes_transferred < register_size (gdbarch, regno);
bytes_transferred += sizeof (long))
{
+ long l;
### src/gdb/testsuite/ChangeLog 2012/05/28 20:37:29 1.3209
### src/gdb/testsuite/ChangeLog 2012/06/03 17:06:04 1.3210
## -1,3 +1,16 @@
+2012-06-03 Jan Kratochvil <jan.kratochvil@redhat.com>
+
errno = 0;
- *(long *) &buf[bytes_transferred]
- = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0);
+ l = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0);
regaddr += sizeof (long);
if (errno != 0)
{
@@ -604,6 +605,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
gdbarch_register_name (gdbarch, regno), regno);
perror_with_name (message);
}
+ memcpy (&buf[bytes_transferred], &l, sizeof (l));
}
/* Now supply the register. Keep in mind that the regcache's idea
@@ -1073,9 +1075,11 @@ store_register (const struct regcache *regcache, int tid, int regno)
for (i = 0; i < bytes_to_transfer; i += sizeof (long))
{
+ long l;
+ * gdb.base/code_elim.exp (add-symbol-file ${testfile1} 0x100000):
+ Simplify it to ...
+ (symbol-file ${testfile1}): ... here.
+ (test eliminated var my_global_symbol)
+ (test eliminated var my_static_symbol)
+ (test eliminated var my_global_func, get address of main): Wrap them to
+ 'single psymtabs' and 'single symtabs'
+ (get address of my_global_symbol, get address of my_static_symbol)
+ (get address of my_global_func, get address of main): Wrap them to
+ 'order1' and 'order2'.
+
+ memcpy (&l, &buf[i], sizeof (l));
errno = 0;
- ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr,
- *(long *) &buf[i]);
+ ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr, l);
regaddr += sizeof (long);
2012-05-28 Jan Kratochvil <jan.kratochvil@redhat.com>
if (errno == EIO
http://sourceware.org/ml/gdb-patches/2012-02/msg00409.html
Subject: FYI: remove extraneous block from dw2_map_symtabs_matching_filename
http://sourceware.org/ml/gdb-cvs/2012-02/msg00117.html
commit 61d8161b33b1e7dbc80ba6f7a92500a1594da55c
### src/gdb/ChangeLog 2012/02/20 09:42:34 1.13845
### src/gdb/ChangeLog 2012/02/20 19:24:34 1.13846
## -1,3 +1,8 @@
+2012-02-20 Tom Tromey <tromey@redhat.com>
+
+ * dwarf2read.c (dw2_map_symtabs_matching_filename): Remove
+ extraneous block.
+
2012-02-20 Tristan Gingold <gingold@adacore.com>
* gdb.server/solib-list-lib.c: New file.
--- src/gdb/testsuite/gdb.base/code_elim.exp 2012/01/16 16:21:44 1.4
+++ src/gdb/testsuite/gdb.base/code_elim.exp 2012/06/03 17:06:04 1.5
@@ -95,16 +95,16 @@
gdb_exit
gdb_start
* darwin-nat.h (enum darwin_msg_state): Add comments.
--- src/gdb/dwarf2read.c 2012/02/07 04:48:19 1.612
+++ src/gdb/dwarf2read.c 2012/02/20 19:24:39 1.613
@@ -2437,13 +2437,6 @@
return 1;
}
-gdb_test "add-symbol-file ${binfile1} 0x100000" \
+gdb_test "symbol-file ${binfile1}" \
"Reading symbols from .*${testfile1}\\.\\.\\.done\\.(|\r\nUsing host libthread_db library .*libthread_db.so.*\\.)" \
- "add-symbol-file ${testfile1} 0x100000" \
- "add symbol table from file \".*${testfile1}\" at\[ \t\r\n\]+\.text_addr = 0x100000\[\r\n\]+\\(y or n\\) " \
- "y"
+ "symbol-file ${testfile1}"
- {
- if (dw2_map_expand_apply (objfile, per_cu,
- name, full_path, real_path,
- callback, data))
- return 1;
- }
-test_eliminated_var my_global_symbol
-test_eliminated_var my_static_symbol
-test_eliminated_var my_global_func
-not_null_var_address main
+with_test_prefix "single psymtabs" {
+ test_eliminated_var my_global_symbol
+ test_eliminated_var my_static_symbol
+ test_eliminated_var my_global_func
+ not_null_var_address main
+}
# Same thing for symtabs
@@ -115,10 +115,12 @@
gdb_start
set GDBFLAGS $saved_gdbflags
-test_eliminated_var my_global_symbol
-test_eliminated_var my_static_symbol
-test_eliminated_var my_global_func
-not_null_var_address main
+with_test_prefix "single symtabs" {
+ test_eliminated_var my_global_symbol
+ test_eliminated_var my_static_symbol
+ test_eliminated_var my_global_func
+ not_null_var_address main
+}
# binfile2 contains the symbols that have been eliminated in binfile1. Check
# the eliminated symbols does not hide these valid ones.
@@ -138,10 +140,12 @@
"add symbol table from file \".*${testfile2}\" at\[ \t\r\n\]+\.text_addr = 0x200000\[\r\n\]+\\(y or n\\) " \
"y"
-not_null_var_address my_global_symbol
-not_null_var_address my_static_symbol
-not_null_var_address my_global_func
-not_null_var_address main
+with_test_prefix "order1" {
+ not_null_var_address my_global_symbol
+ not_null_var_address my_static_symbol
+ not_null_var_address my_global_func
+ not_null_var_address main
+}
# Same thing, but loading binfile2 before binfile1.
@@ -160,9 +164,9 @@
"add symbol table from file \".*${testfile1}\" at\[ \t\r\n\]+\.text_addr = 0x100000\[\r\n\]+\\(y or n\\) " \
"y"
-not_null_var_address my_global_symbol
-not_null_var_address my_static_symbol
-not_null_var_address my_global_func
-not_null_var_address main
-
/* Before we invoke realpath, which can get expensive when many
files are involved, do a quick comparison of the basenames. */
if (! basenames_may_differ
-
+with_test_prefix "order2" {
+ not_null_var_address my_global_symbol
+ not_null_var_address my_static_symbol
+ not_null_var_address my_global_func
+ not_null_var_address main
+}
FYI: fix some performance bugs with .gdb_index
http://sourceware.org/ml/gdb-patches/2012-02/msg00413.html
http://sourceware.org/ml/gdb-cvs/2012-02/msg00119.html
http://sourceware.org/ml/gdb-patches/2012-06/msg00066.html
Subject: [commit 2/2] testsuite: code_elim.exp: Fix false FAIL
### src/gdb/ChangeLog 2012/02/20 19:44:00 1.13847
### src/gdb/ChangeLog 2012/02/20 20:56:12 1.13848
## -1,3 +1,10 @@
+2012-02-20 Tom Tromey <tromey@redhat.com>
+
+ PR gdb/13498:
+ * dwarf2read.c (dw2_expand_symtabs_matching): Only visit a
+ particular set of file names once.
+ (dw2_map_symbol_filenames): Likewise.
+
2012-02-20 Jan Kratochvil <jan.kratochvil@redhat.com>
Hi,
with Fedora 18 x86_64 (Rawhide) there is a false FAIl since:
2167931cf70f91206efb8b01e848a55d82a347ce is the first bad commit
Author: Tom Tromey <tromey@redhat.com>
Date: Fri May 18 15:31:39 2012 +0000
http://sourceware.org/bugzilla/show_bug.cgi?id=13907
print &my_global_symbol
-$1 = (int *) 0x804a004
-(gdb) PASS: gdb.base/code_elim.exp: get address of my_global_symbol
+$1 = (int *) 0x804a004 <completed.5732>
+(gdb) FAIL: gdb.base/code_elim.exp: get address of my_global_symbol
Nothing really changed, just GDB now prints <completed.5732> and the testcase
expects either none or <my_global_symbol> suffix.
This is because the two symbol files (their sections .data/.bss) have
overlapped so GDB chooses randomly which symbol to display. And since
Fedora 18 GCC puts there that "completed.5732" symbol.
This may be because add-symbol-file FILE ADDR relocates to ADDR on the .text
section and leaves other sections at their original place, which is IMO a bit
unexpected; it is a FAQ people expect more ADDR to be relocation displacement
(and not relative to .text and not limited to .text). But this is really
outside of the scope of this testcase false FAIL.
Checked in.
Thanks,
Jan
http://sourceware.org/ml/gdb-cvs/2012-06/msg00012.html
### src/gdb/testsuite/ChangeLog 2012/06/03 17:06:04 1.3210
### src/gdb/testsuite/ChangeLog 2012/06/03 17:10:28 1.3211
## -11,6 +11,16 @@
(get address of my_global_func, get address of main): Wrap them to
'order1' and 'order2'.
Code cleanup.
--- src/gdb/dwarf2read.c 2012/02/20 19:24:39 1.613
+++ src/gdb/dwarf2read.c 2012/02/20 20:56:12 1.614
@@ -2700,32 +2700,63 @@
index = dwarf2_per_objfile->index_table;
if (file_matcher != NULL)
- for (i = 0; i < (dwarf2_per_objfile->n_comp_units
- + dwarf2_per_objfile->n_type_units); ++i)
- {
- int j;
- struct dwarf2_per_cu_data *per_cu = dw2_get_cu (i);
- struct quick_file_names *file_data;
+ {
+ struct cleanup *cleanup;
+ htab_t visited_found, visited_not_found;
- per_cu->v.quick->mark = 0;
+ visited_found = htab_create_alloc (10,
+ htab_hash_pointer, htab_eq_pointer,
+ NULL, xcalloc, xfree);
+ cleanup = make_cleanup_htab_delete (visited_found);
+ visited_not_found = htab_create_alloc (10,
+ htab_hash_pointer, htab_eq_pointer,
+ NULL, xcalloc, xfree);
+ make_cleanup_htab_delete (visited_not_found);
- /* We only need to look at symtabs not already expanded. */
- if (per_cu->v.quick->symtab)
- continue;
+ for (i = 0; i < (dwarf2_per_objfile->n_comp_units
+ + dwarf2_per_objfile->n_type_units); ++i)
+ {
+ int j;
+ struct dwarf2_per_cu_data *per_cu = dw2_get_cu (i);
+ struct quick_file_names *file_data;
+ void **slot;
- file_data = dw2_get_file_names (objfile, per_cu);
- if (file_data == NULL)
- continue;
+ per_cu->v.quick->mark = 0;
- for (j = 0; j < file_data->num_file_names; ++j)
- {
- if (file_matcher (file_data->file_names[j], data))
- {
- per_cu->v.quick->mark = 1;
- break;
- }
- }
- }
+ /* We only need to look at symtabs not already expanded. */
+ if (per_cu->v.quick->symtab)
+ continue;
+ * gdb.base/code_elim.exp
+ (add-symbol-file ${testfile1} 0x100000)
+ (add-symbol-file ${testfile2} 0x200000): Wrap them to 'order1' and
+ 'order2'.
+ (order1: add-symbol-file ${testfile1} 0x100000)
+ (order1: add-symbol-file ${testfile2} 0x200000)
+ (order2: add-symbol-file ${testfile2} 0x200000)
+ (order2: add-symbol-file ${testfile1} 0x100000): Add -s .data and -s
+ .bss as appropriate.
+
+ file_data = dw2_get_file_names (objfile, per_cu);
+ if (file_data == NULL)
+ continue;
+
+ if (htab_find (visited_not_found, file_data) != NULL)
+ continue;
+ else if (htab_find (visited_found, file_data) != NULL)
+ {
+ per_cu->v.quick->mark = 1;
+ continue;
+ }
+
+ for (j = 0; j < file_data->num_file_names; ++j)
+ {
+ if (file_matcher (file_data->file_names[j], data))
+ {
+ per_cu->v.quick->mark = 1;
+ break;
+ }
+ }
+
+ slot = htab_find_slot (per_cu->v.quick->mark
+ ? visited_found
+ : visited_not_found,
+ file_data, INSERT);
+ *slot = file_data;
+ }
+
+ do_cleanups (cleanup);
+ }
2012-05-28 Jan Kratochvil <jan.kratochvil@redhat.com>
for (iter = 0; iter < index->symbol_table_slots; ++iter)
{
@@ -2787,15 +2818,35 @@
void *data, int need_fullname)
{
int i;
+ struct cleanup *cleanup;
+ htab_t visited = htab_create_alloc (10, htab_hash_pointer, htab_eq_pointer,
+ NULL, xcalloc, xfree);
* gdb.server/solib-list-lib.c: New file.
--- src/gdb/testsuite/gdb.base/code_elim.exp 2012/06/03 17:06:04 1.5
+++ src/gdb/testsuite/gdb.base/code_elim.exp 2012/06/03 17:10:28 1.6
@@ -128,19 +128,19 @@
gdb_exit
gdb_start
+ cleanup = make_cleanup_htab_delete (visited);
dw2_setup (objfile);
-gdb_test "add-symbol-file ${binfile1} 0x100000" \
- "Reading symbols from .*${testfile1}\\.\\.\\.done\\." \
- "add-symbol-file ${testfile1} 0x100000" \
- "add symbol table from file \".*${testfile1}\" at\[ \t\r\n\]+\.text_addr = 0x100000\[\r\n\]+\\(y or n\\) " \
- "y"
-
-gdb_test "add-symbol-file ${binfile2} 0x200000" \
- "Reading symbols from .*${testfile2}\\.\\.\\.done\\." \
- "add-symbol-file ${testfile2} 0x200000" \
- "add symbol table from file \".*${testfile2}\" at\[ \t\r\n\]+\.text_addr = 0x200000\[\r\n\]+\\(y or n\\) " \
- "y"
-
with_test_prefix "order1" {
+ gdb_test "add-symbol-file ${binfile1} 0x100000 -s .bss 0x120000" \
+ "Reading symbols from .*${testfile1}\\.\\.\\.done\\." \
+ "add-symbol-file ${testfile1} 0x100000" \
+ "add symbol table from file \".*${testfile1}\" at.*\\(y or n\\) " \
+ "y"
+
+ gdb_test "add-symbol-file ${binfile2} 0x200000 -s .data 0x210000 -s .bss 0x220000" \
+ "Reading symbols from .*${testfile2}\\.\\.\\.done\\." \
+ "add-symbol-file ${testfile2} 0x200000" \
+ "add symbol table from file \".*${testfile2}\" at.*\\(y or n\\) " \
+ "y"
+
not_null_var_address my_global_symbol
not_null_var_address my_static_symbol
not_null_var_address my_global_func
@@ -152,19 +152,19 @@
gdb_exit
gdb_start
+ /* We can ignore file names coming from already-expanded CUs. */
+ for (i = 0; i < (dwarf2_per_objfile->n_comp_units
+ + dwarf2_per_objfile->n_type_units); ++i)
+ {
+ struct dwarf2_per_cu_data *per_cu = dw2_get_cu (i);
-gdb_test "add-symbol-file ${binfile2} 0x200000" \
- "Reading symbols from .*${testfile2}\\.\\.\\.done\\." \
- "add-symbol-file ${testfile2} 0x200000" \
- "add symbol table from file \".*${testfile2}\" at\[ \t\r\n\]+\.text_addr = 0x200000\[\r\n\]+\\(y or n\\) " \
- "y"
-
-gdb_test "add-symbol-file ${binfile1} 0x100000" \
- "Reading symbols from .*${testfile1}\\.\\.\\.done\\." \
- "add-symbol-file ${testfile1} 0x100000" \
- "add symbol table from file \".*${testfile1}\" at\[ \t\r\n\]+\.text_addr = 0x100000\[\r\n\]+\\(y or n\\) " \
- "y"
-
with_test_prefix "order2" {
+ gdb_test "add-symbol-file ${binfile2} 0x200000 -s .data 0x210000 -s .bss 0x220000" \
+ "Reading symbols from .*${testfile2}\\.\\.\\.done\\." \
+ "add-symbol-file ${testfile2} 0x200000" \
+ "add symbol table from file \".*${testfile2}\" at.*\\(y or n\\) " \
+ "y"
+
+ if (per_cu->v.quick->symtab)
+ {
+ void **slot = htab_find_slot (visited, per_cu->v.quick->file_names,
+ INSERT);
+ gdb_test "add-symbol-file ${binfile1} 0x100000 -s .bss 0x120000" \
+ "Reading symbols from .*${testfile1}\\.\\.\\.done\\." \
+ "add-symbol-file ${testfile1} 0x100000" \
+ "add symbol table from file \".*${testfile1}\" at.*\\(y or n\\) " \
+ "y"
+
+ *slot = per_cu->v.quick->file_names;
+ }
+ }
+
for (i = 0; i < (dwarf2_per_objfile->n_comp_units
+ dwarf2_per_objfile->n_type_units); ++i)
{
int j;
struct dwarf2_per_cu_data *per_cu = dw2_get_cu (i);
struct quick_file_names *file_data;
+ void **slot;
/* We only need to look at symtabs not already expanded. */
if (per_cu->v.quick->symtab)
@@ -2805,6 +2856,14 @@
if (file_data == NULL)
continue;
+ slot = htab_find_slot (visited, file_data, INSERT);
+ if (*slot)
+ {
+ /* Already visited. */
+ continue;
+ }
+ *slot = file_data;
+
for (j = 0; j < file_data->num_file_names; ++j)
{
const char *this_real_name;
@@ -2816,6 +2875,8 @@
(*fun) (file_data->file_names[j], this_real_name, data);
}
}
+
+ do_cleanups (cleanup);
}
static int
not_null_var_address my_global_symbol
not_null_var_address my_static_symbol
not_null_var_address my_global_func

View File

@ -42,8 +42,10 @@ gdb/testsuite/
* gdb.base/call-signal-resume.exp (maintenance print dummy-frames)
(maintenance info breakpoints): New tests.
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
Index: gdb-7.4.50.20120602/gdb/dummy-frame.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/dummy-frame.c 2012-01-04 09:17:00.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/dummy-frame.c 2012-06-02 20:42:40.907720327 +0200
@@ -29,6 +29,7 @@
#include "gdbcmd.h"
#include "gdb_string.h"
@ -52,7 +54,7 @@ gdb/testsuite/
/* Dummy frame. This saves the processor state just prior to setting
up the inferior function call. Older targets save the registers
@@ -108,19 +109,36 @@ remove_dummy_frame (struct dummy_frame **dummy_ptr)
@@ -108,19 +109,36 @@ remove_dummy_frame (struct dummy_frame *
xfree (dummy);
}
@ -92,11 +94,13 @@ gdb/testsuite/
*dummy_ptr = dummy->next;
xfree (dummy);
--- a/gdb/testsuite/gdb.base/call-signal-resume.exp
+++ b/gdb/testsuite/gdb.base/call-signal-resume.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.base/call-signal-resume.exp
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/testsuite/gdb.base/call-signal-resume.exp 2012-01-23 18:11:50.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.base/call-signal-resume.exp 2012-06-02 20:43:10.523709052 +0200
@@ -101,6 +101,18 @@ gdb_test "frame $frame_number" ".*"
gdb_test_no_output "set confirm off"
gdb_test_no_output "return"
gdb_test "return" ""
+# Verify there are no remains of the dummy frame.
+gdb_test_no_output "maintenance print dummy-frames"

169
gdb.spec
View File

@ -24,13 +24,13 @@
%global _root_bindir %{_bindir}
}
Summary: A GNU source-level debugger for C, C++, Fortran and other languages
Summary: A GNU source-level debugger for C, C++, Fortran, Go and other languages
Name: %{?scl_prefix}gdb
# Set version to contents of gdb/version.in.
# NOTE: the FSF gdb versions are numbered N.M for official releases, like 6.3
# and, since January 2005, X.Y.Z.date for daily snapshots, like 6.3.50.20050112 # (daily snapshot from mailine), or 6.3.0.20040112 (head of the release branch).
%global snap 20120120
%global snap 20120602
Version: 7.4.50.%{snap}
# The release always contains a leading reserved number, start it at 1.
@ -133,10 +133,10 @@ Patch105: gdb-6.3-ppc64syscall-20040622.patch
Patch111: gdb-6.3-ppc64displaysymbol-20041124.patch
# Fix upstream `set scheduler-locking step' vs. upstream PPC atomic seqs.
#=maybepush+work: It is a bit difficult patch, a part is ppc specific.
#=push+work: It is a bit difficult patch, a part is ppc specific.
Patch112: gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch
# Make upstream `set scheduler-locking step' as default.
#=maybepush+work: How much is scheduler-locking relevant after non-stop?
#=push+work: How much is scheduler-locking relevant after non-stop?
Patch260: gdb-6.6-scheduler_locking-step-is-default.patch
# Add a wrapper script to GDB that implements pstack using the
@ -147,13 +147,13 @@ Patch118: gdb-6.3-gstack-20050411.patch
# VSYSCALL and PIE
#=fedoratest
Patch122: gdb-6.3-test-pie-20050107.patch
#=maybepush: May get obsoleted by Tom's unrelocated objfiles patch.
#=push: May get obsoleted by Tom's unrelocated objfiles patch.
Patch389: gdb-archer-pie-addons.patch
#=push+work: Breakpoints disabling matching should not be based on address.
Patch394: gdb-archer-pie-addons-keep-disabled.patch
# Get selftest working with sep-debug-info
#=maybepush
#=fedoratest
Patch125: gdb-6.3-test-self-20050110.patch
# Test support of multiple destructors just like multiple constructors
@ -235,7 +235,7 @@ Patch208: gdb-6.5-BEA-testsuite.patch
Patch213: gdb-6.5-readline-long-line-crash-test.patch
# Fix bogus 0x0 unwind of the thread's topmost function clone(3) (BZ 216711).
#=push
#=fedora
Patch214: gdb-6.5-bz216711-clone-is-outermost.patch
# Test sideeffects of skipping ppc .so libs trampolines (BZ 218379).
@ -243,7 +243,7 @@ Patch214: gdb-6.5-bz216711-clone-is-outermost.patch
Patch216: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
# Fix lockup on trampoline vs. its function lookup; unreproducible (BZ 218379).
#=push
#=fedora
Patch217: gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
# Find symbols properly at their original (included) file (BZ 109921).
@ -279,7 +279,7 @@ Patch245: gdb-6.6-bz229517-gcore-without-terminal.patch
Patch247: gdb-6.6-bz235197-fork-detach-info.patch
# Avoid too long timeouts on failing cases of "annota1.exp annota3.exp".
#=push
#=fedoratest
Patch254: gdb-6.6-testsuite-timeouts.patch
# Support for stepping over PPC atomic instruction sequences (BZ 237572).
@ -321,7 +321,7 @@ Patch282: gdb-6.7-charsign-test.patch
Patch284: gdb-6.7-ppc-clobbered-registers-O2-test.patch
# Testsuite fixes for more stable/comparable results.
#=push
#=fedoratest
Patch287: gdb-6.7-testsuite-stable-results.patch
# Test ia64 memory leaks of the code using libunwind.
@ -428,7 +428,7 @@ Patch393: gdb-rhel5-gcc44.patch
Patch397: gdb-follow-child-stale-parent.patch
# Workaround ccache making lineno non-zero for command-line definitions.
#=drop: ccache is rarely used and it is even fixed now.
#=fedoratest: ccache is rarely used and it is even fixed now.
Patch403: gdb-ccache-workaround.patch
# Implement `info common' for Fortran.
@ -445,10 +445,6 @@ Patch407: gdb-lineno-makeup-test.patch
#=fedoratest+ppc
Patch408: gdb-ppc-power7-test.patch
# Revert: Add -Wunused-function to compile flags.
#=drop
Patch412: gdb-unused-revert.patch
# Fix i386+x86_64 rwatch+awatch before run, regression against 6.8 (BZ 541866).
# Fix i386 rwatch+awatch before run (BZ 688788, on top of BZ 541866).
#=push+work: It should be fixed properly instead.
@ -466,18 +462,12 @@ Patch470: gdb-archer-next-over-throw-cxx-exec.patch
#=fedoratest
Patch475: gdb-bz601887-dwarf4-rh-test.patch
# Print 2D C++ vectors as matrices (BZ 562763, sourceware10659, Chris Moller).
#=push+work: There are some outstanding issues, check the mails.
Patch486: gdb-bz562763-pretty-print-2d-vectors.patch
#=push+work: There are some outstanding issues, check the mails.
Patch487: gdb-bz562763-pretty-print-2d-vectors-libstdcxx.patch
# [delayed-symfile] Test a backtrace regression on CFIs without DIE (BZ 614604).
#=fedoratest
Patch490: gdb-test-bt-cfi-without-die.patch
# Provide /usr/bin/gdb-add-index for rpm-build (Tom Tromey).
#=drop: Re-check against the upstream version.
#=fedora: Re-check against the upstream version.
Patch491: gdb-gdb-add-index-script.patch
# Out of memory is just an error, not fatal (uninitialized VLS vars, BZ 568248).
@ -534,7 +524,7 @@ Patch619: gdb-dlopen-stap-probe-test.patch
Patch627: gdb-glibc-vdso-workaround.patch
# Hack for proper PIE run of the testsuite.
#=push+work
#=fedoratest
Patch634: gdb-runtest-pie-override.patch
# Work around readline-6.2 incompatibility not asking for --more-- (BZ 701131).
@ -545,29 +535,10 @@ Patch642: gdb-readline62-ask-more-rh.patch
#=push
Patch643: gdb-python-rdynamic.patch
# Improve performance for C++ symbols expansion (Tom Tromey, BZ 787487).
#=push
Patch644: gdb-expand-cxx-accel.patch
# Fix skipping of prologues on RHEL-5 gcc-4.1 -O2 -g code (BZ 797889).
#=push
Patch645: gdb-prologue-not-skipped.patch
# Fix breakpoint warning during 'next' over exit() (Tom Tromey, BZ 797892).
#=push
Patch646: gdb-exit-warning.patch
# [vla] Fix crash for dynamic.exp with gcc-gfortran-4.1.2-51.el5.x86_64.
#=push+work
Patch648: gdb-archer-vla-rhel5gcc.patch
# Print reasons for failed attach/spawn incl. SELinux deny_ptrace (BZ 786878).
#=push
Patch649: gdb-attach-fail-reasons-1of5.patch
Patch650: gdb-attach-fail-reasons-2of5.patch
Patch651: gdb-attach-fail-reasons-3of5.patch
Patch652: gdb-attach-fail-reasons-4of5.patch
Patch653: gdb-attach-fail-reasons-5of5.patch
#=fedora
Patch657: gdb-attach-fail-reasons-5of5configure.patch
# Fix inferior calls, particularly uncaught thrown exceptions (BZ 799531).
@ -575,55 +546,20 @@ Patch657: gdb-attach-fail-reasons-5of5configure.patch
Patch654: gdb-x86-onstack-1of2.patch
Patch658: gdb-x86-onstack-2of2.patch
# Fix DWARF DIEs CU vs. section relative offsets (Joel Brobecker, me).
#=push
Patch655: gdb-die-cu-offset-1of2.patch
Patch656: gdb-die-cu-offset-2of2.patch
# [vla] Fix regression on no type for subrange from IBM XLF Fortran (BZ 806920).
#=push
Patch660: gdb-subrange-no-type.patch
# Workaround crashes from stale frame_info pointer (BZ 804256).
#=push+work
Patch661: gdb-stale-frame_info.patch
# Security fix for loading untrusted inferiors, see "set auto-load" (BZ 756117).
#=push
Patch662: gdb-autoload-01of28.patch
Patch663: gdb-autoload-02of28.patch
Patch664: gdb-autoload-03of28.patch
Patch665: gdb-autoload-04of28.patch
Patch666: gdb-autoload-05of28.patch
Patch667: gdb-autoload-06of28.patch
Patch668: gdb-autoload-07of28.patch
Patch669: gdb-autoload-08of28.patch
Patch670: gdb-autoload-09of28.patch
Patch671: gdb-autoload-10of28.patch
Patch672: gdb-autoload-11of28.patch
Patch673: gdb-autoload-12of28.patch
Patch674: gdb-autoload-13of28.patch
Patch675: gdb-autoload-14of28.patch
Patch676: gdb-autoload-15of28.patch
Patch677: gdb-autoload-16of28.patch
Patch678: gdb-autoload-17of28.patch
Patch679: gdb-autoload-18of28.patch
Patch680: gdb-autoload-19of28.patch
Patch681: gdb-autoload-20of28.patch
Patch682: gdb-autoload-21of28.patch
Patch683: gdb-autoload-22of28.patch
Patch684: gdb-autoload-23of28.patch
Patch685: gdb-autoload-24of28.patch
Patch686: gdb-autoload-25of28.patch
Patch687: gdb-autoload-26of28.patch
Patch688: gdb-autoload-27of28.patch
Patch689: gdb-autoload-28of28.patch
# Workaround PR libc/14166 for inferior calls of strstr.
#=push+work: But push it to glibc.
Patch690: gdb-glibc-strstr-workaround.patch
# [ppc] Fix hardware watchpoints on PowerPC (BZ 827600, Edjunior Machado).
Patch691: gdb-ppc-watchpoint.patch
# Fix dejagnu-1.5-4.fc17 compatibility for Go (for BZ 635651).
#=fedoratest
Patch692: gdb-dejagnu-go.patch
# Revert recent breakage of UNIX objfiles order for symbols lookup.
Patch693: gdb-objfile-order.patch
%if 0%{!?rhel:1} || 0%{?rhel} > 6
# RL_STATE_FEDORA_GDB would not be found for:
@ -682,6 +618,9 @@ ExclusiveArch: noarch i386 x86_64 ppc ppc64 ia64 s390 s390x
BuildRequires: sharutils dejagnu
# gcc-objc++ is not covered by the GDB testsuite.
BuildRequires: gcc gcc-c++ gcc-gfortran gcc-java gcc-objc
%if 0%{!?rhel:1} || 0%{?scl:1} || 0%{?rhel} > 6
BuildRequires: gcc-go
%endif
# archer-sergiodj-stap-patch-split
BuildRequires: systemtap-sdt-devel
# Copied from prelink-0.4.2-3.fc13.
@ -707,6 +646,9 @@ BuildRequires: libgcc%{bits_local} libgcc%{bits_other}
# libstdc++-devel of matching bits is required only for g++ -static.
BuildRequires: libstdc++%{bits_local} libstdc++%{bits_other}
BuildRequires: libgcj%{bits_local} libgcj%{bits_other}
%if 0%{!?rhel:1} || 0%{?scl:1} || 0%{?rhel} > 6
BuildRequires: libgo-devel%{bits_local} libgo-devel%{bits_other}
%endif
%if 0%{!?el5:1}
BuildRequires: glibc-static%{bits_local}
%endif
@ -875,12 +817,10 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch394 -p1
%patch407 -p1
%patch408 -p1
%patch412 -p1
%patch417 -p1
%patch459 -p1
%patch470 -p1
%patch475 -p1
%patch486 -p1
%patch415 -p1
%patch519 -p1
%patch490 -p1
@ -899,60 +839,19 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch627 -p1
%patch634 -p1
%patch643 -p1
%patch644 -p1
%patch645 -p1
%patch646 -p1
%patch648 -p1
%patch649 -p1
%patch650 -p1
%patch651 -p1
%patch652 -p1
%patch653 -p1
%patch657 -p1
%patch654 -p1
%patch658 -p1
%patch655 -p1
%patch656 -p1
%patch660 -p1
%patch661 -p1
%patch662 -p1
%patch663 -p1
%patch664 -p1
%patch665 -p1
%patch666 -p1
%patch667 -p1
%patch668 -p1
%patch669 -p1
%patch670 -p1
%patch671 -p1
%patch672 -p1
%patch673 -p1
%patch674 -p1
%patch675 -p1
%patch676 -p1
%patch677 -p1
%patch678 -p1
%patch679 -p1
%patch680 -p1
%patch681 -p1
%patch682 -p1
%patch683 -p1
%patch684 -p1
%patch685 -p1
%patch686 -p1
%patch687 -p1
%patch688 -p1
%patch689 -p1
%patch690 -p1
%patch691 -p1
%patch692 -p1
%patch693 -p1
%patch393 -p1
%if 0%{!?el5:1} || 0%{?scl:1}
%patch393 -p1 -R
%endif
%if 0%{?rhel:1} && 0%{?rhel} <= 6
%patch487 -p1
%endif
%patch642 -p1
%if 0%{?rhel:1} && 0%{?rhel} <= 6
%patch642 -p1 -R
@ -1049,7 +948,7 @@ $(: RHEL-5 librpm has incompatible API. ) \
%if 0%{?el6:1}
--with-rpm=librpm.so.1 \
%else
--with-rpm=librpm.so.2 \
--with-rpm=librpm.so.3 \
%endif
%endif
%ifarch ia64
@ -1437,6 +1336,14 @@ fi
%endif # 0%{!?el5:1} || "%{_target_cpu}" == "noarch"
%changelog
* Sun Jun 3 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120602-1.fc18
- Rebase to FSF GDB 7.4.50.20120602.
- [testsuite] BuildRequire gcc-go.
- Drop printing 2D C++ vectors as matrices which no longer worked (BZ 562763).
- Fix dejagnu-1.5-4.fc17 compatibility for Go (for BZ 635651).
- Use librpm.so.3 for rpm-4.10.0 in Fedora 18.
- Revert recent breakage of UNIX objfiles order for symbols lookup.
* Sat Jun 2 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-48.fc17
- [ppc] Fix hardware watchpoints on PowerPC (BZ 827600, Edjunior Machado).

View File

@ -1,2 +1,2 @@
04e5c4b1b9e633422cc48990fe61958d libstdc++-v3-python-r155978.tar.bz2
9de84a22e4b96c08d8d31a72d7751c60 gdb-7.4.50.20120120.tar.bz2
2a3a88cc2e92aaaf50f7584331094ad3 gdb-7.4.50.20120602.tar.bz2