[scl] Disable Python frame filters on scl.

- Update libraries opening performance fix from upstream.
- Fix C++ lookups performance regression (Doug Evans, BZ 972677).
This commit is contained in:
Jan Kratochvil 2013-06-10 15:04:37 +02:00
parent a5cf0a66f1
commit 19d4458238
14 changed files with 1562 additions and 1285 deletions

View File

@ -0,0 +1,209 @@
http://sourceware.org/ml/gdb-cvs/2013-06/msg00034.html
### src/gdb/ChangeLog 2013/06/05 20:43:53 1.15689
### src/gdb/ChangeLog 2013/06/05 22:28:51 1.15690
## -1,3 +1,14 @@
+2013-06-05 Doug Evans <dje@google.com>
+ Keith Seitz <keiths@redhat.com>
+
+ PR 15519
+ * cp-namespace.c (find_symbol_in_baseclass): Call
+ cp_lookup_symbol_in_namespace instead of cp_lookup_symbol_namespace.
+ Check result of call to lookup_symbol_static.
+ Call lookup_static_symbol_aux unconditionally.
+ Call check_typedef on base types before accessing them.
+ (cp_lookup_nested_symbol): Fix comment.
+
2013-06-05 Luis Machado <lgustavo@codesourcery.com>
* gnu-v3-abi.c (gnuv3_skip_trampoline): Handle thunk
--- src/gdb/cp-namespace.c 2013/05/30 17:29:06 1.67
+++ src/gdb/cp-namespace.c 2013/06/05 22:28:51 1.68
@@ -720,36 +720,40 @@
for (i = 0; i < TYPE_N_BASECLASSES (parent_type); ++i)
{
size_t len;
+ struct type *base_type = TYPE_BASECLASS (parent_type, i);
const char *base_name = TYPE_BASECLASS_NAME (parent_type, i);
if (base_name == NULL)
continue;
/* Search this particular base class. */
- sym = cp_lookup_symbol_namespace (base_name, name, block, VAR_DOMAIN);
+ sym = cp_lookup_symbol_in_namespace (base_name, name, block,
+ VAR_DOMAIN, 0);
if (sym != NULL)
break;
+ /* Now search all static file-level symbols. We have to do this for
+ things like typedefs in the class. First search in this symtab,
+ what we want is possibly there. */
len = strlen (base_name) + 2 + strlen (name) + 1;
concatenated_name = xrealloc (concatenated_name, len);
xsnprintf (concatenated_name, len, "%s::%s", base_name, name);
sym = lookup_symbol_static (concatenated_name, block, VAR_DOMAIN);
+ if (sym != NULL)
+ break;
- /* If there is currently no BLOCK, e.g., the inferior hasn't yet
- been started, then try searching all STATIC_BLOCK symbols in
- all objfiles. */
- if (block == NULL)
- {
- sym = lookup_static_symbol_aux (concatenated_name, VAR_DOMAIN);
- if (sym != NULL)
- break;
- }
+ /* Nope. We now have to search all static blocks in all objfiles,
+ even if block != NULL, because there's no guarantees as to which
+ symtab the symbol we want is in. */
+ sym = lookup_static_symbol_aux (concatenated_name, VAR_DOMAIN);
+ if (sym != NULL)
+ break;
/* If this class has base classes, search them next. */
- if (TYPE_N_BASECLASSES (TYPE_BASECLASS (parent_type, i)) > 0)
+ CHECK_TYPEDEF (base_type);
+ if (TYPE_N_BASECLASSES (base_type) > 0)
{
- sym = find_symbol_in_baseclass (TYPE_BASECLASS (parent_type, i),
- name, block);
+ sym = find_symbol_in_baseclass (base_type, name, block);
if (sym != NULL)
break;
}
@@ -797,8 +801,8 @@
if (sym != NULL)
return sym;
- /* Now search all static file-level symbols. Not strictly
- correct, but more useful than an error. We do not try to
+ /* Now search all static file-level symbols. We have to do this
+ for things like typedefs in the class. We do not try to
guess any imported namespace as even the fully specified
namespace search is already not C++ compliant and more
assumptions could make it too magic. */
### src/gdb/testsuite/ChangeLog 2013/06/05 20:38:37 1.3685
### src/gdb/testsuite/ChangeLog 2013/06/05 22:28:51 1.3686
## -1,3 +1,11 @@
+2013-06-05 Doug Evans <dje@google.com>
+ Keith Seitz <keiths@redhat.com>
+
+ * gdb.cp/derivation2.cc: New file.
+ * gdb.cp/derivation.cc (main): Call foo2.
+ * gdb.cp/derivation.exp: Add tests for typedefs in another
+ file, and when there's an active block.
+
2013-06-05 Luis Machado <lgustavo@codesourcery.com>
* gdb.cp/virtfunc.exp (make_one_vtable_result): Handle extra output
--- src/gdb/testsuite/gdb.cp/derivation2.cc
+++ src/gdb/testsuite/gdb.cp/derivation2.cc 2013-06-10 12:35:14.881272247 +0000
@@ -0,0 +1,49 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2013 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/>.
+ */
+
+/* A copy of some classes in derivation.cc so that we can test symbol lookup
+ in other CUs. */
+
+class A2 {
+public:
+ typedef int value_type;
+ value_type a;
+
+ A2()
+ {
+ a=1;
+ }
+};
+
+class D2 : public A2 {
+public:
+ value_type d;
+
+ D2()
+ {
+ d=7;
+ }
+};
+
+void
+foo2 ()
+{
+ D2 d2_instance;
+ d2_instance.a = 42;
+ d2_instance.d = 43;
+}
--- src/gdb/testsuite/gdb.cp/derivation.cc 2013/01/01 06:33:27 1.5
+++ src/gdb/testsuite/gdb.cp/derivation.cc 2013/06/05 22:28:51 1.6
@@ -16,6 +16,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+extern void foo2 (); /* from derivation2.cc */
+
namespace N {
typedef double value_type;
struct Base { typedef int value_type; };
@@ -306,9 +308,7 @@
N::Derived::value_type d = 1;
N::value_type n = 3.0;
dobj.doit ();
+ foo2 ();
return 0;
}
-
-
-
--- src/gdb/testsuite/gdb.cp/derivation.exp 2013/01/01 06:33:27 1.24
+++ src/gdb/testsuite/gdb.cp/derivation.exp 2013/06/05 22:28:51 1.25
@@ -32,14 +32,15 @@
load_lib "cp-support.exp"
-standard_testfile .cc
+standard_testfile derivation.cc derivation2.cc
-if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
+if {[prepare_for_testing $testfile.exp $testfile \
+ [list $srcfile $srcfile2] {debug c++}]} {
return -1
}
# Check inheritance of typedefs.
-foreach klass {"A" "D" "E" "F"} {
+foreach klass {"A" "D" "E" "F" "A2" "D2"} {
gdb_test "ptype ${klass}::value_type" "type = int"
gdb_test "whatis ${klass}::value_type" "type = int"
gdb_test "p (${klass}::value_type) 0" " = 0"
@@ -57,6 +58,13 @@
continue
}
+# Check inheritance of typedefs again, but this time with an active block.
+foreach klass {"A" "D" "A2" "D2"} {
+ gdb_test "ptype ${klass}::value_type" "type = int"
+ gdb_test "whatis ${klass}::value_type" "type = int"
+ gdb_test "p (${klass}::value_type) 0" " = 0"
+}
+
gdb_test "up" ".*main.*" "up from marker1"
# Print class types and values.

View File

@ -0,0 +1,58 @@
http://sourceware.org/ml/gdb-cvs/2013-06/msg00044.html
### src/gdb/testsuite/ChangeLog 2013/06/06 19:00:13 1.3688
### src/gdb/testsuite/ChangeLog 2013/06/06 19:02:26 1.3689
## -1,3 +1,7 @@
+2013-06-06 Doug Evans <dje@google.com>
+
+ * gdb.cp/derivation.exp: Make tests have unique names.
+
2013-06-06 Tom Tromey <tromey@redhat.com>
* gdb.base/dump.exp (capture_value): Don't put expression into
--- src/gdb/testsuite/gdb.cp/derivation.exp 2013/06/05 22:28:51 1.25
+++ src/gdb/testsuite/gdb.cp/derivation.exp 2013/06/06 19:02:27 1.26
@@ -40,15 +40,17 @@
}
# Check inheritance of typedefs.
-foreach klass {"A" "D" "E" "F" "A2" "D2"} {
- gdb_test "ptype ${klass}::value_type" "type = int"
- gdb_test "whatis ${klass}::value_type" "type = int"
- gdb_test "p (${klass}::value_type) 0" " = 0"
-}
-foreach klass {"Z" "ZZ"} {
- gdb_test "ptype ${klass}::value_type" "type = float"
- gdb_test "whatis ${klass}::value_type" "type = float"
- gdb_test "p (${klass}::value_type) 0" " = 0"
+with_test_prefix "before run" {
+ foreach klass {"A" "D" "E" "F" "A2" "D2"} {
+ gdb_test "ptype ${klass}::value_type" "type = int"
+ gdb_test "whatis ${klass}::value_type" "type = int"
+ gdb_test "p (${klass}::value_type) 0" " = 0"
+ }
+ foreach klass {"Z" "ZZ"} {
+ gdb_test "ptype ${klass}::value_type" "type = float"
+ gdb_test "whatis ${klass}::value_type" "type = float"
+ gdb_test "p (${klass}::value_type) 0" " = 0"
+ }
}
# Set it up at a breakpoint so we can play with the variable values.
@@ -59,10 +61,12 @@
}
# Check inheritance of typedefs again, but this time with an active block.
-foreach klass {"A" "D" "A2" "D2"} {
- gdb_test "ptype ${klass}::value_type" "type = int"
- gdb_test "whatis ${klass}::value_type" "type = int"
- gdb_test "p (${klass}::value_type) 0" " = 0"
+with_test_prefix "at marker1" {
+ foreach klass {"A" "D" "A2" "D2"} {
+ gdb_test "ptype ${klass}::value_type" "type = int"
+ gdb_test "whatis ${klass}::value_type" "type = int"
+ gdb_test "p (${klass}::value_type) 0" " = 0"
+ }
}
gdb_test "up" ".*main.*" "up from marker1"

View File

@ -1,55 +1,22 @@
http://sourceware.org/ml/gdb-patches/2013-05/msg00625.html
Subject: [RFA 1/7] Probes API convenience patch
http://sourceware.org/ml/gdb-cvs/2013-06/msg00012.html
--uuKVzAmB+c+zQlhu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
This patch exposes part of the probes API in a more convenient
way. I've included it for completeness, but it has previously
been approved:
http://www.cygwin.com/ml/gdb-patches/2012-07/msg00340.html
--uuKVzAmB+c+zQlhu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="rtld-probes-1-convenience.patch"
2013-05-16 Gary Benson <gbenson@redhat.com>
* probe.h (get_probe_argument_count): New declaration.
(evaluate_probe_argument): Likewise.
* probe.c (get_probe_argument_count): New function.
(evaluate_probe_argument): Likewise.
(probe_safe_evaluate_at_pc): Use the above new functions.
diff --git a/gdb/probe.h b/gdb/probe.h
index 8d44ca2..1d29b87 100644
--- a/gdb/probe.h
+++ b/gdb/probe.h
@@ -214,6 +214,16 @@ extern void info_probes_for_ops (char *arg, int from_tty,
### src/gdb/ChangeLog 2013/06/04 02:44:34 1.15680
### src/gdb/ChangeLog 2013/06/04 12:50:20 1.15681
## -1,3 +1,11 @@
+2013-06-04 Gary Benson <gbenson@redhat.com>
+
+ * probe.h (get_probe_argument_count): New declaration.
+ (evaluate_probe_argument): Likewise.
+ * probe.c (get_probe_argument_count): New function.
+ (evaluate_probe_argument): Likewise.
+ (probe_safe_evaluate_at_pc): Use the above new functions.
+
2013-06-04 Alan Modra <amodra@gmail.com>
extern struct cmd_list_element **info_probes_cmdlist_get (void);
+/* Return the argument count of the specified probe. */
+
+extern unsigned get_probe_argument_count (struct probe *probe);
+
+/* Evaluate argument N of the specified probe. N must be between 0
+ inclusive and get_probe_argument_count exclusive. */
+
+extern struct value *evaluate_probe_argument (struct probe *probe,
+ unsigned n);
+
/* A convenience function that finds a probe at the PC in FRAME and
evaluates argument N, with 0 <= N < number_of_args. If there is no
probe at that location, or if the probe does not have enough arguments,
diff --git a/gdb/probe.c b/gdb/probe.c
index 77f3b13..a61f4ea 100644
--- a/gdb/probe.c
+++ b/gdb/probe.c
@@ -608,28 +608,55 @@ info_probes_command (char *arg, int from_tty)
* ppc-tdep.h (ppc_insns_match_pattern): Update prototype.
--- src/gdb/probe.c 2013/05/30 17:39:34 1.8
+++ src/gdb/probe.c 2013/06/04 12:50:20 1.9
@@ -611,28 +611,55 @@
/* See comments in probe.h. */
@ -114,6 +81,22 @@ index 77f3b13..a61f4ea 100644
}
/* See comment in probe.h. */
--uuKVzAmB+c+zQlhu--
--- src/gdb/probe.h 2013/01/01 06:32:49 1.4
+++ src/gdb/probe.h 2013/06/04 12:50:21 1.5
@@ -214,6 +214,16 @@
extern struct cmd_list_element **info_probes_cmdlist_get (void);
+/* Return the argument count of the specified probe. */
+
+extern unsigned get_probe_argument_count (struct probe *probe);
+
+/* Evaluate argument N of the specified probe. N must be between 0
+ inclusive and get_probe_argument_count exclusive. */
+
+extern struct value *evaluate_probe_argument (struct probe *probe,
+ unsigned n);
+
/* A convenience function that finds a probe at the PC in FRAME and
evaluates argument N, with 0 <= N < number_of_args. If there is no
probe at that location, or if the probe does not have enough arguments,

View File

@ -1,74 +1,35 @@
http://sourceware.org/ml/gdb-patches/2013-05/msg00627.html
Subject: [RFA 2/7] API for inhibiting section map updates
http://sourceware.org/ml/gdb-cvs/2013-06/msg00013.html
--bPg9NdpM9EETxvqt
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
This patch adds a couple of functions to allow section map updates
to be temporarily inhibited. Without this ability, the calls to
evaluate_probe_argument in svr4_handle_solib_event trigger a section
map update every time a group of shared objects are mapped, which
significantly affects performance. The updates are unnecessary in
this case as the sections in question are in the runtime linker and
so already in the section map.
--bPg9NdpM9EETxvqt
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="rtld-probes-2-inhibit-sm-updates.patch"
2013-05-16 Gary Benson <gbenson@redhat.com>
* objfiles.h (inhibit_section_map_updates): New function
declaration.
(resume_section_map_updates): Likewise.
(resume_section_map_updates_cleanup): Likewise.
* objfiles.c (objfile_pspace_info): Removed field
"objfiles_changed_p". New fields "new_objfiles_available",
"section_map_dirty" and "inhibit_updates".
(allocate_objfile): Set new_objfiles_available.
(free_objfile): Set section_map_dirty.
(objfile_relocate1): Likewise.
(in_plt_section): Likewise.
(find_pc_section): Update the conditions under which the
section map will be updated.
(inhibit_section_map_updates): New function.
(resume_section_map_updates): Likewise.
(resume_section_map_updates_cleanup): Likewise.
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 93149e2..0b7eea9 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -501,6 +501,22 @@ extern int in_plt_section (CORE_ADDR, char *);
modules. */
DECLARE_REGISTRY(objfile);
### src/gdb/ChangeLog 2013/06/04 12:50:20 1.15681
### src/gdb/ChangeLog 2013/06/04 12:53:33 1.15682
## -1,5 +1,24 @@
2013-06-04 Gary Benson <gbenson@redhat.com>
+/* In normal use, the section map will be rebuilt by FIND_PC_SECTION
+ if objfiles have been added, removed or relocated since it was last
+ called. Calling INHIBIT_SECTION_MAP_UPDATES will inhibit this
+ behavior until RESUME_SECTION_MAP_UPDATES is called. If you call
+ INHIBIT_SECTION_MAP_UPDATES you must ensure that every call to
+ FIND_PC_SECTION in the inhibited region relates to a section that
+ is already in the section map and has not since been removed or
+ relocated. */
+extern void inhibit_section_map_updates (void);
+ * objfiles.h (inhibit_section_map_updates): New function
+ declaration.
+ (resume_section_map_updates): Likewise.
+ (resume_section_map_updates_cleanup): Likewise.
+ * objfiles.c (objfile_pspace_info): Removed field
+ "objfiles_changed_p". New fields "new_objfiles_available",
+ "section_map_dirty" and "inhibit_updates".
+ (allocate_objfile): Set new_objfiles_available.
+ (free_objfile): Set section_map_dirty.
+ (objfile_relocate1): Likewise.
+ (in_plt_section): Likewise.
+ (find_pc_section): Update the conditions under which the
+ section map will be updated.
+ (inhibit_section_map_updates): New function.
+ (resume_section_map_updates): Likewise.
+ (resume_section_map_updates_cleanup): Likewise.
+
+/* Resume automatically rebuilding the section map as required. */
+extern void resume_section_map_updates (void);
+2013-06-04 Gary Benson <gbenson@redhat.com>
+
+/* Version of the above suitable for use as a cleanup. */
+extern void resume_section_map_updates_cleanup (void *arg);
+
extern void default_iterate_over_objfiles_in_search_order
(struct gdbarch *gdbarch,
iterate_over_objfiles_in_search_order_cb_ftype *cb,
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 3e49ea2..3af1064 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -67,9 +67,18 @@ struct objfile *rt_common_objfile; /* For runtime common symbols */
* probe.h (get_probe_argument_count): New declaration.
(evaluate_probe_argument): Likewise.
* probe.c (get_probe_argument_count): New function.
--- src/gdb/objfiles.c 2013/05/06 19:15:17 1.160
+++ src/gdb/objfiles.c 2013/06/04 12:53:34 1.161
@@ -67,9 +67,18 @@
struct objfile_pspace_info
{
@ -88,7 +49,7 @@ index 3e49ea2..3af1064 100644
};
/* Per-program-space data key. */
@@ -317,7 +326,7 @@ allocate_objfile (bfd *abfd, int flags)
@@ -317,7 +326,7 @@
objfile->flags |= flags;
/* Rebuild section map next time we need it. */
@ -97,7 +58,7 @@ index 3e49ea2..3af1064 100644
return objfile;
}
@@ -646,7 +655,7 @@ free_objfile (struct objfile *objfile)
@@ -646,7 +655,7 @@
obstack_free (&objfile->objfile_obstack, 0);
/* Rebuild section map next time we need it. */
@ -106,7 +67,7 @@ index 3e49ea2..3af1064 100644
xfree (objfile);
}
@@ -826,7 +835,7 @@ objfile_relocate1 (struct objfile *objfile,
@@ -826,7 +835,7 @@
}
/* Rebuild section map next time we need it. */
@ -115,7 +76,7 @@ index 3e49ea2..3af1064 100644
/* Update the table in exec_ops, used to read memory. */
ALL_OBJFILE_OSECTIONS (objfile, s)
@@ -1291,11 +1300,14 @@ static void
@@ -1291,11 +1300,14 @@
update_section_map (struct program_space *pspace,
struct obj_section ***pmap, int *pmap_size)
{
@ -125,13 +86,13 @@ index 3e49ea2..3af1064 100644
struct objfile *objfile;
- gdb_assert (get_objfile_pspace_data (pspace)->objfiles_changed_p != 0);
+ pspace_info = get_objfile_pspace_data (current_program_space);
+ pspace_info = get_objfile_pspace_data (pspace);
+ gdb_assert (pspace_info->section_map_dirty != 0
+ || pspace_info->new_objfiles_available != 0);
map = *pmap;
xfree (map);
@@ -1365,7 +1377,9 @@ find_pc_section (CORE_ADDR pc)
@@ -1365,7 +1377,9 @@
return s;
pspace_info = get_objfile_pspace_data (current_program_space);
@ -142,7 +103,7 @@ index 3e49ea2..3af1064 100644
{
update_section_map (current_program_space,
&pspace_info->sections,
@@ -1373,7 +1387,8 @@ find_pc_section (CORE_ADDR pc)
@@ -1373,7 +1387,8 @@
/* Don't need updates to section map until objfiles are added,
removed or relocated. */
@ -152,7 +113,7 @@ index 3e49ea2..3af1064 100644
}
/* The C standard (ISO/IEC 9899:TC2) requires the BASE argument to
@@ -1414,14 +1429,38 @@ in_plt_section (CORE_ADDR pc, char *name)
@@ -1414,14 +1429,38 @@
}
@ -171,17 +132,17 @@ index 3e49ea2..3af1064 100644
+/* See comments in objfiles.h. */
+
+void
+inhibit_section_map_updates (void)
+inhibit_section_map_updates (struct program_space *pspace)
+{
+ get_objfile_pspace_data (current_program_space)->inhibit_updates = 1;
+ get_objfile_pspace_data (pspace)->inhibit_updates = 1;
+}
+
+/* See comments in objfiles.h. */
+
+void
+resume_section_map_updates (void)
+resume_section_map_updates (struct program_space *pspace)
+{
+ get_objfile_pspace_data (current_program_space)->inhibit_updates = 0;
+ get_objfile_pspace_data (pspace)->inhibit_updates = 0;
+}
+
+/* See comments in objfiles.h. */
@ -189,10 +150,32 @@ index 3e49ea2..3af1064 100644
+void
+resume_section_map_updates_cleanup (void *arg)
+{
+ resume_section_map_updates ();
+ resume_section_map_updates (arg);
}
/* The default implementation for the "iterate_over_objfiles_in_search_order"
--bPg9NdpM9EETxvqt--
--- src/gdb/objfiles.h 2013/05/06 19:15:17 1.106
+++ src/gdb/objfiles.h 2013/06/04 12:53:34 1.107
@@ -501,6 +501,22 @@
modules. */
DECLARE_REGISTRY(objfile);
+/* In normal use, the section map will be rebuilt by find_pc_section
+ if objfiles have been added, removed or relocated since it was last
+ called. Calling inhibit_section_map_updates will inhibit this
+ behavior until resume_section_map_updates is called. If you call
+ inhibit_section_map_updates you must ensure that every call to
+ find_pc_section in the inhibited region relates to a section that
+ is already in the section map and has not since been removed or
+ relocated. */
+extern void inhibit_section_map_updates (struct program_space *pspace);
+
+/* Resume automatically rebuilding the section map as required. */
+extern void resume_section_map_updates (struct program_space *pspace);
+
+/* Version of the above suitable for use as a cleanup. */
+extern void resume_section_map_updates_cleanup (void *arg);
+
extern void default_iterate_over_objfiles_in_search_order
(struct gdbarch *gdbarch,
iterate_over_objfiles_in_search_order_cb_ftype *cb,

View File

@ -1,59 +1,23 @@
http://sourceware.org/ml/gdb-patches/2013-05/msg00626.html
Subject: [RFA 3/7] New gdbserver functionality
http://sourceware.org/ml/gdb-cvs/2013-06/msg00014.html
--Kc9HNjpzOXVc7FFU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
This patch updates gdbserver to allow arguments to be passed in the
annex of qXfer:libraries-svr4:read to allow that function to transfer
partial lists of libraries. The ability of gdbserver to support
these arguments is indicated by a qSupported response containing
"augmented-libraries-svr4-read+".
--Kc9HNjpzOXVc7FFU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="rtld-probes-3-gdbserver.patch"
2013-05-16 Gary Benson <gbenson@redhat.com>
* server.c (handle_query): Add "augmented-libraries-svr4-read+"
to qSupported response when appropriate.
(handle_qxfer_libraries_svr4): Allow qXfer:libraries-svr4:read
with nonzero-length annex.
* linux-low.c (linux_qxfer_libraries_svr4): Parse and handle
arguments supplied in annex.
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 6bb36d8..0a8f68b 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -1115,8 +1115,7 @@ handle_qxfer_libraries_svr4 (const char *annex,
if (writebuf != NULL)
return -2;
### src/gdb/gdbserver/ChangeLog 2013/05/31 19:14:33 1.720
### src/gdb/gdbserver/ChangeLog 2013/06/04 12:59:20 1.721
## -1,3 +1,12 @@
+2013-06-04 Gary Benson <gbenson@redhat.com>
+
+ * server.c (handle_query): Add "augmented-libraries-svr4-read+"
+ to qSupported response when appropriate.
+ (handle_qxfer_libraries_svr4): Allow qXfer:libraries-svr4:read
+ with nonzero-length annex.
+ * linux-low.c (linux_qxfer_libraries_svr4): Parse and handle
+ arguments supplied in annex.
+
2013-05-31 Doug Evans <dje@google.com>
- if (annex[0] != '\0' || !target_running ()
- || the_target->qxfer_libraries_svr4 == NULL)
+ if (!target_running () || the_target->qxfer_libraries_svr4 == NULL)
return -1;
return the_target->qxfer_libraries_svr4 (annex, readbuf, writebuf, offset, len);
@@ -1743,7 +1742,8 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
PBUFSIZ - 1);
if (the_target->qxfer_libraries_svr4 != NULL)
- strcat (own_buf, ";qXfer:libraries-svr4:read+");
+ strcat (own_buf, ";qXfer:libraries-svr4:read+"
+ ";augmented-libraries-svr4-read+");
else
{
/* We do not have any hook to indicate whether the non-SVR4 target
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 72c51e0..beb3b8f 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -5677,6 +5677,12 @@ linux_qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf,
* linux-x86-low.c (ps_get_thread_area): Properly extend address to
--- src/gdb/gdbserver/linux-low.c 2013/05/23 17:17:50 1.237
+++ src/gdb/gdbserver/linux-low.c 2013/06/04 12:59:21 1.238
@@ -5728,6 +5728,12 @@
};
const struct link_map_offsets *lmo;
unsigned int machine;
@ -66,7 +30,7 @@ index 72c51e0..beb3b8f 100644
if (writebuf != NULL)
return -2;
@@ -5687,128 +5693,146 @@ linux_qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf,
@@ -5738,128 +5744,144 @@
xsnprintf (filename, sizeof filename, "/proc/%d/exe", pid);
is_elf64 = elf_64_file_p (filename, &machine);
lmo = is_elf64 ? &lmo_64bit_offsets : &lmo_32bit_offsets;
@ -74,45 +38,44 @@ index 72c51e0..beb3b8f 100644
- if (priv->r_debug == 0)
- priv->r_debug = get_r_debug (pid, is_elf64);
+ if (annex[0] == '\0')
+ {
+ int r_version = 0;
-
- /* We failed to find DT_DEBUG. Such situation will not change for this
- inferior - do not retry it. Report it to GDB as E01, see for the reasons
- at the GDB solib-svr4.c side. */
- if (priv->r_debug == (CORE_ADDR) -1)
- return -1;
+ if (priv->r_debug == 0)
+ priv->r_debug = get_r_debug (pid, is_elf64);
-
- if (priv->r_debug == 0)
- {
+ while (annex[0] != '\0')
{
- document = xstrdup ("<library-list-svr4 version=\"1.0\"/>\n");
+ /* We failed to find DT_DEBUG. Such situation will not change
+ for this inferior - do not retry it. Report it to GDB as
+ E01, see for the reasons at the GDB solib-svr4.c side. */
+ if (priv->r_debug == (CORE_ADDR) -1)
+ return -1;
+ const char *sep;
+ CORE_ADDR *addrp;
+ int len;
+
+ if (priv->r_debug != 0)
+ sep = strchr (annex, '=');
+ if (sep == NULL)
+ break;
+
+ len = sep - annex;
+ if (len == 5 && strncmp (annex, "start", 5) == 0)
+ addrp = &lm_addr;
+ else if (len == 4 && strncmp (annex, "prev", 4) == 0)
+ addrp = &lm_prev;
+ else
+ {
+ if (linux_read_memory (priv->r_debug + lmo->r_version_offset,
+ (unsigned char *) &r_version,
+ sizeof (r_version)) != 0
+ || r_version != 1)
+ {
+ warning ("unexpected r_debug version %d", r_version);
+ }
+ else if (read_one_ptr (priv->r_debug + lmo->r_map_offset,
+ &lm_addr, ptr_size) != 0)
+ {
+ warning ("unable to read r_map from 0x%lx",
+ (long) priv->r_debug + lmo->r_map_offset);
+ }
+ annex = strchr (sep, ';');
+ if (annex == NULL)
+ break;
+ annex++;
+ continue;
+ }
+
+ annex = decode_address_to_semicolon (addrp, sep + 1);
}
else
- else
+
+ if (lm_addr == 0)
{
- int allocated = 1024;
- char *p;
@ -129,38 +92,37 @@ index 72c51e0..beb3b8f 100644
- (unsigned char *) &r_version,
- sizeof (r_version)) != 0
- || r_version != 1)
+ while (annex[0] != '\0')
+ int r_version = 0;
+
+ if (priv->r_debug == 0)
+ priv->r_debug = get_r_debug (pid, is_elf64);
+
+ /* We failed to find DT_DEBUG. Such situation will not change
+ for this inferior - do not retry it. Report it to GDB as
+ E01, see for the reasons at the GDB solib-svr4.c side. */
+ if (priv->r_debug == (CORE_ADDR) -1)
+ return -1;
+
+ if (priv->r_debug != 0)
{
- warning ("unexpected r_debug version %d", r_version);
- goto done;
+ const char *sep;
+ CORE_ADDR *addrp;
+ int len;
+
+ sep = strchr (annex, '=');
+ if (!sep)
+ break;
+
+ len = sep - annex;
+ if (len == 5 && !strncmp (annex, "start", 5))
+ addrp = &lm_addr;
+ else if (len == 4 && !strncmp (annex, "prev", 4))
+ addrp = &lm_prev;
+ else
+ if (linux_read_memory (priv->r_debug + lmo->r_version_offset,
+ (unsigned char *) &r_version,
+ sizeof (r_version)) != 0
+ || r_version != 1)
+ {
+ annex = strchr (sep, ';');
+ if (!annex)
+ break;
+ annex++;
+ continue;
+ warning ("unexpected r_debug version %d", r_version);
+ }
+ else if (read_one_ptr (priv->r_debug + lmo->r_map_offset,
+ &lm_addr, ptr_size) != 0)
+ {
+ warning ("unable to read r_map from 0x%lx",
+ (long) priv->r_debug + lmo->r_map_offset);
+ }
+
+ annex = decode_address_to_semicolon (addrp, sep + 1);
}
+ }
- if (read_one_ptr (priv->r_debug + lmo->r_map_offset,
- &lm_addr, ptr_size) != 0)
+
+ document = xmalloc (allocated);
+ strcpy (document, "<library-list-svr4 version=\"1.0\"");
+ p = document + strlen (document);
@ -178,7 +140,9 @@ index 72c51e0..beb3b8f 100644
+ &l_next, ptr_size) == 0)
+ {
+ unsigned char libname[PATH_MAX];
+
- if (read_one_ptr (priv->r_debug + lmo->r_map_offset,
- &lm_addr, ptr_size) != 0)
+ if (lm_prev != l_prev)
{
- warning ("unable to read r_map from 0x%lx",
@ -251,9 +215,7 @@ index 72c51e0..beb3b8f 100644
- allocated *= 2;
- p = document + document_len;
- }
+ /* Expand to guarantee sufficient storage. */
+ uintptr_t document_len = p - document;
-
- name = xml_escape_text ((char *) libname);
- p += sprintf (p, "<library name=\"%s\" lm=\"0x%lx\" "
- "l_addr=\"0x%lx\" l_ld=\"0x%lx\"/>",
@ -265,14 +227,17 @@ index 72c51e0..beb3b8f 100644
- {
- sprintf (p, " main-lm=\"0x%lx\"", (unsigned long) lm_addr);
- p = p + strlen (p);
+ document = xrealloc (document, 2 * allocated);
+ allocated *= 2;
+ p = document + document_len;
}
- }
+ /* Expand to guarantee sufficient storage. */
+ uintptr_t document_len = p - document;
- if (l_next == 0)
- break;
-
+ document = xrealloc (document, 2 * allocated);
+ allocated *= 2;
+ p = document + document_len;
+ }
- lm_prev = lm_addr;
- lm_addr = l_next;
+ name = xml_escape_text ((char *) libname);
@ -309,6 +274,25 @@ index 72c51e0..beb3b8f 100644
document_len = strlen (document);
if (offset < document_len)
document_len -= offset;
--Kc9HNjpzOXVc7FFU--
--- src/gdb/gdbserver/server.c 2013/05/24 11:28:06 1.191
+++ src/gdb/gdbserver/server.c 2013/06/04 12:59:21 1.192
@@ -1115,8 +1115,7 @@
if (writebuf != NULL)
return -2;
- if (annex[0] != '\0' || !target_running ()
- || the_target->qxfer_libraries_svr4 == NULL)
+ if (!target_running () || the_target->qxfer_libraries_svr4 == NULL)
return -1;
return the_target->qxfer_libraries_svr4 (annex, readbuf, writebuf, offset, len);
@@ -1743,7 +1742,8 @@
PBUFSIZ - 1);
if (the_target->qxfer_libraries_svr4 != NULL)
- strcat (own_buf, ";qXfer:libraries-svr4:read+");
+ strcat (own_buf, ";qXfer:libraries-svr4:read+"
+ ";augmented-libraries-svr4-read+");
else
{
/* We do not have any hook to indicate whether the non-SVR4 target

View File

@ -0,0 +1,35 @@
http://sourceware.org/ml/gdb-cvs/2013-06/msg00015.html
### src/gdb/ChangeLog 2013/06/04 12:53:33 1.15682
### src/gdb/ChangeLog 2013/06/04 13:02:15 1.15683
## -1,5 +1,9 @@
2013-06-04 Gary Benson <gbenson@redhat.com>
+ * NEWS: Update.
+
+2013-06-04 Gary Benson <gbenson@redhat.com>
+
* objfiles.h (inhibit_section_map_updates): New function
declaration.
(resume_section_map_updates): Likewise.
Index: gdb-7.6/gdb/NEWS
===================================================================
--- gdb-7.6.orig/gdb/NEWS 2013-06-10 14:27:02.071184153 +0200
+++ gdb-7.6/gdb/NEWS 2013-06-10 14:28:34.391145339 +0200
@@ -4,6 +4,16 @@
* Newly installed $prefix/bin/gcore acts as a shell interface for the
GDB command gcore.
+* New remote packets
+
+qXfer:libraries-svr4:read's annex
+ The previously unused annex of the qXfer:libraries-svr4:read packet
+ is now used to support passing an argument list. The remote stub
+ reports support for this argument list to GDB's qSupported query.
+ The defined arguments are "start" and "prev", used to reduce work
+ necessary for library list updating, resulting in significant
+ speedup.
+
*** Changes in GDB 7.6
* Target record has been renamed to record-full.

View File

@ -0,0 +1,91 @@
http://sourceware.org/ml/gdb-cvs/2013-06/msg00016.html
### src/gdb/doc/ChangeLog 2013/05/24 04:50:26 1.1463
### src/gdb/doc/ChangeLog 2013/06/04 13:07:45 1.1464
## -1,3 +1,12 @@
+2013-06-04 Gary Benson <gbenson@redhat.com>
+
+ * gdb.texinfo (General Query Packets/qSupported): Added
+ "qXfer:libraries-svr4:read" and "augmented-libraries-svr4-read".
+ to the table of currently defined stub features.
+ Added a more detailed entry for "augmented-libraries-svr4-read".
+ (General Query Packets/qXfer:libraries-svr4:read): Documented
+ the augmented form of this packet.
+
2013-05-23 Joel Brobecker <brobecker@adacore.com>
* gdb.texinfo (System-wide Configuration Scripts): Renames
--- src/gdb/doc/gdb.texinfo 2013/05/24 04:50:26 1.1093
+++ src/gdb/doc/gdb.texinfo 2013/06/04 13:07:45 1.1094
@@ -38594,6 +38594,16 @@
@tab @samp{-}
@tab Yes
+@item @samp{qXfer:libraries-svr4:read}
+@tab No
+@tab @samp{-}
+@tab Yes
+
+@item @samp{augmented-libraries-svr4-read}
+@tab No
+@tab @samp{-}
+@tab No
+
@item @samp{qXfer:memory-map:read}
@tab No
@tab @samp{-}
@@ -38770,6 +38780,11 @@
The remote stub understands the @samp{qXfer:libraries-svr4:read} packet
(@pxref{qXfer svr4 library list read}).
+@item augmented-libraries-svr4-read
+The remote stub understands the augmented form of the
+@samp{qXfer:libraries-svr4:read} packet
+(@pxref{qXfer svr4 library list read}).
+
@item qXfer:memory-map:read
The remote stub understands the @samp{qXfer:memory-map:read} packet
(@pxref{qXfer memory map read}).
@@ -39065,7 +39080,10 @@
@anchor{qXfer svr4 library list read}
Access the target's list of loaded libraries when the target is an SVR4
platform. @xref{Library List Format for SVR4 Targets}. The annex part
-of the generic @samp{qXfer} packet must be empty (@pxref{qXfer read}).
+of the generic @samp{qXfer} packet must be empty unless the remote
+stub indicated it supports the augmented form of this packet
+by supplying an appropriate @samp{qSupported} response
+(@pxref{qXfer read}, @ref{qSupported}).
This packet is optional for better performance on SVR4 targets.
@value{GDBN} uses memory read packets to read the SVR4 library list otherwise.
@@ -39073,6 +39091,30 @@
This packet is not probed by default; the remote stub must request it,
by supplying an appropriate @samp{qSupported} response (@pxref{qSupported}).
+If the remote stub indicates it supports the augmented form of this
+packet then the annex part of the generic @samp{qXfer} packet may
+contain a semicolon-separated list of @samp{@var{name}=@var{value}}
+arguments. The currently supported arguments are:
+
+@table @code
+@item start=@var{address}
+A hexadecimal number specifying the address of the @samp{struct
+link_map} to start reading the library list from. If unset or zero
+then the first @samp{struct link_map} in the library list will be
+chosen as the starting point.
+
+@item prev=@var{address}
+A hexadecimal number specifying the address of the @samp{struct
+link_map} immediately preceding the @samp{struct link_map}
+specified by the @samp{start} argument. If unset or zero then
+the remote stub will expect that no @samp{struct link_map}
+exists prior to the starting point.
+
+@end table
+
+Arguments that are not understood by the remote stub will be silently
+ignored.
+
@item qXfer:memory-map:read::@var{offset},@var{length}
@anchor{qXfer memory map read}
Access the target's @dfn{memory-map}. @xref{Memory Map Format}. The

View File

@ -1,86 +1,32 @@
http://sourceware.org/ml/gdb-patches/2013-05/msg00628.html
Subject: [RFA 4/7] GDB support for new gdbserver functionality
http://sourceware.org/ml/gdb-cvs/2013-06/msg00017.html
--CaPKgh3XHpq3rEUV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
This patch adds client support for the new gdbserver functionality
provided by patch 3 of this series.
--CaPKgh3XHpq3rEUV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="rtld-probes-4-remote.patch"
2013-05-16 Gary Benson <gbenson@redhat.com>
* target.h (target_ops): New field
"to_augmented_libraries_svr4_read".
(target_augmented_libraries_svr4_read): New macro.
* target.c (update_current_target): Handle
to_augmented_libraries_svr4_read.
* remote.c (remote_state): New field
"augmented_libraries_svr4_read".
(remote_augmented_libraries_svr4_read_feature): New function.
(remote_protocol_features): Add entry for
"augmented-libraries-svr4-read".
(remote_augmented_libraries_svr4_read): New function.
(init_remote_ops): Initialize
remote_ops.to_augmented_libraries_svr4_read.
diff --git a/gdb/target.h b/gdb/target.h
index e937d39..a8587e8 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -941,6 +941,10 @@ struct target_ops
(inclusive) to function END (exclusive). */
void (*to_call_history_range) (ULONGEST begin, ULONGEST end, int flags);
### src/gdb/ChangeLog 2013/06/04 13:02:15 1.15683
### src/gdb/ChangeLog 2013/06/04 13:10:53 1.15684
## -1,5 +1,21 @@
2013-06-04 Gary Benson <gbenson@redhat.com>
+ /* Nonzero if TARGET_OBJECT_LIBRARIES_SVR4 may be read with a
+ non-empty annex. */
+ int (*to_augmented_libraries_svr4_read) (void);
+ * target.h (target_ops): New field
+ "to_augmented_libraries_svr4_read".
+ (target_augmented_libraries_svr4_read): New macro.
+ * target.c (update_current_target): Handle
+ to_augmented_libraries_svr4_read.
+ * remote.c (remote_state): New field
+ "augmented_libraries_svr4_read".
+ (remote_augmented_libraries_svr4_read_feature): New function.
+ (remote_protocol_features): Add entry for
+ "augmented-libraries-svr4-read".
+ (remote_augmented_libraries_svr4_read): New function.
+ (init_remote_ops): Initialize
+ remote_ops.to_augmented_libraries_svr4_read.
+
int to_magic;
/* Need sub-structure for target machine related rather than comm related?
*/
@@ -1809,6 +1813,9 @@ extern char *target_fileio_read_stralloc (const char *filename);
#define target_can_use_agent() \
(*current_target.to_can_use_agent) ()
+#define target_augmented_libraries_svr4_read() \
+ (*current_target.to_augmented_libraries_svr4_read) ()
+2013-06-04 Gary Benson <gbenson@redhat.com>
+
/* Command logging facility. */
* NEWS: Update.
#define target_log_command(p) \
diff --git a/gdb/target.c b/gdb/target.c
index 8653dac..519b97f 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -731,6 +731,7 @@ update_current_target (void)
INHERIT (to_traceframe_info, t);
INHERIT (to_use_agent, t);
INHERIT (to_can_use_agent, t);
+ INHERIT (to_augmented_libraries_svr4_read, t);
INHERIT (to_magic, t);
INHERIT (to_supports_evaluation_of_breakpoint_conditions, t);
INHERIT (to_can_run_breakpoint_commands, t);
@@ -975,6 +976,9 @@ update_current_target (void)
de_fault (to_can_use_agent,
(int (*) (void))
return_zero);
+ de_fault (to_augmented_libraries_svr4_read,
+ (int (*) (void))
+ return_zero);
de_fault (to_execution_direction, default_execution_direction);
#undef de_fault
diff --git a/gdb/remote.c b/gdb/remote.c
index 51bf025..e1cf8a4 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -343,6 +343,10 @@ struct remote_state
2013-06-04 Gary Benson <gbenson@redhat.com>
--- src/gdb/remote.c 2013/05/30 09:29:18 1.552
+++ src/gdb/remote.c 2013/06/04 13:10:53 1.553
@@ -361,6 +361,10 @@
/* True if the stub can collect strings using tracenz bytecode. */
int string_tracing;
@ -91,7 +37,7 @@ index 51bf025..e1cf8a4 100644
/* Nonzero if the user has pressed Ctrl-C, but the target hasn't
responded to that. */
int ctrlc_pending_p;
@@ -3931,6 +3935,16 @@ remote_string_tracing_feature (const struct protocol_feature *feature,
@@ -3949,6 +3953,16 @@
rs->string_tracing = (support == PACKET_ENABLE);
}
@ -108,7 +54,7 @@ index 51bf025..e1cf8a4 100644
static struct protocol_feature remote_protocol_features[] = {
{ "PacketSize", PACKET_DISABLE, remote_packet_size, -1 },
{ "qXfer:auxv:read", PACKET_DISABLE, remote_supported_packet,
@@ -3941,6 +3955,8 @@ static struct protocol_feature remote_protocol_features[] = {
@@ -3959,6 +3973,8 @@
PACKET_qXfer_libraries },
{ "qXfer:libraries-svr4:read", PACKET_DISABLE, remote_supported_packet,
PACKET_qXfer_libraries_svr4 },
@ -117,7 +63,7 @@ index 51bf025..e1cf8a4 100644
{ "qXfer:memory-map:read", PACKET_DISABLE, remote_supported_packet,
PACKET_qXfer_memory_map },
{ "qXfer:spu:read", PACKET_DISABLE, remote_supported_packet,
@@ -11343,6 +11359,14 @@ remote_read_btrace (struct btrace_target_info *tinfo,
@@ -11439,6 +11455,14 @@
return btrace;
}
@ -132,7 +78,7 @@ index 51bf025..e1cf8a4 100644
static void
init_remote_ops (void)
{
@@ -11465,6 +11489,8 @@ Specify the serial device it is connected to\n\
@@ -11561,6 +11585,8 @@
remote_ops.to_disable_btrace = remote_disable_btrace;
remote_ops.to_teardown_btrace = remote_teardown_btrace;
remote_ops.to_read_btrace = remote_read_btrace;
@ -141,6 +87,46 @@ index 51bf025..e1cf8a4 100644
}
/* Set up the extended remote vector by making a copy of the standard
--CaPKgh3XHpq3rEUV--
--- src/gdb/target.c 2013/05/14 20:33:36 1.335
+++ src/gdb/target.c 2013/06/04 13:10:53 1.336
@@ -731,6 +731,7 @@
INHERIT (to_traceframe_info, t);
INHERIT (to_use_agent, t);
INHERIT (to_can_use_agent, t);
+ INHERIT (to_augmented_libraries_svr4_read, t);
INHERIT (to_magic, t);
INHERIT (to_supports_evaluation_of_breakpoint_conditions, t);
INHERIT (to_can_run_breakpoint_commands, t);
@@ -975,6 +976,9 @@
de_fault (to_can_use_agent,
(int (*) (void))
return_zero);
+ de_fault (to_augmented_libraries_svr4_read,
+ (int (*) (void))
+ return_zero);
de_fault (to_execution_direction, default_execution_direction);
#undef de_fault
--- src/gdb/target.h 2013/05/14 20:33:36 1.262
+++ src/gdb/target.h 2013/06/04 13:10:53 1.263
@@ -941,6 +941,10 @@
(inclusive) to function END (exclusive). */
void (*to_call_history_range) (ULONGEST begin, ULONGEST end, int flags);
+ /* Nonzero if TARGET_OBJECT_LIBRARIES_SVR4 may be read with a
+ non-empty annex. */
+ int (*to_augmented_libraries_svr4_read) (void);
+
int to_magic;
/* Need sub-structure for target machine related rather than comm related?
*/
@@ -1809,6 +1813,9 @@
#define target_can_use_agent() \
(*current_target.to_can_use_agent) ()
+#define target_augmented_libraries_svr4_read() \
+ (*current_target.to_augmented_libraries_svr4_read) ()
+
/* Command logging facility. */
#define target_log_command(p) \

View File

@ -1,92 +1,70 @@
http://sourceware.org/ml/gdb-patches/2013-05/msg00632.html
Subject: [RFA 5/7] Improved linker-debugger interface
--qse+WBH4guesipZ+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
This patch implements the probes-based runtime linker interface.
It works as follows:
- On inferior startup, GDB searches the dynamic linker for a
number of named probes.
- If all probes are found, GDB sets a breakpoint on each one.
Otherwise, the standard function _dl_debug_state is used.
- When using probes, a per-pspace list is maintained of all
libraries currently loaded by the inferior. It's updated
as necessary every time a solib event stop occurs.
- When using probes, svr4_current_sos will return a copy of
the cached list. When not using probes the entire list
will be fetched from the inferior as before.
- If any error occurs, GDB will print a warning and revert to
the standard interface.
--qse+WBH4guesipZ+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="rtld-probes-5-main-changes.patch"
2013-05-16 Gary Benson <gbenson@redhat.com>
* breakpoint.h (handle_solib_event): Moved function declaration
to solib.h.
* breakpoint.c (handle_solib_event): Moved function to solib.c.
(bpstat_stop_status): Pass new argument to handle_solib_event.
* solib.h (update_solib_breakpoints): New function declaration.
(handle_solib_event): Moved function declaration from
breakpoint.h.
* solib.c (update_solib_breakpoints): New function.
(handle_solib_event): Moved function from breakpoint.c.
Updated to call solib_ops->handle_event if not NULL.
* solist.h (target_so_ops): New fields "update_breakpoints" and
"handle_event".
* infrun.c (set_stop_on_solib_events): New function.
(_initialize_infrun): Use the above for "set
stop-on-solib-events".
(handle_inferior_event): Pass new argument to handle_solib_event.
* solib-svr4.c (probe.h): New include.
(svr4_free_library_list): New forward declaration.
(probe_action): New enum.
(probe_info): New struct.
(probe_info): New static variable.
(NUM_PROBES): New definition.
(svr4_info): New fields "using_xfer", "probes_table" and
"solib_list".
(free_probes_table): New function.
(free_solib_list): New function.
(svr4_pspace_data_cleanup): Free probes table and solib list.
(svr4_copy_library_list): New function.
(svr4_current_sos_via_xfer_libraries): New parameter "annex".
(svr4_read_so_list): New parameter "prev_lm".
(svr4_current_sos_direct): Renamed from "svr4_current_sos".
(svr4_current_sos): New function.
(probe_and_action): New struct.
(hash_probe_and_action): New function.
(equal_probe_and_action): Likewise.
(register_solib_event_probe): Likewise.
(solib_event_probe_at): Likewise.
(solib_event_probe_action): Likewise.
(solist_update_full): Likewise.
(solist_update_incremental): Likewise.
(disable_probes_interface_cleanup): Likewise.
(svr4_handle_solib_event): Likewise.
(svr4_update_solib_event_breakpoint): Likewise.
(svr4_update_solib_event_breakpoints): Likewise.
(svr4_create_solib_event_breakpoints): Likewise.
(enable_break): Free probes table before creating breakpoints.
Use svr4_create_solib_event_breakpoints to create breakpoints.
(svr4_solib_create_inferior_hook): Free the solib list.
(_initialize_svr4_solib): Initialise
svr4_so_ops.handle_solib_event and svr4_so_ops.update_breakpoints.
http://sourceware.org/ml/gdb-cvs/2013-06/msg00018.html
### src/gdb/ChangeLog 2013/06/04 13:10:53 1.15684
### src/gdb/ChangeLog 2013/06/04 13:17:05 1.15685
## -1,5 +1,58 @@
2013-06-04 Gary Benson <gbenson@redhat.com>
+ * breakpoint.h (handle_solib_event): Moved function declaration
+ to solib.h.
+ * breakpoint.c (handle_solib_event): Moved function to solib.c.
+ (bpstat_stop_status): Pass new argument to handle_solib_event.
+ * solib.h (update_solib_breakpoints): New function declaration.
+ (handle_solib_event): Moved function declaration from
+ breakpoint.h.
+ * solib.c (update_solib_breakpoints): New function.
+ (handle_solib_event): Moved function from breakpoint.c.
+ Updated to call solib_ops->handle_event if not NULL.
+ * solist.h (target_so_ops): New fields "update_breakpoints" and
+ "handle_event".
+ * infrun.c (set_stop_on_solib_events): New function.
+ (_initialize_infrun): Use the above for "set
+ stop-on-solib-events".
+ (handle_inferior_event): Pass new argument to handle_solib_event.
+ * solib-svr4.c (probe.h): New include.
+ (svr4_free_library_list): New forward declaration.
+ (probe_action): New enum.
+ (probe_info): New struct.
+ (probe_info): New static variable.
+ (NUM_PROBES): New definition.
+ (svr4_info): New fields "using_xfer", "probes_table" and
+ "solib_list".
+ (free_probes_table): New function.
+ (free_solib_list): New function.
+ (svr4_pspace_data_cleanup): Free probes table and solib list.
+ (svr4_copy_library_list): New function.
+ (svr4_current_sos_via_xfer_libraries): New parameter "annex".
+ (svr4_read_so_list): New parameter "prev_lm".
+ (svr4_current_sos_direct): Renamed from "svr4_current_sos".
+ (svr4_current_sos): New function.
+ (probe_and_action): New struct.
+ (hash_probe_and_action): New function.
+ (equal_probe_and_action): Likewise.
+ (register_solib_event_probe): Likewise.
+ (solib_event_probe_at): Likewise.
+ (solib_event_probe_action): Likewise.
+ (solist_update_full): Likewise.
+ (solist_update_incremental): Likewise.
+ (disable_probes_interface_cleanup): Likewise.
+ (svr4_handle_solib_event): Likewise.
+ (svr4_update_solib_event_breakpoint): Likewise.
+ (svr4_update_solib_event_breakpoints): Likewise.
+ (svr4_create_solib_event_breakpoints): Likewise.
+ (enable_break): Free probes table before creating breakpoints.
+ Use svr4_create_solib_event_breakpoints to create breakpoints.
+ (svr4_solib_create_inferior_hook): Free the solib list.
+ (_initialize_svr4_solib): Initialise
+ svr4_so_ops.handle_solib_event and svr4_so_ops.update_breakpoints.
+
+2013-06-04 Gary Benson <gbenson@redhat.com>
+
* target.h (target_ops): New field
"to_augmented_libraries_svr4_read".
(target_augmented_libraries_svr4_read): New macro.
Index: gdb-7.6/gdb/breakpoint.h
===================================================================
--- gdb-7.6.orig/gdb/breakpoint.h 2013-05-19 16:16:20.551087270 +0200
+++ gdb-7.6/gdb/breakpoint.h 2013-05-19 16:16:20.837086948 +0200
--- gdb-7.6.orig/gdb/breakpoint.h 2013-06-10 14:44:37.455812656 +0200
+++ gdb-7.6/gdb/breakpoint.h 2013-06-10 14:44:37.709812579 +0200
@@ -1552,8 +1552,6 @@ extern int user_breakpoint_p (struct bre
/* Attempt to determine architecture of location identified by SAL. */
extern struct gdbarch *get_sal_arch (struct symtab_and_line sal);
@ -96,94 +74,10 @@ Index: gdb-7.6/gdb/breakpoint.h
extern void breakpoint_free_objfile (struct objfile *objfile);
extern void breakpoints_relocate (struct objfile *objfile,
Index: gdb-7.6/gdb/solib.h
===================================================================
--- gdb-7.6.orig/gdb/solib.h 2013-01-01 07:32:51.000000000 +0100
+++ gdb-7.6/gdb/solib.h 2013-05-19 16:16:20.838086946 +0200
@@ -90,4 +90,12 @@ 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);
+
+/* Handle an solib event by calling solib_add. */
+
+extern void handle_solib_event (void);
+
#endif /* SOLIB_H */
Index: gdb-7.6/gdb/solib.c
===================================================================
--- gdb-7.6.orig/gdb/solib.c 2013-05-19 16:16:20.468087363 +0200
+++ gdb-7.6/gdb/solib.c 2013-05-19 16:16:20.838086946 +0200
@@ -1221,6 +1221,38 @@ no_shared_libraries (char *ignored, int
objfile_purge_solibs ();
}
+/* See solib.h. */
+
+void
+update_solib_breakpoints (void)
+{
+ struct target_so_ops *ops = solib_ops (target_gdbarch ());
+
+ if (ops->update_breakpoints != NULL)
+ ops->update_breakpoints ();
+}
+
+/* See solib.h. */
+
+void
+handle_solib_event (void)
+{
+ struct target_so_ops *ops = solib_ops (target_gdbarch ());
+
+ if (ops->handle_event != NULL)
+ ops->handle_event ();
+
+ clear_program_space_solib_cache (current_inferior ()->pspace);
+
+ /* Check for any newly added shared libraries if we're supposed to
+ be adding them automatically. Switch terminal for any messages
+ produced by breakpoint_re_set. */
+ target_terminal_ours_for_output ();
+ solib_add (NULL, 0, &current_target, auto_solib_add);
+ target_terminal_inferior ();
+}
+
+
/* Reload shared libraries, but avoid reloading the same symbol file
we already have loaded. */
Index: gdb-7.6/gdb/solist.h
===================================================================
--- gdb-7.6.orig/gdb/solist.h 2013-01-01 07:32:51.000000000 +0100
+++ gdb-7.6/gdb/solist.h 2013-05-19 16:16:20.838086946 +0200
@@ -148,6 +148,19 @@ struct target_so_ops
core file (in particular, for readonly sections). */
int (*keep_data_in_core) (CORE_ADDR vaddr,
unsigned long size);
+
+ /* Enable or disable optional solib event breakpoints as
+ appropriate. This should be called whenever
+ stop_on_solib_events is changed. This pointer can be
+ NULL, in which case no enabling or disabling is necessary
+ for this target. */
+ void (*update_breakpoints) (void);
+
+ /* Target-specific processing of solib events that will be
+ performed before solib_add is called. This pointer can be
+ NULL, in which case no specific preprocessing is necessary
+ for this target. */
+ void (*handle_event) (void);
};
/* Free the memory associated with a (so_list *). */
Index: gdb-7.6/gdb/infrun.c
===================================================================
--- gdb-7.6.orig/gdb/infrun.c 2013-05-19 16:16:20.508087318 +0200
+++ gdb-7.6/gdb/infrun.c 2013-05-19 16:16:20.840086944 +0200
--- gdb-7.6.orig/gdb/infrun.c 2013-06-10 14:44:37.427812664 +0200
+++ gdb-7.6/gdb/infrun.c 2013-06-10 14:44:37.711812579 +0200
@@ -370,6 +370,16 @@ 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. */
@ -212,14 +106,14 @@ Index: gdb-7.6/gdb/infrun.c
Index: gdb-7.6/gdb/solib-svr4.c
===================================================================
--- gdb-7.6.orig/gdb/solib-svr4.c 2013-05-19 16:16:20.468087363 +0200
+++ gdb-7.6/gdb/solib-svr4.c 2013-05-19 16:21:40.285816084 +0200
@@ -47,9 +47,12 @@
--- gdb-7.6.orig/gdb/solib-svr4.c 2013-06-10 14:44:37.392812675 +0200
+++ gdb-7.6/gdb/solib-svr4.c 2013-06-10 14:44:37.712812578 +0200
@@ -46,10 +46,12 @@
#include "auxv.h"
#include "exceptions.h"
#include "gdb_bfd.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);
@ -227,30 +121,30 @@ Index: gdb-7.6/gdb/solib-svr4.c
/* Link map info to include in an allocated so_list entry. */
@@ -106,6 +109,55 @@ static const char * const main_name_lis
@@ -106,6 +108,55 @@ static const char * const main_name_lis
NULL
};
+/* What to do when a probe stop occurs. */
+
+enum probe_action
+ {
+ /* Something went seriously wrong. Stop using probes and
+ revert to using the older interface. */
+ PROBES_INTERFACE_FAILED,
+{
+ /* Something went seriously wrong. Stop using probes and
+ revert to using the older interface. */
+ PROBES_INTERFACE_FAILED,
+
+ /* No action is required. The shared object list is still
+ valid. */
+ DO_NOTHING,
+ /* No action is required. The shared object list is still
+ valid. */
+ DO_NOTHING,
+
+ /* The shared object list should be reloaded entirely. */
+ FULL_RELOAD,
+ /* The shared object list should be reloaded entirely. */
+ FULL_RELOAD,
+
+ /* Attempt to incrementally update the shared object list. If
+ the update fails or is not possible, fall back to reloading
+ the list in full. */
+ UPDATE_OR_RELOAD,
+ };
+ /* Attempt to incrementally update the shared object list. If
+ the update fails or is not possible, fall back to reloading
+ the list in full. */
+ UPDATE_OR_RELOAD,
+};
+
+/* A probe's name and its associated action. */
+
@ -283,7 +177,7 @@ Index: gdb-7.6/gdb/solib-svr4.c
/* Return non-zero if GDB_SO_NAME and INFERIOR_SO_NAME represent
the same shared library. */
@@ -313,17 +365,56 @@ struct svr4_info
@@ -313,17 +364,58 @@ struct svr4_info
CORE_ADDR interp_text_sect_high;
CORE_ADDR interp_plt_sect_low;
CORE_ADDR interp_plt_sect_high;
@ -292,8 +186,10 @@ Index: gdb-7.6/gdb/solib-svr4.c
+ via qXfer:libraries-svr4:read. */
+ int using_xfer;
+
+ /* Table mapping breakpoint addresses to probes and actions, used
+ by the probes-based interface. */
+ /* Table of struct probe_and_action instances, used by the
+ probes-based interface to map breakpoint addresses to probes
+ and their associated actions. Lookup is performed using
+ probe_and_action->probe->address. */
+ htab_t probes_table;
+
+ /* List of objects loaded into the inferior, used by the probes-
@ -340,7 +236,7 @@ Index: gdb-7.6/gdb/solib-svr4.c
xfree (info);
}
@@ -982,6 +1073,36 @@ svr4_free_library_list (void *p_list)
@@ -982,6 +1074,34 @@ svr4_free_library_list (void *p_list)
}
}
@ -349,7 +245,6 @@ Index: gdb-7.6/gdb/solib-svr4.c
+static struct so_list *
+svr4_copy_library_list (struct so_list *src)
+{
+ struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
+ struct so_list *dst = NULL;
+ struct so_list **link = &dst;
+
@ -357,12 +252,11 @@ Index: gdb-7.6/gdb/solib-svr4.c
+ {
+ struct so_list *new;
+
+ new = XZALLOC (struct so_list);
+
+ new = xmalloc (sizeof (struct so_list));
+ memcpy (new, src, sizeof (struct so_list));
+
+ new->lm_info = xmalloc (lmo->link_map_size);
+ memcpy (new->lm_info, src->lm_info, lmo->link_map_size);
+ new->lm_info = xmalloc (sizeof (struct lm_info));
+ memcpy (new->lm_info, src->lm_info, sizeof (struct lm_info));
+
+ new->next = NULL;
+ *link = new;
@ -377,7 +271,7 @@ Index: gdb-7.6/gdb/solib-svr4.c
#ifdef HAVE_LIBEXPAT
#include "xml-support.h"
@@ -1097,14 +1218,19 @@ svr4_parse_libraries (const char *docume
@@ -1097,23 +1217,30 @@ svr4_parse_libraries (const char *docume
return 0;
}
@ -400,7 +294,10 @@ Index: gdb-7.6/gdb/solib-svr4.c
{
char *svr4_library_document;
int result;
@@ -1113,7 +1239,7 @@ svr4_current_sos_via_xfer_libraries (str
struct cleanup *back_to;
+ gdb_assert (annex == NULL || target_augmented_libraries_svr4_read ());
+
/* Fetch the list of shared libraries. */
svr4_library_document = target_read_stralloc (&current_target,
TARGET_OBJECT_LIBRARIES_SVR4,
@ -409,7 +306,7 @@ Index: gdb-7.6/gdb/solib-svr4.c
if (svr4_library_document == NULL)
return 0;
@@ -1127,7 +1253,8 @@ svr4_current_sos_via_xfer_libraries (str
@@ -1127,7 +1254,8 @@ svr4_current_sos_via_xfer_libraries (str
#else
static int
@ -419,7 +316,7 @@ Index: gdb-7.6/gdb/solib-svr4.c
{
return 0;
}
@@ -1161,15 +1288,17 @@ svr4_default_sos (void)
@@ -1161,15 +1289,19 @@ svr4_default_sos (void)
return new;
}
@ -430,7 +327,9 @@ Index: gdb-7.6/gdb/solib-svr4.c
+ Expect the first entry in the chain's previous entry to be PREV_LM.
+ Add the entries to the tail referenced by LINK_PTR_PTR. Ignore the
+ first entry if IGNORE_FIRST and set global MAIN_LM_ADDR according
+ to it. Returns nonzero upon success. */
+ to it. Returns nonzero upon success. If zero is returned the
+ entries stored to LINK_PTR_PTR are still valid although they may
+ represent only part of the inferior library list. */
-static void
-svr4_read_so_list (CORE_ADDR lm, struct so_list ***link_ptr_ptr,
@ -444,7 +343,7 @@ Index: gdb-7.6/gdb/solib-svr4.c
for (; lm != 0; prev_lm = lm, lm = next_lm)
{
@@ -1185,7 +1314,7 @@ svr4_read_so_list (CORE_ADDR lm, struct
@@ -1185,7 +1317,7 @@ svr4_read_so_list (CORE_ADDR lm, struct
if (new->lm_info == NULL)
{
do_cleanups (old_chain);
@ -453,7 +352,7 @@ Index: gdb-7.6/gdb/solib-svr4.c
}
next_lm = new->lm_info->l_next;
@@ -1196,7 +1325,7 @@ svr4_read_so_list (CORE_ADDR lm, struct
@@ -1196,7 +1328,7 @@ svr4_read_so_list (CORE_ADDR lm, struct
paddress (target_gdbarch (), prev_lm),
paddress (target_gdbarch (), new->lm_info->l_prev));
do_cleanups (old_chain);
@ -462,7 +361,7 @@ Index: gdb-7.6/gdb/solib-svr4.c
}
/* For SVR4 versions, the first entry in the link map is for the
@@ -1291,17 +1420,19 @@ svr4_read_so_list (CORE_ADDR lm, struct
@@ -1291,17 +1423,21 @@ svr4_read_so_list (CORE_ADDR lm, struct
**link_ptr_ptr = new;
*link_ptr_ptr = &new->next;
}
@ -471,8 +370,10 @@ Index: gdb-7.6/gdb/solib-svr4.c
}
-/* Implement the "current_sos" target_so_ops method. */
+/* Read the full list of currently loaded shared objects directly from
+ the inferior. */
+/* Read the full list of currently loaded shared objects directly
+ from the inferior, without referring to any libraries read and
+ stored by the probes interface. Handle special cases relating
+ to the first elements of the list. */
static struct so_list *
-svr4_current_sos (void)
@ -485,7 +386,7 @@ Index: gdb-7.6/gdb/solib-svr4.c
struct cleanup *back_to;
int ignore_first;
struct svr4_library_list library_list;
@@ -1314,19 +1445,16 @@ svr4_current_sos (void)
@@ -1314,19 +1450,16 @@ svr4_current_sos (void)
Unfortunately statically linked inferiors will also fall back through this
suboptimal code path. */
@ -509,7 +410,7 @@ Index: gdb-7.6/gdb/solib-svr4.c
/* Always locate the debug struct, in case it has moved. */
info->debug_base = 0;
locate_base (info);
@@ -1349,7 +1477,7 @@ svr4_current_sos (void)
@@ -1349,7 +1482,7 @@ svr4_current_sos (void)
`struct so_list' nodes. */
lm = solib_svr4_r_map (info);
if (lm)
@ -518,7 +419,7 @@ Index: gdb-7.6/gdb/solib-svr4.c
/* On Solaris, the dynamic linker is not in the normal list of
shared objects, so make sure we pick it up too. Having
@@ -1357,7 +1485,7 @@ svr4_current_sos (void)
@@ -1357,7 +1490,7 @@ svr4_current_sos (void)
for skipping dynamic linker resolver code. */
lm = solib_svr4_r_ldsomap (info);
if (lm)
@ -527,7 +428,7 @@ Index: gdb-7.6/gdb/solib-svr4.c
discard_cleanups (back_to);
@@ -1367,6 +1495,22 @@ svr4_current_sos (void)
@@ -1367,6 +1500,22 @@ svr4_current_sos (void)
return head;
}
@ -538,8 +439,8 @@ Index: gdb-7.6/gdb/solib-svr4.c
+{
+ struct svr4_info *info = get_svr4_info ();
+
+ /* If we are using the probes interface and the solib list has
+ been cached then we simply return that. */
+ /* If the solib list has been read and stored by the probes
+ interface then we return a copy of the stored list. */
+ if (info->solib_list != NULL)
+ return svr4_copy_library_list (info->solib_list);
+
@ -550,7 +451,7 @@ Index: gdb-7.6/gdb/solib-svr4.c
/* Get the address of the link_map for a given OBJFILE. */
CORE_ADDR
@@ -1449,6 +1593,434 @@ exec_entry_point (struct bfd *abfd, stru
@@ -1449,6 +1598,476 @@ exec_entry_point (struct bfd *abfd, stru
return gdbarch_addr_bits_remove (target_gdbarch (), addr);
}
@ -599,11 +500,9 @@ Index: gdb-7.6/gdb/solib-svr4.c
+
+ /* Create the probes table, if necessary. */
+ if (info->probes_table == NULL)
+ {
+ info->probes_table = htab_create_alloc (1, hash_probe_and_action,
+ equal_probe_and_action,
+ xfree, xcalloc, xfree);
+ }
+ info->probes_table = htab_create_alloc (1, hash_probe_and_action,
+ equal_probe_and_action,
+ xfree, xcalloc, xfree);
+
+ lookup.probe = probe;
+ slot = htab_find_slot (info->probes_table, &lookup, INSERT);
@ -667,12 +566,13 @@ Index: gdb-7.6/gdb/solib-svr4.c
+}
+
+/* Populate the shared object list by reading the entire list of
+ shared objects from the inferior. Returns nonzero on success. */
+ shared objects from the inferior. Handle special cases relating
+ to the first elements of the list. Returns nonzero on success. */
+
+static int
+solist_update_full (struct svr4_info *info)
+{
+ svr4_free_library_list (&info->solib_list);
+ free_solib_list (info);
+ info->solib_list = svr4_current_sos_direct (info);
+
+ return 1;
@ -689,17 +589,21 @@ Index: gdb-7.6/gdb/solib-svr4.c
+ struct so_list *tail;
+ CORE_ADDR prev_lm;
+
+ /* Fall back to a full update if we haven't read anything yet. */
+ /* svr4_current_sos_direct contains logic to handle a number of
+ special cases relating to the first elements of the list. To
+ avoid duplicating this logic we defer to solist_update_full
+ if the list is empty. */
+ if (info->solib_list == NULL)
+ return 0;
+
+ /* Fall back to a full update if we are using a remote target
+ that does not support incremental transfers. */
+ if (info->using_xfer && !target_augmented_libraries_svr4_read())
+ if (info->using_xfer && !target_augmented_libraries_svr4_read ())
+ return 0;
+
+ /* Walk to the end of the list. */
+ for (tail = info->solib_list; tail->next; tail = tail->next);
+ for (tail = info->solib_list; tail->next != NULL; tail = tail->next)
+ /* Nothing. */;
+ prev_lm = tail->lm_info->lm_addr;
+
+ /* Read the new objects. */
@ -708,7 +612,9 @@ Index: gdb-7.6/gdb/solib-svr4.c
+ struct svr4_library_list library_list;
+ char annex[64];
+
+ xsnprintf (annex, sizeof (annex), "start=%lx;prev=%lx", lm, prev_lm);
+ xsnprintf (annex, sizeof (annex), "start=%s;prev=%s",
+ phex_nz (lm, sizeof (lm)),
+ phex_nz (prev_lm, sizeof (prev_lm)));
+ if (!svr4_current_sos_via_xfer_libraries (&library_list, annex))
+ return 0;
+
@ -718,6 +624,10 @@ Index: gdb-7.6/gdb/solib-svr4.c
+ {
+ struct so_list **link = &tail->next;
+
+ /* IGNORE_FIRST may safely be set to zero here because the
+ above check and deferral to solist_update_full ensures
+ that this call to svr4_read_so_list will never see the
+ first element. */
+ if (!svr4_read_so_list (lm, prev_lm, &link, 0))
+ return 0;
+ }
@ -767,42 +677,64 @@ Index: gdb-7.6/gdb/solib-svr4.c
+ pc = regcache_read_pc (get_current_regcache ());
+ pa = solib_event_probe_at (info, pc);
+ if (pa == NULL)
+ goto error;
+ {
+ do_cleanups (old_chain);
+ return;
+ }
+
+ action = solib_event_probe_action (pa);
+ if (action == PROBES_INTERFACE_FAILED)
+ goto error;
+ {
+ do_cleanups (old_chain);
+ return;
+ }
+
+ if (action == DO_NOTHING)
+ return;
+ {
+ discard_cleanups (old_chain);
+ return;
+ }
+
+ /* EVALUATE_PROBE_ARGUMENT looks up symbols in the dynamic linker
+ using FIND_PC_SECTION. FIND_PC_SECTION is accelerated by a cache
+ /* evaluate_probe_argument looks up symbols in the dynamic linker
+ using find_pc_section. find_pc_section is accelerated by a cache
+ called the section map. The section map is invalidated every
+ time a shared library is loaded or unloaded, and if the inferior
+ is generating a lot of shared library events then the section map
+ will be updated every time SVR4_HANDLE_SOLIB_EVENT is called.
+ We called FIND_PC_SECTION in SVR4_CREATE_SOLIB_EVENT_BREAKPOINTS,
+ will be updated every time svr4_handle_solib_event is called.
+ We called find_pc_section in svr4_create_solib_event_breakpoints,
+ so we can guarantee that the dynamic linker's sections are in the
+ section map. We can therefore inhibit section map updates across
+ these calls to EVALUATE_PROBE_ARGUMENT and save a lot of time. */
+ inhibit_section_map_updates ();
+ usm_chain = make_cleanup (resume_section_map_updates_cleanup, NULL);
+ these calls to evaluate_probe_argument and save a lot of time. */
+ inhibit_section_map_updates (current_program_space);
+ usm_chain = make_cleanup (resume_section_map_updates_cleanup,
+ current_program_space);
+
+ val = evaluate_probe_argument (pa->probe, 1);
+ if (val == NULL)
+ goto error;
+ {
+ do_cleanups (old_chain);
+ return;
+ }
+
+ debug_base = value_as_address (val);
+ if (debug_base == 0)
+ goto error;
+ {
+ do_cleanups (old_chain);
+ return;
+ }
+
+ /* Always locate the debug struct, in case it moved. */
+ info->debug_base = 0;
+ if (locate_base (info) == 0)
+ goto error;
+ {
+ do_cleanups (old_chain);
+ return;
+ }
+
+ /* Do not process namespaces other than the initial one. */
+ /* GDB does not currently support libraries loaded via dlmopen
+ into namespaces other than the initial one. We must ignore
+ any namespace other than the initial namespace here until
+ support for this is added to GDB. */
+ if (debug_base != info->debug_base)
+ action = DO_NOTHING;
+
@ -828,17 +760,13 @@ Index: gdb-7.6/gdb/solib-svr4.c
+ if (action == FULL_RELOAD)
+ {
+ if (!solist_update_full (info))
+ goto error;
+ {
+ do_cleanups (old_chain);
+ return;
+ }
+ }
+
+ discard_cleanups (old_chain);
+ return;
+
+ error:
+ /* We should never reach here, but if we do we disable the
+ probes interface and revert to the original interface. */
+
+ do_cleanups (old_chain);
+}
+
+/* Helper function for svr4_update_solib_event_breakpoints. */
@ -846,27 +774,40 @@ Index: gdb-7.6/gdb/solib-svr4.c
+static int
+svr4_update_solib_event_breakpoint (struct breakpoint *b, void *arg)
+{
+ struct svr4_info *info = get_svr4_info ();
+ struct bp_location *loc;
+
+ if (b->type != bp_shlib_event)
+ return 0; /* Continue iterating. */
+
+ for (loc = b->loc; loc; loc = loc->next)
+ {
+ struct probe_and_action *pa = solib_event_probe_at (info, loc->address);
+
+ if (pa != NULL)
+ {
+ if (pa->action == DO_NOTHING)
+ b->enable_state = (stop_on_solib_events
+ ? bp_enabled : bp_disabled);
+
+ return 0; /* Continue iterating. */
+ }
+ /* Continue iterating. */
+ return 0;
+ }
+
+ return 0; /* Continue iterating. */
+ for (loc = b->loc; loc != NULL; loc = loc->next)
+ {
+ struct svr4_info *info;
+ struct probe_and_action *pa;
+
+ info = program_space_data (loc->pspace, solib_svr4_pspace_data);
+ if (info == NULL || info->probes_table == NULL)
+ continue;
+
+ pa = solib_event_probe_at (info, loc->address);
+ if (pa == NULL)
+ continue;
+
+ if (pa->action == DO_NOTHING)
+ {
+ if (b->enable_state == bp_disabled && stop_on_solib_events)
+ enable_breakpoint (b);
+ else if (b->enable_state == bp_enabled && !stop_on_solib_events)
+ disable_breakpoint (b);
+ }
+
+ break;
+ }
+
+ /* Continue iterating. */
+ return 0;
+}
+
+/* Enable or disable optional solib event breakpoints as appropriate.
@ -875,13 +816,13 @@ Index: gdb-7.6/gdb/solib-svr4.c
+static void
+svr4_update_solib_event_breakpoints (void)
+{
+ struct svr4_info *info = get_svr4_info ();
+
+ if (info->probes_table)
+ iterate_over_breakpoints (svr4_update_solib_event_breakpoint, NULL);
+ iterate_over_breakpoints (svr4_update_solib_event_breakpoint, NULL);
+}
+
+/* Create and register solib event breakpoints. */
+/* Create and register solib event breakpoints. PROBES is an array
+ of NUM_PROBES elements, each of which is vector of probes. A
+ solib event breakpoint will be created and registered for each
+ probe. */
+
+static void
+svr4_create_probe_breakpoints (struct gdbarch *gdbarch,
@ -923,7 +864,6 @@ Index: gdb-7.6/gdb/solib-svr4.c
+svr4_create_solib_event_breakpoints (struct gdbarch *gdbarch,
+ CORE_ADDR address)
+{
+ struct svr4_info *info = get_svr4_info ();
+ struct obj_section *os;
+
+ os = find_pc_section (address);
@ -940,28 +880,31 @@ Index: gdb-7.6/gdb/solib-svr4.c
+ memset (probes, 0, sizeof (probes));
+ for (i = 0; i < NUM_PROBES; i++)
+ {
+ char name[32] = { '\0' };
+
+ /* Fedora 17, RHEL 6.2, and RHEL 6.3 shipped with an
+ early version of the probes code in which the probes'
+ names were prefixed with "rtld_" and the "map_failed"
+ probe did not exist. The locations of the probes are
+ otherwise the same, so we check for probes with
+ prefixed names if probes with unprefixed names are
+ not present. */
+ const char *name = probe_info[i].name;
+ char buf[32];
+
+ /* Fedora 17 and Red Hat Enterprise Linux 6.2-6.4
+ shipped with an early version of the probes code in
+ which the probes' names were prefixed with "rtld_"
+ and the "map_failed" probe did not exist. The
+ locations of the probes are otherwise the same, so
+ we check for probes with prefixed names if probes
+ with unprefixed names are not present. */
+ if (with_prefix)
+ strncat (name, "rtld_", sizeof (name) - strlen (name) - 1);
+
+ strncat (name, probe_info[i].name,
+ sizeof (name) - strlen (name) - 1);
+ {
+ xsnprintf (buf, sizeof (buf), "rtld_%s", name);
+ name = buf;
+ }
+
+ probes[i] = find_probes_in_objfile (os->objfile, "rtld", name);
+
+ if (!strcmp (name, "rtld_map_failed"))
+ /* The "map_failed" probe did not exist in early
+ versions of the probes code in which the probes'
+ names were prefixed with "rtld_". */
+ if (strcmp (name, "rtld_map_failed") == 0)
+ continue;
+
+ if (!VEC_length (probe_p, probes[i]))
+ if (VEC_empty (probe_p, probes[i]))
+ {
+ all_probes_found = 0;
+ break;
@ -985,16 +928,7 @@ Index: gdb-7.6/gdb/solib-svr4.c
/* Helper function for gdb_bfd_lookup_symbol. */
static int
@@ -1501,6 +2073,8 @@ enable_break (struct svr4_info *info, in
info->interp_text_sect_low = info->interp_text_sect_high = 0;
info->interp_plt_sect_low = info->interp_plt_sect_high = 0;
+ free_probes_table (info);
+
/* 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
@@ -1532,7 +2106,7 @@ enable_break (struct svr4_info *info, in
@@ -1532,7 +2151,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
@ -1003,7 +937,7 @@ Index: gdb-7.6/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
@@ -1570,7 +2144,7 @@ enable_break (struct svr4_info *info, in
@@ -1570,7 +2189,7 @@ enable_break (struct svr4_info *info, in
+ bfd_section_size (tmp_bfd, interp_sect);
}
@ -1012,7 +946,7 @@ Index: gdb-7.6/gdb/solib-svr4.c
return 1;
}
}
@@ -1728,7 +2302,8 @@ enable_break (struct svr4_info *info, in
@@ -1728,7 +2347,8 @@ enable_break (struct svr4_info *info, in
if (sym_addr != 0)
{
@ -1022,7 +956,7 @@ Index: gdb-7.6/gdb/solib-svr4.c
xfree (interp_name);
return 1;
}
@@ -1754,7 +2329,7 @@ enable_break (struct svr4_info *info, in
@@ -1754,7 +2374,7 @@ enable_break (struct svr4_info *info, in
sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
sym_addr,
&current_target);
@ -1031,7 +965,7 @@ Index: gdb-7.6/gdb/solib-svr4.c
return 1;
}
}
@@ -1770,7 +2345,7 @@ enable_break (struct svr4_info *info, in
@@ -1770,7 +2390,7 @@ enable_break (struct svr4_info *info, in
sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
sym_addr,
&current_target);
@ -1040,28 +974,112 @@ Index: gdb-7.6/gdb/solib-svr4.c
return 1;
}
}
@@ -2266,6 +2841,9 @@ svr4_solib_create_inferior_hook (int fro
@@ -2266,6 +2886,10 @@ svr4_solib_create_inferior_hook (int fro
info = get_svr4_info ();
+ /* Free the probes-based interface's solib list. */
+ /* Clear the probes-based interface's state. */
+ free_probes_table (info);
+ free_solib_list (info);
+
/* Relocate the main executable if necessary. */
svr4_relocate_main_executable ();
@@ -2507,4 +3085,6 @@ _initialize_svr4_solib (void)
@@ -2507,4 +3131,6 @@ _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;
+ svr4_so_ops.handle_event = svr4_handle_solib_event;
}
Index: gdb-7.6/gdb/solib.c
===================================================================
--- gdb-7.6.orig/gdb/solib.c 2013-06-10 14:44:37.392812675 +0200
+++ gdb-7.6/gdb/solib.c 2013-06-10 14:44:37.713812578 +0200
@@ -1221,6 +1221,37 @@ no_shared_libraries (char *ignored, int
objfile_purge_solibs ();
}
+/* See solib.h. */
+
+void
+update_solib_breakpoints (void)
+{
+ const struct target_so_ops *ops = solib_ops (target_gdbarch ());
+
+ if (ops->update_breakpoints != NULL)
+ ops->update_breakpoints ();
+}
+
+/* See solib.h. */
+
+void
+handle_solib_event (void)
+{
+ const struct target_so_ops *ops = solib_ops (target_gdbarch ());
+
+ if (ops->handle_event != NULL)
+ ops->handle_event ();
+
+ clear_program_space_solib_cache (current_inferior ()->pspace);
+
+ /* Check for any newly added shared libraries if we're supposed to
+ be adding them automatically. Switch terminal for any messages
+ produced by breakpoint_re_set. */
+ target_terminal_ours_for_output ();
+ solib_add (NULL, 0, &current_target, auto_solib_add);
+ target_terminal_inferior ();
+}
+
/* Reload shared libraries, but avoid reloading the same symbol file
we already have loaded. */
Index: gdb-7.6/gdb/solib.h
===================================================================
--- gdb-7.6.orig/gdb/solib.h 2013-01-01 07:32:51.000000000 +0100
+++ gdb-7.6/gdb/solib.h 2013-06-10 14:44:37.713812578 +0200
@@ -90,4 +90,12 @@ 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);
+
+/* Handle an solib event by calling solib_add. */
+
+extern void handle_solib_event (void);
+
#endif /* SOLIB_H */
Index: gdb-7.6/gdb/solist.h
===================================================================
--- gdb-7.6.orig/gdb/solist.h 2013-01-01 07:32:51.000000000 +0100
+++ gdb-7.6/gdb/solist.h 2013-06-10 14:44:37.713812578 +0200
@@ -148,6 +148,19 @@ struct target_so_ops
core file (in particular, for readonly sections). */
int (*keep_data_in_core) (CORE_ADDR vaddr,
unsigned long size);
+
+ /* Enable or disable optional solib event breakpoints as
+ appropriate. This should be called whenever
+ stop_on_solib_events is changed. This pointer can be
+ NULL, in which case no enabling or disabling is necessary
+ for this target. */
+ void (*update_breakpoints) (void);
+
+ /* Target-specific processing of solib events that will be
+ performed before solib_add is called. This pointer can be
+ NULL, in which case no specific preprocessing is necessary
+ for this target. */
+ void (*handle_event) (void);
};
/* Free the memory associated with a (so_list *). */
Index: gdb-7.6/gdb/breakpoint.c
===================================================================
--- gdb-7.6.orig/gdb/breakpoint.c 2013-05-19 16:16:20.606087208 +0200
+++ gdb-7.6/gdb/breakpoint.c 2013-05-19 16:21:55.288805269 +0200
@@ -5361,25 +5361,6 @@ handle_jit_event (void)
--- gdb-7.6.orig/gdb/breakpoint.c 2013-06-10 14:44:37.500812642 +0200
+++ gdb-7.6/gdb/breakpoint.c 2013-06-10 14:44:57.301806708 +0200
@@ -5348,25 +5348,6 @@ handle_jit_event (void)
target_terminal_inferior ();
}

View File

@ -1,165 +1,31 @@
http://sourceware.org/ml/gdb-patches/2013-05/msg00631.html
Subject: [RFA 6/7] Linker-debugger interface tests by Jan
http://sourceware.org/ml/gdb-cvs/2013-06/msg00019.html
--IYV9cRr2u6rjcP4B
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
This patch updates the testsuite to cope with some changes resulting
from the probes-based interface, and adds a new test. This patch is
principally the work of Jan Kratochvil.
--IYV9cRr2u6rjcP4B
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="rtld-probes-6-tests-jk.patch"
2013-05-16 Jan Kratochvil <jan.kratochvil@redhat.com>
Gary Benson <gbenson@redhat.com>
* lib/gdb.exp (build_executable_from_specs): Use gdb_compile_pthread,
gdb_compile_shlib or gdb_compile_shlib_pthreads where appropriate.
* lib/prelink-support.exp (build_executable_own_libs): Allow INTERP
to be set to "no" to indicate that no ld.so copy should be made.
* gdb.base/break-interp.exp (solib_bp): New constant.
(reach_1): Use the above instead of "_dl_debug_state".
(test_attach): Likewise.
(test_ld): Likewise.
* gdb.threads/dlopen-libpthread.exp: New file.
* gdb.threads/dlopen-libpthread.c: Likewise.
* gdb.threads/dlopen-libpthread-lib.c: Likewise.
* gdb.base/solib-corrupted.exp: Disable test if GDB is using probes.
Index: gdb-7.6/gdb/testsuite/lib/gdb.exp
===================================================================
--- gdb-7.6.orig/gdb/testsuite/lib/gdb.exp 2013-05-19 16:05:37.881840646 +0200
+++ gdb-7.6/gdb/testsuite/lib/gdb.exp 2013-05-19 16:06:10.436822964 +0200
@@ -4011,22 +4011,6 @@ proc build_executable_from_specs {testna
set binfile [standard_output_file $executable]
- set objects {}
- set i 0
- foreach {s local_options} $args {
- if { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $local_options] != "" } {
- untested $testname
- return -1
- }
- lappend objects "${binfile}${i}.o"
- incr i
- }
-
- if { [gdb_compile $objects "${binfile}" executable $options] != "" } {
- untested $testname
- return -1
- }
-
set info_options ""
if { [lsearch -exact $options "c++"] >= 0 } {
set info_options "c++"
@@ -4034,6 +4018,42 @@ proc build_executable_from_specs {testna
if [get_compiler_info ${info_options}] {
return -1
}
### src/gdb/testsuite/ChangeLog 2013/05/30 00:25:16 1.3682
### src/gdb/testsuite/ChangeLog 2013/06/04 13:23:31 1.3683
## -1,3 +1,19 @@
+2013-06-04 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Gary Benson <gbenson@redhat.com>
+
+ set binfile [standard_output_file $executable]
+ * lib/gdb.exp (build_executable_from_specs): Use gdb_compile_pthread,
+ gdb_compile_shlib or gdb_compile_shlib_pthreads where appropriate.
+ * lib/prelink-support.exp (build_executable_own_libs): Allow INTERP
+ to be set to "no" to indicate that no ld.so copy should be made.
+ * gdb.base/break-interp.exp (solib_bp): New constant.
+ (reach_1): Use the above instead of "_dl_debug_state".
+ (test_attach): Likewise.
+ (test_ld): Likewise.
+ * gdb.threads/dlopen-libpthread.exp: New file.
+ * gdb.threads/dlopen-libpthread.c: Likewise.
+ * gdb.threads/dlopen-libpthread-lib.c: Likewise.
+ * gdb.base/solib-corrupted.exp: Disable test if GDB is using probes.
+
+ set func gdb_compile
+ set func_index [lsearch -regexp $options {^(pthreads|shlib|shlib_pthreads)$}]
+ if {$func_index != -1} {
+ set func "${func}_[lindex $options $func_index]"
+ }
+
+ # gdb_compile_shlib and gdb_compile_shlib_pthreads do not use the 3rd
+ # parameter. They also requires $sources while gdb_compile and
+ # gdb_compile_pthreads require $objects. Moreover they ignore any options.
+ if [string match gdb_compile_shlib* $func] {
+ set sources_path {}
+ foreach {s local_options} $args {
+ lappend sources_path "${srcdir}/${subdir}/${s}"
+ }
+ set ret [$func $sources_path "${binfile}" $options]
+ } else {
+ set objects {}
+ set i 0
+ foreach {s local_options} $args {
+ if { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $local_options] != "" } {
+ untested $testname
+ return -1
+ }
+ lappend objects "${binfile}${i}.o"
+ incr i
+ }
+ set ret [$func $objects "${binfile}" executable $options]
+ }
+ if { $ret != "" } {
+ untested $testname
+ return -1
+ }
+
return 0
}
Index: gdb-7.6/gdb/testsuite/lib/prelink-support.exp
===================================================================
--- gdb-7.6.orig/gdb/testsuite/lib/prelink-support.exp 2013-05-19 16:05:37.881840646 +0200
+++ gdb-7.6/gdb/testsuite/lib/prelink-support.exp 2013-05-19 16:05:39.100839980 +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
# INTERP may be used to specify a loader (ld.so) to be used that is
-# different from the default system one. Libraries on which the executable
-# depends are copied into directory DIR. Default DIR value to
+# different from the default system one. INTERP can be set to "no" if no ld.so
+# copy should be made. Libraries on which the executable depends are copied
+# into directory DIR. Default DIR value to
# `${objdir}/${subdir}/${EXECUTABLE}.d'.
#
# In case of success, return a string containing the arguments to be used
@@ -151,8 +152,15 @@ proc build_executable_own_libs {testname
if {$interp == ""} {
set interp_system [section_get $binfile .interp]
- set interp ${dir}/[file tail $interp_system]
- file_copy $interp_system $interp
+ if {$interp_system == ""} {
+ fail "$test could not find .interp"
+ } else {
+ set interp ${dir}/[file tail $interp_system]
+ file_copy $interp_system $interp
+ }
+ }
+ if {$interp == "no"} {
+ set interp ""
}
set dests {}
@@ -164,13 +172,19 @@ proc build_executable_own_libs {testname
# Do not lappend it so that "-rpath $dir" overrides any possible "-rpath"s
# specified by the caller to be able to link it for ldd" above.
- set options [linsert $options 0 "ldflags=-Wl,--dynamic-linker,$interp,-rpath,$dir"]
+ set options [linsert $options 0 "ldflags=-Wl,-rpath,$dir"]
+ if {$interp != ""} {
+ set options [linsert $options 0 "ldflags=-Wl,--dynamic-linker,$interp"]
+ }
if {[build_executable $testname $executable $sources $options] == -1} {
return ""
}
- set prelink_args "--dynamic-linker=$interp --ld-library-path=$dir $binfile $interp [concat $dests]"
+ set prelink_args "--ld-library-path=$dir $binfile [concat $dests]"
+ if {$interp != ""} {
+ set prelink_args "--dynamic-linker=$interp $prelink_args $interp"
+ }
return $prelink_args
}
2013-05-30 Yao Qi <yao@codesourcery.com>
* gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed):
Index: gdb-7.6/gdb/testsuite/gdb.base/break-interp.exp
===================================================================
--- gdb-7.6.orig/gdb/testsuite/gdb.base/break-interp.exp 2013-05-19 16:05:37.882840646 +0200
+++ gdb-7.6/gdb/testsuite/gdb.base/break-interp.exp 2013-05-19 16:05:39.101839979 +0200
--- gdb-7.6.orig/gdb/testsuite/gdb.base/break-interp.exp 2013-06-10 14:29:24.815123941 +0200
+++ gdb-7.6/gdb/testsuite/gdb.base/break-interp.exp 2013-06-10 14:30:18.086102375 +0200
@@ -109,12 +109,19 @@ proc strip_debug {dest} {
}
}
@ -255,12 +121,146 @@ Index: gdb-7.6/gdb/testsuite/gdb.base/break-interp.exp
# Use two separate gdb_test_multiple statements to avoid timeouts due
# to slow processing of wildcard capturing long output
Index: gdb-7.6/gdb/testsuite/gdb.base/solib-corrupted.exp
===================================================================
--- gdb-7.6.orig/gdb/testsuite/gdb.base/solib-corrupted.exp 2013-06-10 14:29:24.816123941 +0200
+++ gdb-7.6/gdb/testsuite/gdb.base/solib-corrupted.exp 2013-06-10 14:30:18.086102375 +0200
@@ -36,6 +36,33 @@ if ![runto_main] {
return
}
+# With probes interface GDB no longer scans the inferior library list so its
+# corruption cannot be tested. There is no way to disable the probes
+# interface.
+
+set probes { init_start init_complete map_start reloc_complete unmap_start
+ unmap_complete }
+set test "info probes"
+gdb_test_multiple $test $test {
+ -re "^rtld\[ \t\]+(?:rtld_)?(\[a-z_\]+)\[ \t\]" {
+ set idx [lsearch -exact $probes $expect_out(1,string)]
+ if { $idx >= 0 } {
+ set probes [lreplace $probes $idx $idx]
+ }
+ exp_continue
+ }
+ -re "^\[^\r\n\]*\r\n" {
+ exp_continue
+ }
+ -re "^$gdb_prompt $" {
+ }
+}
+if { [llength $probes] == 0 } {
+ xfail $test
+ untested "GDB is using probes"
+ return
+}
+
gdb_test "info sharedlibrary" "From * To .*" "normal list"
# GDB checks there for matching L_PREV.
Index: gdb-7.6/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c 2013-06-10 14:30:18.086102375 +0200
@@ -0,0 +1,40 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2011-2013 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 <pthread.h>
+#include <assert.h>
+
+static void *
+tfunc (void *arg)
+{
+ void (*notifyp) (void) = arg;
+
+ notifyp ();
+}
+
+void
+f (void (*notifyp) (void))
+{
+ pthread_t t;
+ int i;
+
+ i = pthread_create (&t, NULL, tfunc, notifyp);
+ assert (i == 0);
+
+ i = pthread_join (t, NULL);
+ assert (i == 0);
+}
Index: gdb-7.6/gdb/testsuite/gdb.threads/dlopen-libpthread.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6/gdb/testsuite/gdb.threads/dlopen-libpthread.c 2013-06-10 14:30:18.087102375 +0200
@@ -0,0 +1,46 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2011-2013 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 <dlfcn.h>
+#include <stddef.h>
+#include <assert.h>
+
+static const char *volatile filename;
+
+static void
+notify (void)
+{
+ filename = NULL; /* notify-here */
+}
+
+int
+main (void)
+{
+ void *h;
+ void (*fp) (void (*) (void));
+
+ assert (filename != NULL);
+ h = dlopen (filename, RTLD_LAZY);
+ assert (h != NULL);
+
+ fp = dlsym (h, "f");
+ assert (fp != NULL);
+
+ fp (notify);
+
+ return 0;
+}
Index: gdb-7.6/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6/gdb/testsuite/gdb.threads/dlopen-libpthread.exp 2013-05-19 16:05:39.101839979 +0200
+++ gdb-7.6/gdb/testsuite/gdb.threads/dlopen-libpthread.exp 2013-06-10 14:30:18.087102375 +0200
@@ -0,0 +1,74 @@
+# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011-2013 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
@ -334,137 +334,129 @@ Index: gdb-7.6/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.6/gdb/testsuite/gdb.threads/dlopen-libpthread.c
Index: gdb-7.6/gdb/testsuite/lib/gdb.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6/gdb/testsuite/gdb.threads/dlopen-libpthread.c 2013-05-19 16:05:39.101839979 +0200
@@ -0,0 +1,46 @@
+/* This testcase is part of GDB, the GNU debugger.
--- gdb-7.6.orig/gdb/testsuite/lib/gdb.exp 2013-06-10 14:29:24.819123940 +0200
+++ gdb-7.6/gdb/testsuite/lib/gdb.exp 2013-06-10 14:30:44.654092140 +0200
@@ -4011,22 +4011,6 @@ proc build_executable_from_specs {testna
set binfile [standard_output_file $executable]
- set objects {}
- set i 0
- foreach {s local_options} $args {
- if { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $local_options] != "" } {
- untested $testname
- return -1
- }
- lappend objects "${binfile}${i}.o"
- incr i
- }
-
- if { [gdb_compile $objects "${binfile}" executable $options] != "" } {
- untested $testname
- return -1
- }
-
set info_options ""
if { [lsearch -exact $options "c++"] >= 0 } {
set info_options "c++"
@@ -4034,6 +4018,42 @@ proc build_executable_from_specs {testna
if [get_compiler_info ${info_options}] {
return -1
}
+
+ Copyright 2011 Free Software Foundation, Inc.
+ set binfile [standard_output_file $executable]
+
+ 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.
+ set func gdb_compile
+ set func_index [lsearch -regexp $options {^(pthreads|shlib|shlib_pthreads)$}]
+ if {$func_index != -1} {
+ set func "${func}_[lindex $options $func_index]"
+ }
+
+ 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.
+ # gdb_compile_shlib and gdb_compile_shlib_pthreads do not use the 3rd
+ # parameter. They also requires $sources while gdb_compile and
+ # gdb_compile_pthreads require $objects. Moreover they ignore any options.
+ if [string match gdb_compile_shlib* $func] {
+ set sources_path {}
+ foreach {s local_options} $args {
+ lappend sources_path "${srcdir}/${subdir}/${s}"
+ }
+ set ret [$func $sources_path "${binfile}" $options]
+ } else {
+ set objects {}
+ set i 0
+ foreach {s local_options} $args {
+ if { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $local_options] != "" } {
+ untested $testname
+ return -1
+ }
+ lappend objects "${binfile}${i}.o"
+ incr i
+ }
+ set ret [$func $objects "${binfile}" executable $options]
+ }
+ if { $ret != "" } {
+ untested $testname
+ return -1
+ }
+
+ 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 <dlfcn.h>
+#include <stddef.h>
+#include <assert.h>
+
+static const char *volatile filename;
+
+static void
+notify (void)
+{
+ filename = NULL; /* notify-here */
+}
+
+int
+main (void)
+{
+ void *h;
+ void (*fp) (void (*) (void));
+
+ assert (filename != NULL);
+ h = dlopen (filename, RTLD_LAZY);
+ assert (h != NULL);
+
+ fp = dlsym (h, "f");
+ assert (fp != NULL);
+
+ fp (notify);
+
+ return 0;
+}
Index: gdb-7.6/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c 2013-05-19 16:05:39.101839979 +0200
@@ -0,0 +1,40 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2011 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 <pthread.h>
+#include <assert.h>
+
+static void *
+tfunc (void *arg)
+{
+ void (*notifyp) (void) = arg;
+
+ notifyp ();
+}
+
+void
+f (void (*notifyp) (void))
+{
+ pthread_t t;
+ int i;
+
+ i = pthread_create (&t, NULL, tfunc, notifyp);
+ assert (i == 0);
+
+ i = pthread_join (t, NULL);
+ assert (i == 0);
+}
Index: gdb-7.6/gdb/testsuite/gdb.base/solib-corrupted.exp
===================================================================
--- gdb-7.6.orig/gdb/testsuite/gdb.base/solib-corrupted.exp 2013-05-19 16:05:37.883840645 +0200
+++ gdb-7.6/gdb/testsuite/gdb.base/solib-corrupted.exp 2013-05-19 16:05:39.102839978 +0200
@@ -36,6 +36,33 @@ if ![runto_main] {
return
return 0
}
+# With probes interface GDB no longer scans the inferior library list so its
+# corruption cannot be tested. There is no way to disable the probes
+# interface.
+
+set probes { init_start init_complete map_start reloc_complete unmap_start
+ unmap_complete }
+set test "info probes"
+gdb_test_multiple $test $test {
+ -re "^rtld\[ \t\]+(?:rtld_)?(\[a-z_\]+)\[ \t\]" {
+ set idx [lsearch -exact $probes $expect_out(1,string)]
+ if { $idx >= 0 } {
+ set probes [lreplace $probes $idx $idx]
+ }
+ exp_continue
+ }
+ -re "^\[^\r\n\]*\r\n" {
+ exp_continue
+ }
+ -re "^$gdb_prompt $" {
+ }
+}
+if { [llength $probes] == 0 } {
+ xfail $test
+ untested "GDB is using probes"
+ return
+}
+
gdb_test "info sharedlibrary" "From * To .*" "normal list"
Index: gdb-7.6/gdb/testsuite/lib/prelink-support.exp
===================================================================
--- gdb-7.6.orig/gdb/testsuite/lib/prelink-support.exp 2013-06-10 14:29:24.819123940 +0200
+++ gdb-7.6/gdb/testsuite/lib/prelink-support.exp 2013-06-10 14:30:18.089102374 +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
# INTERP may be used to specify a loader (ld.so) to be used that is
-# different from the default system one. Libraries on which the executable
-# depends are copied into directory DIR. Default DIR value to
+# different from the default system one. INTERP can be set to "no" if no ld.so
+# copy should be made. Libraries on which the executable depends are copied
+# into directory DIR. Default DIR value to
# `${objdir}/${subdir}/${EXECUTABLE}.d'.
#
# In case of success, return a string containing the arguments to be used
@@ -151,8 +152,15 @@ proc build_executable_own_libs {testname
if {$interp == ""} {
set interp_system [section_get $binfile .interp]
- set interp ${dir}/[file tail $interp_system]
- file_copy $interp_system $interp
+ if {$interp_system == ""} {
+ fail "$test could not find .interp"
+ } else {
+ set interp ${dir}/[file tail $interp_system]
+ file_copy $interp_system $interp
+ }
+ }
+ if {$interp == "no"} {
+ set interp ""
}
set dests {}
@@ -164,13 +172,19 @@ proc build_executable_own_libs {testname
# Do not lappend it so that "-rpath $dir" overrides any possible "-rpath"s
# specified by the caller to be able to link it for ldd" above.
- set options [linsert $options 0 "ldflags=-Wl,--dynamic-linker,$interp,-rpath,$dir"]
+ set options [linsert $options 0 "ldflags=-Wl,-rpath,$dir"]
+ if {$interp != ""} {
+ set options [linsert $options 0 "ldflags=-Wl,--dynamic-linker,$interp"]
+ }
if {[build_executable $testname $executable $sources $options] == -1} {
return ""
}
- set prelink_args "--dynamic-linker=$interp --ld-library-path=$dir $binfile $interp [concat $dests]"
+ set prelink_args "--ld-library-path=$dir $binfile [concat $dests]"
+ if {$interp != ""} {
+ set prelink_args "--dynamic-linker=$interp $prelink_args $interp"
+ }
return $prelink_args
}
# GDB checks there for matching L_PREV.

View File

@ -1,34 +1,83 @@
http://sourceware.org/ml/gdb-patches/2013-05/msg00630.html
Subject: [RFA 7/7] Linker-debugger interface tests
http://sourceware.org/ml/gdb-cvs/2013-06/msg00020.html
--DCA/C9WSnDtl50zu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
This patch adds some testcases for the linker-debugger interface.
--DCA/C9WSnDtl50zu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="rtld-probes-7-tests-gb.patch"
2013-05-16 Gary Benson <gbenson@redhat.com>
* gdb.base/break-probes.exp: New file.
* gdb.base/break-probes.c: Likewise.
* gdb.base/break-probes-solib.c: Likewise.
* gdb.base/info-shared.exp: New file.
* gdb.base/info-shared.c: Likewise.
* gdb.base/info-shared-solib1.c: Likewise.
* gdb.base/info-shared-solib2.c: Likewise.
diff --git a/gdb/testsuite/gdb.base/break-probes.exp b/gdb/testsuite/gdb.base/break-probes.exp
new file mode 100644
index 0000000..8372636
--- /dev/null
+++ b/gdb/testsuite/gdb.base/break-probes.exp
@@ -0,0 +1,77 @@
+# Copyright 2013 Free Software Foundation, Inc.
### src/gdb/testsuite/ChangeLog 2013/06/04 13:23:31 1.3683
### src/gdb/testsuite/ChangeLog 2013/06/04 13:31:00 1.3684
## -1,3 +1,13 @@
+2013-06-04 Gary Benson <gbenson@redhat.com>
+
+ * gdb.base/break-probes.exp: New file.
+ * gdb.base/break-probes.c: Likewise.
+ * gdb.base/break-probes-solib.c: Likewise.
+ * gdb.base/info-shared.exp: New file.
+ * gdb.base/info-shared.c: Likewise.
+ * gdb.base/info-shared-solib1.c: Likewise.
+ * gdb.base/info-shared-solib2.c: Likewise.
+
2013-06-04 Jan Kratochvil <jan.kratochvil@redhat.com>
Gary Benson <gbenson@redhat.com>
--- src/gdb/testsuite/gdb.base/break-probes-solib.c
+++ src/gdb/testsuite/gdb.base/break-probes-solib.c 2013-06-10 12:15:11.548935413 +0000
@@ -0,0 +1,22 @@
+/* Copyright 2012-2013 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 <stdio.h>
+
+int
+foo (int n)
+{
+ return n * n / 17;
+}
--- src/gdb/testsuite/gdb.base/break-probes.c
+++ src/gdb/testsuite/gdb.base/break-probes.c 2013-06-10 12:15:12.047717383 +0000
@@ -0,0 +1,30 @@
+/* Copyright 2012-2013 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 <dlfcn.h>
+#include <assert.h>
+#include <stddef.h>
+
+int
+main (void)
+{
+ void *handle = dlopen (SHLIB_NAME, RTLD_LAZY);
+
+ assert (handle != NULL);
+
+ dlclose (handle);
+
+ return 0;
+}
--- src/gdb/testsuite/gdb.base/break-probes.exp
+++ src/gdb/testsuite/gdb.base/break-probes.exp 2013-06-10 12:15:12.620368040 +0000
@@ -0,0 +1,78 @@
+# Copyright 2012-2013 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
@ -63,7 +112,7 @@ index 0000000..8372636
+}
+
+if { [prepare_for_testing $testfile.exp $testfile $srcfile \
+ [list additional_flags=-DSHLIB_NAME\=\"$binfile_lib\" libs=-ldl]] } {
+ [list additional_flags=-DSHLIB_NAME=\"$binfile_lib\" libs=-ldl]] } {
+ return -1
+}
+
@ -79,7 +128,7 @@ index 0000000..8372636
+set using_probes 0
+gdb_test_multiple "bt" $test {
+ -re "#0 +\[^\r\n\]*\\m(__GI_)?$normal_bp\\M.*$gdb_prompt $" {
+ xfail $test
+ untested "probes not present on this system"
+ }
+ -re "#0 +\[^\r\n\]*\\m(__GI_)?$probes_bp\\M.*$gdb_prompt $" {
+ pass $test
@ -90,14 +139,15 @@ index 0000000..8372636
+if { $using_probes } {
+ # Run til it loads our library
+ set test "run til our library loads"
+ set loaded_library 0
+ while { !$loaded_library } {
+ set not_loaded_library 1
+ while { $not_loaded_library } {
+ set not_loaded_library 0
+ gdb_test_multiple "c" $test {
+ -re "Inferior loaded $binfile_lib\\M.*$gdb_prompt $" {
+ pass $test
+ set loaded_library 1
+ }
+ -re "Stopped due to shared library event\\M.*$gdb_prompt $" {
+ set not_loaded_library 1
+ }
+ }
+ }
@ -105,45 +155,10 @@ index 0000000..8372636
+ # Call something to ensure that relocation occurred
+ gdb_test "call foo(23)" "\\\$.* = 31.*\\\M.*"
+}
diff --git a/gdb/testsuite/gdb.base/break-probes.c b/gdb/testsuite/gdb.base/break-probes.c
new file mode 100644
index 0000000..a778099
--- /dev/null
+++ b/gdb/testsuite/gdb.base/break-probes.c
@@ -0,0 +1,26 @@
+/* Copyright 2013 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 <dlfcn.h>
+
+int
+main ()
+{
+ void *handle = dlopen (SHLIB_NAME, RTLD_LAZY);
+
+ dlclose (handle);
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/break-probes-solib.c b/gdb/testsuite/gdb.base/break-probes-solib.c
new file mode 100644
index 0000000..bdde2db
--- /dev/null
+++ b/gdb/testsuite/gdb.base/break-probes-solib.c
@@ -0,0 +1,22 @@
+/* Copyright 2013 Free Software Foundation, Inc.
--- src/gdb/testsuite/gdb.base/info-shared-solib1.c
+++ src/gdb/testsuite/gdb.base/info-shared-solib1.c 2013-06-10 12:15:14.399129288 +0000
@@ -0,0 +1,24 @@
+/* Copyright 2012-2013 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
@ -163,15 +178,96 @@ index 0000000..bdde2db
+int
+foo (int n)
+{
+ return n * n / 17;
+ printf ("foo %d\n", n);
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/info-shared.exp b/gdb/testsuite/gdb.base/info-shared.exp
new file mode 100644
index 0000000..1dabb9f
--- /dev/null
+++ b/gdb/testsuite/gdb.base/info-shared.exp
@@ -0,0 +1,145 @@
+# Copyright 2013 Free Software Foundation, Inc.
--- src/gdb/testsuite/gdb.base/info-shared-solib2.c
+++ src/gdb/testsuite/gdb.base/info-shared-solib2.c 2013-06-10 12:15:14.930135742 +0000
@@ -0,0 +1,24 @@
+/* Copyright 2012-2013 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 <stdio.h>
+
+int
+bar (int n)
+{
+ printf ("bar %d\n", n);
+
+ return 0;
+}
--- src/gdb/testsuite/gdb.base/info-shared.c
+++ src/gdb/testsuite/gdb.base/info-shared.c 2013-06-10 12:15:15.395474819 +0000
@@ -0,0 +1,52 @@
+/* Copyright 2012-2013 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 <dlfcn.h>
+#include <assert.h>
+#include <stddef.h>
+
+void
+stop (void)
+{
+}
+
+int
+main (void)
+{
+ void *handle1, *handle2;
+ void (*func)(int);
+
+ handle1 = dlopen (SHLIB1_NAME, RTLD_LAZY);
+ assert (handle1 != NULL);
+ stop ();
+
+ handle2 = dlopen (SHLIB2_NAME, RTLD_LAZY);
+ assert (handle2 != NULL);
+ stop ();
+
+ func = (void (*)(int)) dlsym (handle1, "foo");
+ func (1);
+
+ func = (void (*)(int)) dlsym (handle2, "bar");
+ func (2);
+
+ dlclose (handle1);
+ stop ();
+
+ dlclose (handle2);
+ stop ();
+
+ return 0;
+}
--- src/gdb/testsuite/gdb.base/info-shared.exp
+++ src/gdb/testsuite/gdb.base/info-shared.exp 2013-06-10 12:15:15.891450285 +0000
@@ -0,0 +1,146 @@
+# Copyright 2012-2013 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
@ -195,12 +291,12 @@ index 0000000..1dabb9f
+set lib1name $testfile-solib1
+set srcfile_lib1 $srcdir/$subdir/$lib1name.c
+set binfile_lib1 [standard_output_file $lib1name.so]
+set define1 -DSHLIB1_NAME\=\"$binfile_lib1\"
+set define1 -DSHLIB1_NAME=\"$binfile_lib1\"
+
+set lib2name $testfile-solib2
+set srcfile_lib2 $srcdir/$subdir/$lib2name.c
+set binfile_lib2 [standard_output_file $lib2name.so]
+set define2 -DSHLIB2_NAME\=\"$binfile_lib2\"
+set define2 -DSHLIB2_NAME=\"$binfile_lib2\"
+
+if { [gdb_compile_shlib $srcfile_lib1 $binfile_lib1 \
+ [list additional_flags=-fPIC]] != "" } {
@ -251,28 +347,29 @@ index 0000000..1dabb9f
+
+# Start the inferior, and check neither of the libraries are loaded at
+# the start.
+runto_main
+if ![runto_main] {
+ return 0
+}
+check_info_shared "info sharedlibrary #1" 0 0
+
+# Set up breakpoints.
+gdb_test "break stop" {Breakpoint [0-9]+ at .*}
+gdb_test_no_output "set breakpoint pending on"
+gdb_test "break foo" {Breakpoint [0-9]+ \(foo\) pending\.}
+gdb_test "break bar" {Breakpoint [0-9]+ \(bar\) pending\.}
+gdb_breakpoint "stop"
+gdb_breakpoint "foo" allow-pending
+gdb_breakpoint "bar" allow-pending
+
+# Run to the first stop and check that only the first library is loaded.
+gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)}
+gdb_continue_to_breakpoint "library load #1" "stop .*"
+check_info_shared "info sharedlibrary #2" 1 0
+
+# Run to the second stop and check that both libraries are loaded.
+gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)}
+gdb_continue_to_breakpoint "library load #2" "stop .*"
+check_info_shared "info sharedlibrary #3" 1 1
+
+# Check that the next stop is in foo.
+gdb_test "c" {Breakpoint [0-9]+, .* in foo \(\) from .*}
+gdb_continue_to_breakpoint "library function #1" "foo .*"
+
+# Check that the next stop is in bar.
+gdb_test "c" {Breakpoint [0-9]+, .* in bar \(\) from .*}
+gdb_continue_to_breakpoint "library function #2" "bar .*"
+
+# Restart the inferior and make sure there are no breakpoint reset
+# errors. These can happen with the probes-based runtime linker
@ -280,7 +377,7 @@ index 0000000..1dabb9f
+set test "restart"
+gdb_run_cmd
+gdb_test_multiple "" $test {
+ -re {Start it from the beginning\? \(y or n\) } {
+ -re {Start it from the beginning\? \(y or n\) $} {
+ send_gdb "y\n"
+ exp_continue
+ }
@ -296,140 +393,23 @@ index 0000000..1dabb9f
+check_info_shared "info sharedlibrary #4" 0 0
+
+# Run to the first stop and check that only the first library is loaded.
+gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)}
+gdb_continue_to_breakpoint "library load #3" "stop .*"
+check_info_shared "info sharedlibrary #5" 1 0
+
+# Run to the second stop and check that both libraries are loaded.
+gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)}
+gdb_continue_to_breakpoint "library load #4" "stop .*"
+check_info_shared "info sharedlibrary #6" 1 1
+
+# Check that the next stop is in foo.
+gdb_test "c" {Breakpoint [0-9]+, .* in foo \(\) from .*}
+gdb_continue_to_breakpoint "library function #3" "foo .*"
+
+# Check that the next stop is in bar.
+gdb_test "c" {Breakpoint [0-9]+, .* in bar \(\) from .*}
+gdb_continue_to_breakpoint "library function #4" "bar .*"
+
+# Run to the next stop and check that the first library has been unloaded.
+gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)}
+gdb_continue_to_breakpoint "library unload #1" "stop .*"
+check_info_shared "info sharedlibrary #7" 0 1
+
+# Run to the last stop and check that both libraries are gone.
+gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)}
+gdb_continue_to_breakpoint "library unload #2" "stop .*"
+check_info_shared "info sharedlibrary #8" 0 0
diff --git a/gdb/testsuite/gdb.base/info-shared.c b/gdb/testsuite/gdb.base/info-shared.c
new file mode 100644
index 0000000..d699a11
--- /dev/null
+++ b/gdb/testsuite/gdb.base/info-shared.c
@@ -0,0 +1,48 @@
+/* Copyright 2013 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 <dlfcn.h>
+
+void
+stop ()
+{
+}
+
+int
+main ()
+{
+ void *handle1, *handle2;
+ void (*func)(int);
+
+ handle1 = dlopen (SHLIB1_NAME, RTLD_LAZY);
+ stop ();
+
+ handle2 = dlopen (SHLIB2_NAME, RTLD_LAZY);
+ stop ();
+
+ func = (void (*)(int)) dlsym (handle1, "foo");
+ func (1);
+
+ func = (void (*)(int)) dlsym (handle2, "bar");
+ func (2);
+
+ dlclose (handle1);
+ stop ();
+
+ dlclose (handle2);
+ stop ();
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/info-shared-solib1.c b/gdb/testsuite/gdb.base/info-shared-solib1.c
new file mode 100644
index 0000000..9979ee7
--- /dev/null
+++ b/gdb/testsuite/gdb.base/info-shared-solib1.c
@@ -0,0 +1,24 @@
+/* Copyright 2013 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 <stdio.h>
+
+int
+foo (int n)
+{
+ printf ("foo %d\n", n);
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/info-shared-solib2.c b/gdb/testsuite/gdb.base/info-shared-solib2.c
new file mode 100644
index 0000000..d4ed1e6
--- /dev/null
+++ b/gdb/testsuite/gdb.base/info-shared-solib2.c
@@ -0,0 +1,24 @@
+/* Copyright 2013 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 <stdio.h>
+
+int
+bar (int n)
+{
+ printf ("bar %d\n", n);
+
+ return 0;
+}
--DCA/C9WSnDtl50zu--

View File

@ -1,62 +0,0 @@
--- gdb-7.6-x/gdb/solib-svr4.c 2013-05-19 16:04:36.838874595 +0200
+++ gdb-7.6/gdb/solib-svr4.c 2013-05-19 16:12:35.112514978 +0200
@@ -1078,7 +1078,6 @@ svr4_free_library_list (void *p_list)
static struct so_list *
svr4_copy_library_list (struct so_list *src)
{
- struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
struct so_list *dst = NULL;
struct so_list **link = &dst;
@@ -1090,8 +1089,8 @@ svr4_copy_library_list (struct so_list *
memcpy (new, src, sizeof (struct so_list));
- new->lm_info = xmalloc (lmo->link_map_size);
- memcpy (new->lm_info, src->lm_info, lmo->link_map_size);
+ new->lm_info = xmalloc (sizeof (*new->lm_info));
+ memcpy (new->lm_info, src->lm_info, sizeof (*new->lm_info));
new->next = NULL;
*link = new;
@@ -1747,7 +1746,7 @@ solist_update_incremental (struct svr4_i
struct svr4_library_list library_list;
char annex[64];
- xsnprintf (annex, sizeof (annex), "start=%lx;prev=%lx", lm, prev_lm);
+ xsnprintf (annex, sizeof (annex), "start=%lx;prev=%lx", (unsigned long) lm, (unsigned long) prev_lm);
if (!svr4_current_sos_via_xfer_libraries (&library_list, annex))
return 0;
@@ -1813,7 +1812,10 @@ svr4_handle_solib_event (void)
goto error;
if (action == DO_NOTHING)
+{
+do_cleanups (old_chain);
return;
+}
/* EVALUATE_PROBE_ARGUMENT looks up symbols in the dynamic linker
using FIND_PC_SECTION. FIND_PC_SECTION is accelerated by a cache
--- gdb-7.6-x/gdb/testsuite/gdb.base/break-probes.exp 2013-05-19 16:06:19.452818090 +0200
+++ gdb-7.6/gdb/testsuite/gdb.base/break-probes.exp 2013-05-19 16:07:49.730770135 +0200
@@ -60,14 +60,15 @@ gdb_test_multiple "bt" $test {
if { $using_probes } {
# Run til it loads our library
set test "run til our library loads"
- set loaded_library 0
- while { !$loaded_library } {
+ set not_loaded_library 1
+ while { $not_loaded_library } {
+ set not_loaded_library 0
gdb_test_multiple "c" $test {
-re "Inferior loaded $binfile_lib\\M.*$gdb_prompt $" {
pass $test
- set loaded_library 1
}
-re "Stopped due to shared library event\\M.*$gdb_prompt $" {
+ set not_loaded_library 1
}
}
}

View File

@ -57,8 +57,8 @@ http://sourceware.org/ml/gdb-cvs/2013-05/msg00084.html
* symfile.c (syms_from_objfile_1): Delete args offsets, num_offsets.
Index: gdb-7.6/gdb/Makefile.in
===================================================================
--- gdb-7.6.orig/gdb/Makefile.in 2013-05-20 22:23:36.748215146 +0200
+++ gdb-7.6/gdb/Makefile.in 2013-05-20 22:25:52.096165773 +0200
--- gdb-7.6.orig/gdb/Makefile.in 2013-06-10 14:31:02.704084663 +0200
+++ gdb-7.6/gdb/Makefile.in 2013-06-10 14:31:08.351082443 +0200
@@ -284,6 +284,7 @@ SUBDIR_PYTHON_OBS = \
py-exitedevent.o \
py-finishbreakpoint.o \
@ -75,7 +75,7 @@ Index: gdb-7.6/gdb/Makefile.in
python/py-function.c \
python/py-gdb-readline.c \
python/py-inferior.c \
@@ -2135,6 +2137,10 @@ py-frame.o: $(srcdir)/python/py-frame.c
@@ -2174,6 +2176,10 @@ py-frame.o: $(srcdir)/python/py-frame.c
$(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-frame.c
$(POSTCOMPILE)
@ -88,8 +88,8 @@ Index: gdb-7.6/gdb/Makefile.in
$(POSTCOMPILE)
Index: gdb-7.6/gdb/NEWS
===================================================================
--- gdb-7.6.orig/gdb/NEWS 2013-05-20 22:23:36.748215146 +0200
+++ gdb-7.6/gdb/NEWS 2013-05-20 22:25:52.097165772 +0200
--- gdb-7.6.orig/gdb/NEWS 2013-06-10 14:31:08.353082442 +0200
+++ gdb-7.6/gdb/NEWS 2013-06-10 14:31:21.230077319 +0200
@@ -4,6 +4,10 @@
* Newly installed $prefix/bin/gcore acts as a shell interface for the
GDB command gcore.
@ -98,13 +98,13 @@ Index: gdb-7.6/gdb/NEWS
+
+ ** Frame filters and frame decorators have been added.
+
*** Changes in GDB 7.6
* New remote packets
* Target record has been renamed to record-full.
qXfer:libraries-svr4:read's annex
Index: gdb-7.6/gdb/stack.c
===================================================================
--- gdb-7.6.orig/gdb/stack.c 2013-05-20 22:23:36.748215146 +0200
+++ gdb-7.6/gdb/stack.c 2013-05-20 22:25:52.098165772 +0200
--- gdb-7.6.orig/gdb/stack.c 2013-06-10 14:31:02.709084661 +0200
+++ gdb-7.6/gdb/stack.c 2013-06-10 14:31:08.354082441 +0200
@@ -54,6 +54,7 @@
#include "psymtab.h"
@ -329,8 +329,8 @@ Index: gdb-7.6/gdb/stack.c
{
Index: gdb-7.6/gdb/data-directory/Makefile.in
===================================================================
--- gdb-7.6.orig/gdb/data-directory/Makefile.in 2013-05-20 22:23:36.748215146 +0200
+++ gdb-7.6/gdb/data-directory/Makefile.in 2013-05-20 22:25:52.098165772 +0200
--- gdb-7.6.orig/gdb/data-directory/Makefile.in 2013-06-10 14:31:02.710084660 +0200
+++ gdb-7.6/gdb/data-directory/Makefile.in 2013-06-10 14:31:08.355082441 +0200
@@ -53,7 +53,11 @@ PYTHON_DIR = python
PYTHON_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(PYTHON_DIR)
PYTHON_FILES = \
@ -345,9 +345,9 @@ Index: gdb-7.6/gdb/data-directory/Makefile.in
gdb/command/type_printers.py \
Index: gdb-7.6/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.6.orig/gdb/doc/gdb.texinfo 2013-05-20 22:23:36.748215146 +0200
+++ gdb-7.6/gdb/doc/gdb.texinfo 2013-05-20 22:25:52.110165767 +0200
@@ -6453,6 +6453,7 @@ currently executing frame and describes
--- gdb-7.6.orig/gdb/doc/gdb.texinfo 2013-06-10 14:31:02.727084654 +0200
+++ gdb-7.6/gdb/doc/gdb.texinfo 2013-06-10 14:31:08.364082438 +0200
@@ -6459,6 +6459,7 @@ currently executing frame and describes
@menu
* Frames:: Stack frames
* Backtrace:: Backtraces
@ -355,7 +355,7 @@ Index: gdb-7.6/gdb/doc/gdb.texinfo
* Selection:: Selecting a frame
* Frame Info:: Information on a frame
@@ -6540,6 +6541,7 @@ line per frame, for many frames, startin
@@ -6546,6 +6547,7 @@ line per frame, for many frames, startin
frame (frame zero), followed by its caller (frame one), and on up the
stack.
@ -363,7 +363,7 @@ Index: gdb-7.6/gdb/doc/gdb.texinfo
@table @code
@kindex backtrace
@kindex bt @r{(@code{backtrace})}
@@ -6565,6 +6567,19 @@ Similar, but print only the outermost @v
@@ -6571,6 +6573,19 @@ Similar, but print only the outermost @v
@itemx bt full -@var{n}
Print the values of the local variables also. @var{n} specifies the
number of frames to print, as described above.
@ -383,7 +383,7 @@ Index: gdb-7.6/gdb/doc/gdb.texinfo
@end table
@kindex where
@@ -6714,6 +6729,149 @@ Display an absolute filename.
@@ -6720,6 +6735,149 @@ Display an absolute filename.
Show the current way to display filenames.
@end table
@ -533,7 +533,7 @@ Index: gdb-7.6/gdb/doc/gdb.texinfo
@node Selection
@section Selecting a Frame
@@ -23065,6 +23223,9 @@ situation, a Python @code{KeyboardInterr
@@ -23100,6 +23258,9 @@ situation, a Python @code{KeyboardInterr
* Selecting Pretty-Printers:: How GDB chooses a pretty-printer.
* Writing a Pretty-Printer:: Writing a Pretty-Printer.
* Type Printing API:: Pretty-printing types.
@ -543,7 +543,7 @@ Index: gdb-7.6/gdb/doc/gdb.texinfo
* Inferiors In Python:: Python representation of inferiors (processes)
* Events In Python:: Listening for events from @value{GDBN}.
* Threads In Python:: Accessing inferior threads from Python.
@@ -24415,6 +24576,636 @@ done then type printers would have to ma
@@ -24450,6 +24611,636 @@ done then type printers would have to ma
order to avoid holding information that could become stale as the
inferior changed.
@ -1180,7 +1180,7 @@ Index: gdb-7.6/gdb/doc/gdb.texinfo
@node Inferiors In Python
@subsubsection Inferiors In Python
@cindex inferiors in Python
@@ -25245,6 +26036,11 @@ The @code{type_printers} attribute is a
@@ -25280,6 +26071,11 @@ The @code{type_printers} attribute is a
@xref{Type Printing API}, for more information.
@end defvar
@ -1192,7 +1192,7 @@ Index: gdb-7.6/gdb/doc/gdb.texinfo
@node Objfiles In Python
@subsubsection Objfiles In Python
@@ -25295,6 +26091,11 @@ The @code{type_printers} attribute is a
@@ -25330,6 +26126,11 @@ The @code{type_printers} attribute is a
@xref{Type Printing API}, for more information.
@end defvar
@ -1204,7 +1204,7 @@ Index: gdb-7.6/gdb/doc/gdb.texinfo
A @code{gdb.Objfile} object has the following methods:
@defun Objfile.is_valid ()
@@ -26313,7 +27114,7 @@ No my-foo-pretty-printers.py
@@ -26348,7 +27149,7 @@ No my-foo-pretty-printers.py
When reading an auto-loaded file, @value{GDBN} sets the
@dfn{current objfile}. This is available via the @code{gdb.current_objfile}
function (@pxref{Objfiles In Python}). This can be useful for
@ -1213,7 +1213,7 @@ Index: gdb-7.6/gdb/doc/gdb.texinfo
@menu
* objfile-gdb.py file:: The @file{@var{objfile}-gdb.py} file
@@ -30184,6 +30985,22 @@ Is this going away????
@@ -30219,6 +31020,22 @@ Is this going away????
@node GDB/MI Stack Manipulation
@section @sc{gdb/mi} Stack Manipulation Commands
@ -1236,7 +1236,7 @@ Index: gdb-7.6/gdb/doc/gdb.texinfo
@subheading The @code{-stack-info-frame} Command
@findex -stack-info-frame
@@ -30251,13 +31068,14 @@ For a stack with frame levels 0 through
@@ -30286,13 +31103,14 @@ For a stack with frame levels 0 through
(gdb)
@end smallexample
@ -1252,7 +1252,7 @@ Index: gdb-7.6/gdb/doc/gdb.texinfo
[ @var{low-frame} @var{high-frame} ]
@end smallexample
@@ -30274,7 +31092,9 @@ If @var{print-values} is 0 or @code{--no
@@ -30309,7 +31127,9 @@ If @var{print-values} is 0 or @code{--no
the variables; if it is 1 or @code{--all-values}, print also their
values; and if it is 2 or @code{--simple-values}, print the name,
type and value for simple data types, and the name and type for arrays,
@ -1263,7 +1263,7 @@ Index: gdb-7.6/gdb/doc/gdb.texinfo
Use of this command to obtain arguments in a single frame is
deprecated in favor of the @samp{-stack-list-variables} command.
@@ -30345,13 +31165,14 @@ args=[@{name="intarg",value="2"@},
@@ -30380,13 +31200,14 @@ args=[@{name="intarg",value="2"@},
@c @subheading -stack-list-exception-handlers
@ -1279,7 +1279,7 @@ Index: gdb-7.6/gdb/doc/gdb.texinfo
@end smallexample
List the frames currently on the stack. For each frame it displays the
@@ -30381,7 +31202,9 @@ levels are between the two arguments (in
@@ -30416,7 +31237,9 @@ levels are between the two arguments (in
are equal, it shows the single frame at the corresponding level. It is
an error if @var{low-frame} is larger than the actual number of
frames. On the other hand, @var{high-frame} may be larger than the
@ -1290,7 +1290,7 @@ Index: gdb-7.6/gdb/doc/gdb.texinfo
@subsubheading @value{GDBN} Command
@@ -30451,11 +31274,12 @@ Show a single frame:
@@ -30486,11 +31309,12 @@ Show a single frame:
@subheading The @code{-stack-list-locals} Command
@findex -stack-list-locals
@ -1304,7 +1304,7 @@ Index: gdb-7.6/gdb/doc/gdb.texinfo
@end smallexample
Display the local variable names for the selected frame. If
@@ -30466,7 +31290,8 @@ type and value for simple data types, an
@@ -30501,7 +31325,8 @@ type and value for simple data types, an
structures and unions. In this last case, a frontend can immediately
display the value of simple data types and create variable objects for
other data types when the user wishes to explore their values in
@ -1314,7 +1314,7 @@ Index: gdb-7.6/gdb/doc/gdb.texinfo
This command is deprecated in favor of the
@samp{-stack-list-variables} command.
@@ -30491,13 +31316,14 @@ This command is deprecated in favor of t
@@ -30526,13 +31351,14 @@ This command is deprecated in favor of t
(gdb)
@end smallexample
@ -1330,7 +1330,7 @@ Index: gdb-7.6/gdb/doc/gdb.texinfo
@end smallexample
Display the names of local variables and function arguments for the selected frame. If
@@ -30505,7 +31331,8 @@ Display the names of local variables and
@@ -30540,7 +31366,8 @@ Display the names of local variables and
the variables; if it is 1 or @code{--all-values}, print also their
values; and if it is 2 or @code{--simple-values}, print the name,
type and value for simple data types, and the name and type for arrays,
@ -1342,8 +1342,8 @@ Index: gdb-7.6/gdb/doc/gdb.texinfo
Index: gdb-7.6/gdb/mi/mi-cmd-stack.c
===================================================================
--- gdb-7.6.orig/gdb/mi/mi-cmd-stack.c 2013-05-20 22:23:36.748215146 +0200
+++ gdb-7.6/gdb/mi/mi-cmd-stack.c 2013-05-20 22:25:52.111165767 +0200
--- gdb-7.6.orig/gdb/mi/mi-cmd-stack.c 2013-06-10 14:31:02.730084652 +0200
+++ gdb-7.6/gdb/mi/mi-cmd-stack.c 2013-06-10 14:31:08.365082437 +0200
@@ -31,6 +31,10 @@
#include "language.h"
#include "valprint.h"
@ -1655,8 +1655,8 @@ Index: gdb-7.6/gdb/mi/mi-cmd-stack.c
/* Print single local or argument. ARG must be already read in. For
Index: gdb-7.6/gdb/mi/mi-cmds.c
===================================================================
--- gdb-7.6.orig/gdb/mi/mi-cmds.c 2013-05-20 22:23:36.748215146 +0200
+++ gdb-7.6/gdb/mi/mi-cmds.c 2013-05-20 22:25:52.111165767 +0200
--- gdb-7.6.orig/gdb/mi/mi-cmds.c 2013-06-10 14:31:02.730084652 +0200
+++ gdb-7.6/gdb/mi/mi-cmds.c 2013-06-10 14:31:08.365082437 +0200
@@ -86,6 +86,7 @@ static struct mi_cmd mi_cmds[] =
mi_cmd_data_write_register_values),
DEF_MI_CMD_MI ("enable-timings", mi_cmd_enable_timings),
@ -1667,8 +1667,8 @@ Index: gdb-7.6/gdb/mi/mi-cmds.c
DEF_MI_CMD_MI ("environment-path", mi_cmd_env_path),
Index: gdb-7.6/gdb/mi/mi-cmds.h
===================================================================
--- gdb-7.6.orig/gdb/mi/mi-cmds.h 2013-05-20 22:23:36.748215146 +0200
+++ gdb-7.6/gdb/mi/mi-cmds.h 2013-05-20 22:25:52.111165767 +0200
--- gdb-7.6.orig/gdb/mi/mi-cmds.h 2013-06-10 14:31:02.730084652 +0200
+++ gdb-7.6/gdb/mi/mi-cmds.h 2013-06-10 14:31:08.365082437 +0200
@@ -118,6 +118,7 @@ extern mi_cmd_argv_ftype mi_cmd_var_show
extern mi_cmd_argv_ftype mi_cmd_var_show_format;
extern mi_cmd_argv_ftype mi_cmd_var_update;
@ -1680,7 +1680,7 @@ Index: gdb-7.6/gdb/mi/mi-cmds.h
Index: gdb-7.6/gdb/python/py-framefilter.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6/gdb/python/py-framefilter.c 2013-05-20 22:26:53.029143068 +0200
+++ gdb-7.6/gdb/python/py-framefilter.c 2013-06-10 14:31:08.366082437 +0200
@@ -0,0 +1,1528 @@
+/* Python frame filters
+
@ -3212,8 +3212,8 @@ Index: gdb-7.6/gdb/python/py-framefilter.c
+}
Index: gdb-7.6/gdb/python/py-objfile.c
===================================================================
--- gdb-7.6.orig/gdb/python/py-objfile.c 2013-05-20 22:23:36.748215146 +0200
+++ gdb-7.6/gdb/python/py-objfile.c 2013-05-20 22:25:52.112165767 +0200
--- gdb-7.6.orig/gdb/python/py-objfile.c 2013-06-10 14:31:02.731084652 +0200
+++ gdb-7.6/gdb/python/py-objfile.c 2013-06-10 14:31:08.366082437 +0200
@@ -33,6 +33,8 @@ typedef struct
/* The pretty-printer list of functions. */
PyObject *printers;
@ -3318,8 +3318,8 @@ Index: gdb-7.6/gdb/python/py-objfile.c
{ NULL }
Index: gdb-7.6/gdb/python/py-progspace.c
===================================================================
--- gdb-7.6.orig/gdb/python/py-progspace.c 2013-05-20 22:23:36.748215146 +0200
+++ gdb-7.6/gdb/python/py-progspace.c 2013-05-20 22:25:52.112165767 +0200
--- gdb-7.6.orig/gdb/python/py-progspace.c 2013-06-10 14:31:02.731084652 +0200
+++ gdb-7.6/gdb/python/py-progspace.c 2013-06-10 14:31:08.366082437 +0200
@@ -35,6 +35,8 @@ typedef struct
/* The pretty-printer list of functions. */
PyObject *printers;
@ -3424,8 +3424,8 @@ Index: gdb-7.6/gdb/python/py-progspace.c
{ NULL }
Index: gdb-7.6/gdb/python/py-utils.c
===================================================================
--- gdb-7.6.orig/gdb/python/py-utils.c 2013-05-20 22:23:36.748215146 +0200
+++ gdb-7.6/gdb/python/py-utils.c 2013-05-20 22:25:52.113165766 +0200
--- gdb-7.6.orig/gdb/python/py-utils.c 2013-06-10 14:31:02.732084652 +0200
+++ gdb-7.6/gdb/python/py-utils.c 2013-06-10 14:31:08.366082437 +0200
@@ -48,6 +48,28 @@ make_cleanup_py_decref (PyObject *py)
return make_cleanup (py_decref, (void *) py);
}
@ -3457,8 +3457,8 @@ Index: gdb-7.6/gdb/python/py-utils.c
returns NULL with a python exception set.
Index: gdb-7.6/gdb/python/python-internal.h
===================================================================
--- gdb-7.6.orig/gdb/python/python-internal.h 2013-05-20 22:23:36.748215146 +0200
+++ gdb-7.6/gdb/python/python-internal.h 2013-05-20 22:25:52.113165766 +0200
--- gdb-7.6.orig/gdb/python/python-internal.h 2013-06-10 14:31:02.732084652 +0200
+++ gdb-7.6/gdb/python/python-internal.h 2013-06-10 14:31:08.367082436 +0200
@@ -251,9 +251,11 @@ PyObject *frame_info_to_frame_object (st
PyObject *pspace_to_pspace_object (struct program_space *);
@ -3481,8 +3481,8 @@ Index: gdb-7.6/gdb/python/python-internal.h
const struct language_defn *language);
Index: gdb-7.6/gdb/python/python.c
===================================================================
--- gdb-7.6.orig/gdb/python/python.c 2013-05-20 22:23:36.748215146 +0200
+++ gdb-7.6/gdb/python/python.c 2013-05-20 22:25:52.113165766 +0200
--- gdb-7.6.orig/gdb/python/python.c 2013-06-10 14:31:02.732084652 +0200
+++ gdb-7.6/gdb/python/python.c 2013-06-10 14:31:08.367082436 +0200
@@ -1442,6 +1442,15 @@ free_type_printers (void *arg)
{
}
@ -3501,8 +3501,8 @@ Index: gdb-7.6/gdb/python/python.c
Index: gdb-7.6/gdb/python/python.h
===================================================================
--- gdb-7.6.orig/gdb/python/python.h 2013-05-20 22:23:36.748215146 +0200
+++ gdb-7.6/gdb/python/python.h 2013-05-20 22:25:52.113165766 +0200
--- gdb-7.6.orig/gdb/python/python.h 2013-06-10 14:31:02.732084652 +0200
+++ gdb-7.6/gdb/python/python.h 2013-06-10 14:31:08.367082436 +0200
@@ -21,6 +21,7 @@
#define GDB_PYTHON_H
@ -3593,7 +3593,7 @@ Index: gdb-7.6/gdb/python/python.h
Index: gdb-7.6/gdb/python/lib/gdb/FrameDecorator.py
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6/gdb/python/lib/gdb/FrameDecorator.py 2013-05-20 22:25:52.113165766 +0200
+++ gdb-7.6/gdb/python/lib/gdb/FrameDecorator.py 2013-06-10 14:31:08.367082436 +0200
@@ -0,0 +1,285 @@
+# Copyright (C) 2013 Free Software Foundation, Inc.
+
@ -3883,7 +3883,7 @@ Index: gdb-7.6/gdb/python/lib/gdb/FrameDecorator.py
Index: gdb-7.6/gdb/python/lib/gdb/FrameIterator.py
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6/gdb/python/lib/gdb/FrameIterator.py 2013-05-20 22:25:52.114165766 +0200
+++ gdb-7.6/gdb/python/lib/gdb/FrameIterator.py 2013-06-10 14:31:08.367082436 +0200
@@ -0,0 +1,45 @@
+# Copyright (C) 2013 Free Software Foundation, Inc.
+
@ -3933,7 +3933,7 @@ Index: gdb-7.6/gdb/python/lib/gdb/FrameIterator.py
Index: gdb-7.6/gdb/python/lib/gdb/frames.py
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6/gdb/python/lib/gdb/frames.py 2013-05-20 22:25:52.114165766 +0200
+++ gdb-7.6/gdb/python/lib/gdb/frames.py 2013-06-10 14:31:08.368082436 +0200
@@ -0,0 +1,229 @@
+# Frame-filter commands.
+# Copyright (C) 2013 Free Software Foundation, Inc.
@ -4166,8 +4166,8 @@ Index: gdb-7.6/gdb/python/lib/gdb/frames.py
+ return sliced
Index: gdb-7.6/gdb/python/lib/gdb/__init__.py
===================================================================
--- gdb-7.6.orig/gdb/python/lib/gdb/__init__.py 2013-05-20 22:23:36.748215146 +0200
+++ gdb-7.6/gdb/python/lib/gdb/__init__.py 2013-05-20 22:25:52.114165766 +0200
--- gdb-7.6.orig/gdb/python/lib/gdb/__init__.py 2013-06-10 14:31:02.733084651 +0200
+++ gdb-7.6/gdb/python/lib/gdb/__init__.py 2013-06-10 14:31:08.368082436 +0200
@@ -67,6 +67,8 @@ pretty_printers = []
# Initial type printers.
@ -4180,7 +4180,7 @@ Index: gdb-7.6/gdb/python/lib/gdb/__init__.py
Index: gdb-7.6/gdb/python/lib/gdb/command/frame_filters.py
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6/gdb/python/lib/gdb/command/frame_filters.py 2013-05-20 22:25:52.114165766 +0200
+++ gdb-7.6/gdb/python/lib/gdb/command/frame_filters.py 2013-06-10 14:31:08.368082436 +0200
@@ -0,0 +1,461 @@
+# Frame-filter commands.
+# Copyright (C) 2013 Free Software Foundation, Inc.
@ -4646,7 +4646,7 @@ Index: gdb-7.6/gdb/python/lib/gdb/command/frame_filters.py
Index: gdb-7.6/gdb/testsuite/gdb.python/py-framefilter-gdb.py.in
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6/gdb/testsuite/gdb.python/py-framefilter-gdb.py.in 2013-05-20 22:25:52.114165766 +0200
+++ gdb-7.6/gdb/testsuite/gdb.python/py-framefilter-gdb.py.in 2013-06-10 14:31:08.368082436 +0200
@@ -0,0 +1,48 @@
+# Copyright (C) 2013 Free Software Foundation, Inc.
+
@ -4699,7 +4699,7 @@ Index: gdb-7.6/gdb/testsuite/gdb.python/py-framefilter-gdb.py.in
Index: gdb-7.6/gdb/testsuite/gdb.python/py-framefilter-mi.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6/gdb/testsuite/gdb.python/py-framefilter-mi.c 2013-05-20 22:25:52.114165766 +0200
+++ gdb-7.6/gdb/testsuite/gdb.python/py-framefilter-mi.c 2013-06-10 14:31:08.368082436 +0200
@@ -0,0 +1,138 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -4842,7 +4842,7 @@ Index: gdb-7.6/gdb/testsuite/gdb.python/py-framefilter-mi.c
Index: gdb-7.6/gdb/testsuite/gdb.python/py-framefilter-mi.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6/gdb/testsuite/gdb.python/py-framefilter-mi.exp 2013-05-20 22:25:52.115165766 +0200
+++ gdb-7.6/gdb/testsuite/gdb.python/py-framefilter-mi.exp 2013-06-10 14:31:08.368082436 +0200
@@ -0,0 +1,179 @@
+# Copyright (C) 2013 Free Software Foundation, Inc.
+
@ -5026,7 +5026,7 @@ Index: gdb-7.6/gdb/testsuite/gdb.python/py-framefilter-mi.exp
Index: gdb-7.6/gdb/testsuite/gdb.python/py-framefilter.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6/gdb/testsuite/gdb.python/py-framefilter.c 2013-05-20 22:25:52.115165766 +0200
+++ gdb-7.6/gdb/testsuite/gdb.python/py-framefilter.c 2013-06-10 14:31:08.369082436 +0200
@@ -0,0 +1,155 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -5186,7 +5186,7 @@ Index: gdb-7.6/gdb/testsuite/gdb.python/py-framefilter.c
Index: gdb-7.6/gdb/testsuite/gdb.python/py-framefilter.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6/gdb/testsuite/gdb.python/py-framefilter.exp 2013-05-20 22:25:52.115165766 +0200
+++ gdb-7.6/gdb/testsuite/gdb.python/py-framefilter.exp 2013-06-10 14:31:08.369082436 +0200
@@ -0,0 +1,239 @@
+# Copyright (C) 2013 Free Software Foundation, Inc.
+
@ -5430,7 +5430,7 @@ Index: gdb-7.6/gdb/testsuite/gdb.python/py-framefilter.exp
Index: gdb-7.6/gdb/testsuite/gdb.python/py-framefilter.py
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6/gdb/testsuite/gdb.python/py-framefilter.py 2013-05-20 22:25:52.115165766 +0200
+++ gdb-7.6/gdb/testsuite/gdb.python/py-framefilter.py 2013-06-10 14:31:08.369082436 +0200
@@ -0,0 +1,117 @@
+# Copyright (C) 2013 Free Software Foundation, Inc.
+

View File

@ -36,7 +36,7 @@ Version: 7.6
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
Release: 31%{?dist}
Release: 32%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain
Group: Development/Debuggers
@ -508,15 +508,16 @@ Patch579: gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
# Fix dlopen of libpthread.so, patched glibc required (Gary Benson, BZ 669432).
# Fix crash regression from the dlopen of libpthread.so fix (BZ 911712).
# Fix performance regression when inferior opens many libraries (Gary Benson).
#=push
Patch718: gdb-dlopen-stap-probe-1of7.patch
Patch719: gdb-dlopen-stap-probe-2of7.patch
Patch720: gdb-dlopen-stap-probe-3of7.patch
Patch721: gdb-dlopen-stap-probe-4of7.patch
Patch722: gdb-dlopen-stap-probe-5of7.patch
Patch723: gdb-dlopen-stap-probe-6of7.patch
Patch822: gdb-dlopen-stap-probe-7of7.patch
Patch827: gdb-dlopen-stap-probe-fixup.patch
#=drop
Patch718: gdb-dlopen-stap-probe-1of9.patch
Patch719: gdb-dlopen-stap-probe-2of9.patch
Patch720: gdb-dlopen-stap-probe-3of9.patch
Patch721: gdb-dlopen-stap-probe-4of9.patch
Patch722: gdb-dlopen-stap-probe-5of9.patch
Patch723: gdb-dlopen-stap-probe-6of9.patch
Patch822: gdb-dlopen-stap-probe-7of9.patch
Patch827: gdb-dlopen-stap-probe-8of9.patch
Patch619: gdb-dlopen-stap-probe-9of9.patch
# Work around PR libc/13097 "linux-vdso.so.1" warning message.
#=push
@ -570,11 +571,18 @@ Patch818: gdb-rhbz795424-bitpos-lazyvalue.patch
Patch832: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
# Fix gcore for vDSO (on ppc64).
#=drop
Patch834: gdb-vdso-gcore.patch
# Fix needless expansion of non-gdbindex symtabs (Doug Evans).
#=drop
Patch835: gdb-psymtab-expand.patch
# Fix C++ lookups performance regression (Doug Evans, BZ 972677).
#=drop
Patch838: gdb-cxx-performance-1of2.patch
Patch839: gdb-cxx-performance-2of2.patch
%if 0%{!?rhel:1} || 0%{?rhel} > 6
# RL_STATE_FEDORA_GDB would not be found for:
# Patch642: gdb-readline62-ask-more-rh.patch
@ -783,8 +791,6 @@ find -name "*.info*"|xargs rm -f
%patch232 -p1
%patch828 -p1
%patch829 -p1
%patch836 -p1
%patch837 -p1
%patch1 -p1
%patch3 -p1
@ -881,6 +887,7 @@ find -name "*.info*"|xargs rm -f
%patch723 -p1
%patch822 -p1
%patch827 -p1
%patch619 -p1
%patch627 -p1
%patch634 -p1
%patch653 -p1
@ -899,7 +906,15 @@ find -name "*.info*"|xargs rm -f
%patch832 -p1
%patch834 -p1
%patch835 -p1
%patch838 -p1
%patch839 -p1
%patch836 -p1
%patch837 -p1
%if 0%{?scl:1}
%patch836 -p1 -R
%patch837 -p1 -R
%endif
%patch393 -p1
%if 0%{!?el5:1} || 0%{?scl:1}
%patch393 -p1 -R
@ -1402,6 +1417,11 @@ fi
%endif # 0%{!?el5:1} || "%{_target_cpu}" == "noarch"
%changelog
* Mon Jun 10 2013 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.6-32.fc19
- [scl] Disable Python frame filters on scl.
- Update libraries opening performance fix from upstream.
- Fix C++ lookups performance regression (Doug Evans, BZ 972677).
* Tue May 28 2013 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.6-31.fc19
- [ppc] Backport hardware watchpoints fix (Edjunior Machado, BZ 967915).