* win32-nat.c (psapi_module_handle): Remove static.
[deliverable/binutils-gdb.git] / gdb / value.c
index 52ba2ed90b27d3a6ffa8bf0231ba56bb1afb08a2..e29bab7391f7f289a4037aa15f7a97ebb96b7491 100644 (file)
@@ -8,7 +8,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -17,9 +17,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
 #include "gdb_string.h"
@@ -36,6 +34,7 @@
 #include "gdb_assert.h"
 #include "regcache.h"
 #include "block.h"
+#include "dfp.h"
 
 /* Prototypes for exported functions. */
 
@@ -744,10 +743,10 @@ init_if_undefined_command (char* args, int from_tty)
    normally include a dollar sign.
 
    If the specified internal variable does not exist,
-   one is created, with a void value.  */
+   the return value is NULL.  */
 
 struct internalvar *
-lookup_internalvar (char *name)
+lookup_only_internalvar (char *name)
 {
   struct internalvar *var;
 
@@ -755,6 +754,17 @@ lookup_internalvar (char *name)
     if (strcmp (var->name, name) == 0)
       return var;
 
+  return NULL;
+}
+
+
+/* Create an internal variable with name NAME and with a void value.
+   NAME should not normally include a dollar sign.  */
+
+struct internalvar *
+create_internalvar (char *name)
+{
+  struct internalvar *var;
   var = (struct internalvar *) xmalloc (sizeof (struct internalvar));
   var->name = concat (name, (char *)NULL);
   var->value = allocate_value (builtin_type_void);
@@ -765,6 +775,25 @@ lookup_internalvar (char *name)
   return var;
 }
 
+
+/* Look up an internal variable with name NAME.  NAME should not
+   normally include a dollar sign.
+
+   If the specified internal variable does not exist,
+   one is created, with a void value.  */
+
+struct internalvar *
+lookup_internalvar (char *name)
+{
+  struct internalvar *var;
+
+  var = lookup_only_internalvar (name);
+  if (var)
+    return var;
+
+  return create_internalvar (name);
+}
+
 struct value *
 value_of_internalvar (struct internalvar *var)
 {
@@ -1613,6 +1642,27 @@ value_from_double (struct type *type, DOUBLEST num)
   return val;
 }
 
+struct value *
+value_from_decfloat (struct type *expect_type, struct type *type,
+                     gdb_byte decbytes[16])
+{
+  struct value *val = allocate_value (type);
+  int len = TYPE_LENGTH (type);
+
+  if (expect_type)
+    {
+      int expect_len = TYPE_LENGTH (expect_type);
+      char decstr[MAX_DECIMAL_STRING];
+      int real_len;
+
+      decimal_to_string (decbytes, len, decstr);
+      decimal_from_string (decbytes, expect_len, decstr);
+    }
+
+  memcpy (value_contents_raw (val), decbytes, len);
+  return val;
+}
+
 struct value *
 coerce_ref (struct value *arg)
 {
@@ -1653,39 +1703,12 @@ coerce_enum (struct value *arg)
 }
 \f
 
-/* Should we use DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS instead of
-   gdbarch_extract_return_value?  GCC_P is true if compiled with gcc and TYPE
-   is the type (which is known to be struct, union or array).
-
-   On most machines, the struct convention is used unless we are
-   using gcc and the type is of a special size.  */
-/* As of about 31 Mar 93, GCC was changed to be compatible with the
-   native compiler.  GCC 2.3.3 was the last release that did it the
-   old way.  Since gcc2_compiled was not changed, we have no
-   way to correctly win in all cases, so we just do the right thing
-   for gcc1 and for gcc2 after this change.  Thus it loses for gcc
-   2.0-2.3.3.  This is somewhat unfortunate, but changing gcc2_compiled
-   would cause more chaos than dealing with some struct returns being
-   handled wrong.  */
-/* NOTE: cagney/2004-06-13: Deleted check for "gcc_p".  GCC 1.x is
-   dead.  */
-
-int
-generic_use_struct_convention (int gcc_p, struct type *value_type)
-{
-  return !(TYPE_LENGTH (value_type) == 1
-          || TYPE_LENGTH (value_type) == 2
-          || TYPE_LENGTH (value_type) == 4
-          || TYPE_LENGTH (value_type) == 8);
-}
-
 /* Return true if the function returning the specified type is using
    the convention of returning structures in memory (passing in the
-   address as a hidden first parameter).  GCC_P is nonzero if compiled
-   with GCC.  */
+   address as a hidden first parameter).  */
 
 int
-using_struct_return (struct type *value_type, int gcc_p)
+using_struct_return (struct type *value_type)
 {
   enum type_code code = TYPE_CODE (value_type);
 
This page took 0.025279 seconds and 4 git commands to generate.