Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Emi SUZUKI <emi-suzuki@tjsys.co.jp>
To: brobecker@adacore.com
Cc: gdb-patches@sourceware.org
Subject: Re: Watchpoint on an unloaded shared library(1)
Date: Tue, 06 Jan 2009 01:47:00 -0000	[thread overview]
Message-ID: <20090106.104717.01369292.emi-suzuki@tjsys.co.jp> (raw)
In-Reply-To: <20081228111719.GC4216@adacore.com>

Hello Joel, 

From: Joel Brobecker <brobecker at adacore.com>
Subject: Re: Watchpoint on an unloaded shared library(1)
Date: Sun, 28 Dec 2008 15:17:19 +0400

> However, you did not say whether you tested the change (meaning that
> you verified that it does not introduce any new failure in the GDB
> testsuite), and if you did, on which system. I just want to make
> sure the change was properly tested before it is checked in.

OK, I would mention it from now on.  

>> +      struct gdb_exception e;
>> +      TRY_CATCH (e, RETURN_MASK_ALL)
> 
> Can you add an empty line between these two line. The style in GDB
> is to separate the local variable declarations from the rest of
> the code by an empty line.

The below is the reviced one.  I've tested it on x86-linux (F9) and
seen no regression.  

Thank you for all of your valuable advices for this issue!


2008-12-26  Joel Brobecker  <brobecker@adacore.com>
	    Emi Suzuki  <emi-suzuki@tjsys.co.jp>
 
	* breakpoint.c (do_enable_breakpoint): Use update_watchpoint for
	watchpoints.


--- breakpoint.c.orig	2009-01-03 14:57:50.000000000 +0900
+++ breakpoint.c	2009-01-05 14:34:01.000000000 +0900
@@ -7789,56 +7789,18 @@ do_enable_breakpoint (struct breakpoint 
       bpt->type == bp_read_watchpoint || 
       bpt->type == bp_access_watchpoint)
     {
-      struct frame_id saved_frame_id;
-      
-      saved_frame_id = get_frame_id (get_selected_frame (NULL));
-      if (bpt->exp_valid_block != NULL)
+      struct gdb_exception e;
+
+      TRY_CATCH (e, RETURN_MASK_ALL)
 	{
-	  struct frame_info *fr =
-	    fr = frame_find_by_id (bpt->watchpoint_frame);
-	  if (fr == NULL)
-	    {
-	      printf_filtered (_("\
-Cannot enable watchpoint %d because the block in which its expression\n\
-is valid is not currently in scope.\n"), bpt->number);
-	      return;
-	    }
-	  select_frame (fr);
+	  update_watchpoint (bpt, 1 /* reparse */);
 	}
-      
-      if (bpt->val)
-	value_free (bpt->val);
-      mark = value_mark ();
-      fetch_watchpoint_value (bpt->exp, &bpt->val, NULL, NULL);
-      if (bpt->val)
-	release_value (bpt->val);
-      bpt->val_valid = 1;
-
-      if (bpt->type == bp_hardware_watchpoint ||
-	  bpt->type == bp_read_watchpoint ||
-	  bpt->type == bp_access_watchpoint)
+      if (e.reason < 0)
 	{
-	  int i = hw_watchpoint_used_count (bpt->type, &other_type_used);
-	  int mem_cnt = can_use_hardware_watchpoint (bpt->val);
-	  
-	  /* Hack around 'unused var' error for some targets here */
-	  (void) mem_cnt, (void) i;
-	  target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT (
-								    bpt->type, i + mem_cnt, other_type_used);
-	  /* we can consider of type is bp_hardware_watchpoint, convert to 
-	     bp_watchpoint in the following condition */
-	  if (target_resources_ok < 0)
-	    {
-	      printf_filtered (_("\
-Cannot enable watchpoint %d because target watch resources\n\
-have been allocated for other watchpoints.\n"), bpt->number);
-	      value_free_to_mark (mark);
-	      return;
-	    }
+	  exception_fprintf (gdb_stderr, e, _("Cannot enable watchpoint %d: "),
+			     bpt->number);
+	  return;
 	}
-      
-      select_frame (frame_find_by_id (saved_frame_id));
-      value_free_to_mark (mark);
     }
 
   if (bpt->enable_state != bp_permanent)


My best regards, 
-- 
Emi SUZUKI / emi-suzuki at tjsys.co.jp


  reply	other threads:[~2009-01-06  1:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-20 18:25 Emi SUZUKI
2008-12-13 15:06 ` Joel Brobecker
2008-12-16 12:16   ` Emi SUZUKI
2008-12-21 13:11     ` Joel Brobecker
2008-12-22  3:28       ` Joel Brobecker
2008-12-25 11:28         ` Emi SUZUKI
2008-12-26  6:11           ` Joel Brobecker
2008-12-26  7:09             ` Emi SUZUKI
2008-12-28 11:48               ` Joel Brobecker
2009-01-06  1:47                 ` Emi SUZUKI [this message]
2009-01-06  4:28                   ` Joel Brobecker
2009-01-06  5:16                     ` Emi SUZUKI
2009-01-08  4:02                     ` [commit] " Emi SUZUKI

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=20090106.104717.01369292.emi-suzuki@tjsys.co.jp \
    --to=emi-suzuki@tjsys.co.jp \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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