Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "J.T. Conklin" <jtc@redbacknetworks.com>
To: gdb-patches@cygnus.com
Subject: questions about constructing value_ptr in read_var_value
Date: Thu, 01 Apr 1999 00:00:00 -0000	[thread overview]
Message-ID: <199901300114.RAA23758@jtc.redbacknetworks.com> (raw)
Message-ID: <19990401000000.-dyMk3-UgKcLEfLsKDJ0WPFZW1saPW2FHRYLITTpehA@z> (raw)

I discovered an anomaly in can_use_hardware_watchpoint() --- it
returns true if the expression is a variable in a register.

I discovered that read_var_value() allocates a node, which is usually
filled in with the addr of the variable; but in the case of variables
stored in registers, a new node is created with value_from_register()
and returned.  However, because the way value_ptr nodes are created,
the original, partially initialized (with lval_memory type), node is
still on the list of values.

When can_use_hardware_watchpoint() evaluates the list, it sees the
(extra) node with lval_memory type, and decides hardware watchpoints
can be used. (actually, I think this is another, different, bug.  The
function is supposed to ensure all intermediate values are in memory,
but it appears that register variables aren't rejected.  Thus a "reg
.op. mem" expression would be considered acceptable for a hardware
watchpoint.)

The enclosed patch avoids the extra node, by deleting the one
allocated at the top of read_var_value().  But perhaps the function
should avoid allocating it at all if SYMBOL_CLASS(var) == LOC_REGISTER
or LOC_REGPARM.

	--jtc

Index: findvar.c
===================================================================
RCS file: /usr/rback/release/tools-src/gdb/gdb/findvar.c,v
retrieving revision 1.1.1.3
diff -c -r1.1.1.3 findvar.c
*** findvar.c	1999/01/28 22:58:50	1.1.1.3
--- findvar.c	1999/01/29 23:15:12
***************
*** 1325,1330 ****
--- 1325,1335 ----
  
  	    if (regval == NULL)
  	      error ("Value of register variable not available.");
+ 
+ 	    /* XXX Must release node we're not using */
+ 	    release_value (v);
+ 	    value_free (v);
+ 
  	    return regval;
  	  }
        }






             reply	other threads:[~1999-04-01  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-29 17:15 J.T. Conklin [this message]
1999-04-01  0:00 ` J.T. Conklin

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=199901300114.RAA23758@jtc.redbacknetworks.com \
    --to=jtc@redbacknetworks.com \
    --cc=gdb-patches@cygnus.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