This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix stop-on-solib event failures


[ This patch replaces "[PATCH] testsuite: disable break-interp.exp for Arm
  buildbot". Instead of working around the issue, this fixes the issues. ]

On some Arm targets (namely the buildbot Arm Docker setup) placing breakpoints
on just the solib dynamic probes will cause the target process to not stop.
For stop-on-solib to work, a breakpoint also needs placing at the original
stop address.  This is due to bad placing of the probe addresses in the
linker.

This prevents over 100 timeouts when running gdb.base/break-interp.exp.

In addition, the gdb.base/break-interp.exp test has a extra step that is only
required for ppc64 targets.  However on Ubuntu X86 and AArch64, this causes
the program to now be stopped in an unknown location.  The fix here is to
ensure the ppc64 step is only run on ppc64 targets.  This fixes a long
standing issue.

gdb/ChangeLog:

2019-08-14  Alan Hayward  <alan.hayward@arm.com>

	* solib-svr4.c (svr4_create_solib_event_breakpoints): Always create
	original breakpoint.

gdb/testsuite/ChangeLog:

2019-08-14  Alan Hayward  <alan.hayward@arm.com>

	* gdb.base/break-interp.exp: Only run ppc64 step on ppc64.
---
 gdb/solib-svr4.c                        | 18 ++++++++----------
 gdb/testsuite/gdb.base/break-interp.exp |  9 ++++-----
 2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index c0c505acaa..d755832bbf 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -2066,20 +2066,20 @@ svr4_create_probe_breakpoints (svr4_info *info, struct gdbarch *gdbarch,
    purpose of this method is to allow debuggers to set a breakpoint so
    they can track these changes.
 
-   Some versions of the glibc dynamic linker contain named probes
-   to allow more fine grained stopping.  Given the address of the
-   original marker function, this function attempts to find these
-   probes, and if found, sets breakpoints on those instead.  If the
-   probes aren't found, a single breakpoint is set on the original
-   marker function.  */
+   A single breakpoint will be placed on the given ADDRESS.
+
+   In addition, some versions of the glibc dynamic linker contain named probes
+   to allow more fine grained stopping.  Given the address of the original
+   marker function, this function attempts to find these probes, and if found,
+   sets breakpoints on those as well.  */
 
 static void
 svr4_create_solib_event_breakpoints (svr4_info *info, struct gdbarch *gdbarch,
 				     CORE_ADDR address)
 {
-  struct obj_section *os;
+  create_solib_event_breakpoint (gdbarch, address);
 
-  os = find_pc_section (address);
+  struct obj_section *os = find_pc_section (address);
   if (os != NULL)
     {
       int with_prefix;
@@ -2143,8 +2143,6 @@ svr4_create_solib_event_breakpoints (svr4_info *info, struct gdbarch *gdbarch,
 	    return;
 	}
     }
-
-  create_solib_event_breakpoint (gdbarch, address);
 }
 
 /* Helper function for gdb_bfd_lookup_symbol.  */
diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
index d6da653529..5caa5ecdf3 100644
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -131,7 +131,8 @@ proc reach_1 {func command displacement} {
 
     set test "reach"
     set test_displacement "seen displacement message as $displacement"
-    set debug_state_count 0
+    # First stop does not yet relocate the _start descriptor on ppc64.
+    set debug_state_count [istarget "powerpc64-*-linux*"]
     gdb_test_multiple $command $test {
 	-re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " {
 	    # Missing "$gdb_prompt $" is intentional.
@@ -164,10 +165,8 @@ proc reach_1 {func command displacement} {
 	}
 	-re "Stopped due to (spurious )?shared library event.*\r\n$gdb_prompt $" {
 	    if {$func == $solib_bp} {
-		if {$debug_state_count == 0} {
-		    # First stop does not yet relocate the _start function
-		    # descriptor on ppc64.
-		    set debug_state_count 1
+		if {$debug_state_count == 1} {
+		    set debug_state_count 0
 		    send_gdb "continue\n"
 		    exp_continue
 		} else {
-- 
2.20.1 (Apple Git-117)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]