This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] smart pointer support
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: tromey at redhat dot com (Tom Tromey)
- Cc: swagiaal at redhat dot com (sami wagiaalla), gdb-patches at sourceware dot org
- Date: Sun, 8 Aug 2010 17:01:08 +0200 (CEST)
- Subject: Re: [patch] smart pointer support
Tom Tromey wrote:
> Along these lines, I'm curious to know why value_must_coerce_to_target
> returns 0 for TYPE_CODE_STRUCT. Maybe that is just an oversight?
> Perhaps it should also check for lval_internalvar_component?
Well, I guess this is because the value-coerce-to-target mechanism was
introduced by Dan for a specific purpose, that is to allow lazy handling
of GDB-internally generated literal values (in particular string constants).
It was never intended to handle pushing arbitrary non-lvalues, like those
generated from inferior calls (or arbitray value arithmetic) to the target.
Now maybe this could be extended to do so; but it seems we'd have to carefully
think about exactly when we want this to happen. For example, if you have
a variable residing in a register, you currently cannot take its address in
GDB. If value_coerce_to_target were to blindly push *everything* to the
target, this would succeed, and you'd have a pointer to a malloc'ed location
holding a copy of the register value -- which is presumably not what you
intended ...
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com