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 1/2] Re-check fastpoint after reloading symbols.


Hi Ulrich,

This is a separate patch and should go before "Tracepoint for ppc64" patch.
Is this ok?

Thanks,
Wei-cheng

---
Check fast tracepoints after symbols have been re-loaded.
For example, a pending tracepoint just becomes available after
a new shared object being loaded.  We didn't check it before,
because we have no idea where it is.

If the target rejects the tracepoint, an error is throw in
check_fast_tracepoint_sals, and we will disable the breakpoint.

The checking is deliberately put after the loop for adding location
to breakpoint, so users can check the address for the tracepoint
with `info trace'.  Otherwise, it will simply show <PENDING> instead
of the address.

(gdb) info trace
Num     Type            Disp Enb Address            What
1       fast tracepoint keep n   0x00003fffb7f507dc <pendfunc+20>
                                 ^^^^^^^^^^^^^^^^^^

--

gdb/ChangeLog

2015-08-23  Wei-cheng Wang  <cole945@gmail.com>

	* breakpoint.c (update_breakpoint_locations): Check
	fast tracepoints after reloading symbols.
---
 gdb/breakpoint.c | 32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 052aeb9..703b03a 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -14056,15 +14056,6 @@ update_breakpoint_locations (struct breakpoint *b,
       return;
     }
 
-  /* If there's no new locations, and all existing locations are
-     pending, don't do anything.  This optimizes the common case where
-     all locations are in the same shared library, that was unloaded.
-     We'd like to retain the location, so that when the library is
-     loaded again, we don't loose the enabled/disabled status of the
-     individual locations.  */
-  if (all_locations_are_pending (existing_locations) && sals.nelts == 0)
-    return;
-
   b->loc = NULL;
 
   for (i = 0; i < sals.nelts; ++i)
@@ -14106,6 +14097,29 @@ update_breakpoint_locations (struct breakpoint *b,
 	}
     }
 
+  /* If there's no new locations, and all existing locations are
+     pending, don't do anything.  This optimizes the common case where
+     all locations are in the same shared library, that was unloaded.
+     We'd like to retain the location, so that when the library is
+     loaded again, we don't loose the enabled/disabled status of the
+     individual locations.  */
+  if (all_locations_are_pending (existing_locations) && sals.nelts == 0)
+    return;
+
+  if (b->type == bp_fast_tracepoint)
+    {
+      TRY
+	{
+	  check_fast_tracepoint_sals (get_current_arch(), &sals);
+	}
+      CATCH (e, RETURN_MASK_ERROR)
+	{
+	  b->enable_state = bp_disabled;
+	  throw_exception (e);
+	}
+      END_CATCH
+    }
+
   /* If possible, carry over 'disable' status from existing
      breakpoints.  */
   {
-- 
1.9.1


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