Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Wei-cheng Wang <cole945@gmail.com>
To: uweigand@de.ibm.com,	gdb-patches@sourceware.org,	cole945@gmail.com
Subject: [PATCH 1/2] Re-check fastpoint after reloading symbols.
Date: Sun, 23 Aug 2015 16:17:00 -0000	[thread overview]
Message-ID: <1440091938-42453-1-git-send-email-cole945@gmail.com> (raw)

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


             reply	other threads:[~2015-08-23 16:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-23 16:17 Wei-cheng Wang [this message]
2015-08-23 16:17 ` [PATCH 2/2] Determine the iteration count based on wallclock instead of user+system time Wei-cheng Wang
2015-08-27 18:14   ` Ulrich Weigand
2016-02-18 18:48   ` Marcin Kościelnicki
2016-02-18 18:56     ` Ulrich Weigand
2016-02-18 19:26       ` Marcin Kościelnicki
2015-08-27 18:13 ` [PATCH 1/2] Re-check fastpoint after reloading symbols Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1440091938-42453-1-git-send-email-cole945@gmail.com \
    --to=cole945@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox