* source.c (openp): Squelch warning about "filename".
[deliverable/binutils-gdb.git] / gdb / findvar.c
index 06ad4987a1b9fbb0f71d53095dd65450abc15aae..980bb57880eb35da1713ac25c2fcd45884218b1b 100644 (file)
@@ -47,17 +47,17 @@ you lose
 #endif
 
 LONGEST
-extract_signed_integer (void *addr, int len)
+extract_signed_integer (const void *addr, int len)
 {
   LONGEST retval;
-  unsigned char *p;
-  unsigned char *startaddr = (unsigned char *) addr;
-  unsigned char *endaddr = startaddr + len;
+  const unsigned char *p;
+  const unsigned char *startaddr = addr;
+  const unsigned char *endaddr = startaddr + len;
 
   if (len > (int) sizeof (LONGEST))
     error ("\
 That operation is not available on integers of more than %d bytes.",
-          sizeof (LONGEST));
+          (int) sizeof (LONGEST));
 
   /* Start at the most significant end of the integer, and work towards
      the least significant.  */
@@ -81,17 +81,17 @@ That operation is not available on integers of more than %d bytes.",
 }
 
 ULONGEST
-extract_unsigned_integer (void *addr, int len)
+extract_unsigned_integer (const void *addr, int len)
 {
   ULONGEST retval;
-  unsigned char *p;
-  unsigned char *startaddr = (unsigned char *) addr;
-  unsigned char *endaddr = startaddr + len;
+  const unsigned char *p;
+  const unsigned char *startaddr = addr;
+  const unsigned char *endaddr = startaddr + len;
 
   if (len > (int) sizeof (ULONGEST))
     error ("\
 That operation is not available on integers of more than %d bytes.",
-          sizeof (ULONGEST));
+          (int) sizeof (ULONGEST));
 
   /* Start at the most significant end of the integer, and work towards
      the least significant.  */
@@ -115,7 +115,7 @@ That operation is not available on integers of more than %d bytes.",
    function returns 1 and sets *PVAL.  Otherwise it returns 0.  */
 
 int
-extract_long_unsigned_integer (void *addr, int orig_len, LONGEST *pval)
+extract_long_unsigned_integer (const void *addr, int orig_len, LONGEST *pval)
 {
   char *p, *first_addr;
   int len;
@@ -173,7 +173,7 @@ extract_long_unsigned_integer (void *addr, int orig_len, LONGEST *pval)
    else based on POINTER_TO_ADDRESS.  */
 
 CORE_ADDR
-extract_address (void *addr, int len)
+extract_address (const void *addr, int len)
 {
   /* Assume a CORE_ADDR can fit in a LONGEST (for now).  Not sure
      whether we want this to be true eventually.  */
@@ -184,7 +184,7 @@ extract_address (void *addr, int len)
 /* Treat the bytes at BUF as a pointer of type TYPE, and return the
    address it represents.  */
 CORE_ADDR
-extract_typed_address (void *buf, struct type *type)
+extract_typed_address (const void *buf, struct type *type)
 {
   if (TYPE_CODE (type) != TYPE_CODE_PTR
       && TYPE_CODE (type) != TYPE_CODE_REF)
@@ -303,11 +303,18 @@ value_of_register (int regnum, struct frame_info *frame)
   /* Builtin registers lie completly outside of the range of normal
      registers.  Catch them early so that the target never sees them.  */
   if (regnum >= NUM_REGS + NUM_PSEUDO_REGS)
-    return value_of_builtin_reg (regnum, selected_frame);
+    return value_of_builtin_reg (regnum, deprecated_selected_frame);
 
   get_saved_register (raw_buffer, &optim, &addr,
                      frame, regnum, &lval);
 
+  /* FIXME: cagney/2002-05-15: This test is just bogus.
+
+     It indicates that the target failed to supply a value for a
+     register because it was "not available" at this time.  Problem
+     is, the target still has the register and so get saved_register()
+     may be returning a value saved on the stack.  */
+
   if (register_cached (regnum) < 0)
     return NULL;               /* register value not available */
 
@@ -340,13 +347,13 @@ value_of_register (int regnum, struct frame_info *frame)
 /* Given a pointer of type TYPE in target form in BUF, return the
    address it represents.  */
 CORE_ADDR
-unsigned_pointer_to_address (struct type *type, void *buf)
+unsigned_pointer_to_address (struct type *type, const void *buf)
 {
   return extract_address (buf, TYPE_LENGTH (type));
 }
 
 CORE_ADDR
-signed_pointer_to_address (struct type *type, void *buf)
+signed_pointer_to_address (struct type *type, const void *buf)
 {
   return extract_signed_integer (buf, TYPE_LENGTH (type));
 }
@@ -384,7 +391,7 @@ symbol_read_needs_frame (struct symbol *sym)
     case LOC_LOCAL_ARG:
     case LOC_BASEREG:
     case LOC_BASEREG_ARG:
-    case LOC_THREAD_LOCAL_STATIC:
+    case LOC_HP_THREAD_LOCAL_STATIC:
       return 1;
 
     case LOC_UNDEF:
@@ -411,7 +418,7 @@ symbol_read_needs_frame (struct symbol *sym)
    and a stack frame id, read the value of the variable
    and return a (pointer to a) struct value containing the value. 
    If the variable cannot be found, return a zero pointer.
-   If FRAME is NULL, use the selected_frame.  */
+   If FRAME is NULL, use the deprecated_selected_frame.  */
 
 struct value *
 read_var_value (register struct symbol *var, struct frame_info *frame)
@@ -428,7 +435,7 @@ read_var_value (register struct symbol *var, struct frame_info *frame)
   len = TYPE_LENGTH (type);
 
   if (frame == NULL)
-    frame = selected_frame;
+    frame = deprecated_selected_frame;
 
   switch (SYMBOL_CLASS (var))
     {
@@ -522,7 +529,7 @@ addresses have not been bound by the dynamic loader. Try again when executable i
 
     case LOC_BASEREG:
     case LOC_BASEREG_ARG:
-    case LOC_THREAD_LOCAL_STATIC:
+    case LOC_HP_THREAD_LOCAL_STATIC:
       {
        struct value *regval;
 
@@ -535,6 +542,20 @@ addresses have not been bound by the dynamic loader. Try again when executable i
        break;
       }
 
+    case LOC_THREAD_LOCAL_STATIC:
+      {
+        if (target_get_thread_local_address_p ())
+          addr = target_get_thread_local_address (inferior_ptid,
+                                                  SYMBOL_OBJFILE (var),
+                                                  SYMBOL_VALUE_ADDRESS (var));
+        /* It wouldn't be wrong here to try a gdbarch method, too;
+           finding TLS is an ABI-specific thing.  But we don't do that
+           yet.  */
+        else
+          error ("Cannot find thread-local variables on this target");
+        break;
+      }
+
     case LOC_TYPEDEF:
       error ("Cannot look up value of a typedef");
       break;
@@ -765,7 +786,7 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame)
           for some good purpose.  */
        {
          VALUE_LVAL (v) = lval_reg_frame_relative;
-         VALUE_FRAME (v) = FRAME_FP (frame);
+         VALUE_FRAME (v) = get_frame_base (frame);
          VALUE_FRAME_REGNUM (v) = regnum;
        }
       else if (mem_stor)
@@ -813,12 +834,12 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame)
   VALUE_LVAL (v) = lval;
   VALUE_ADDRESS (v) = addr;
 
-  /* Convert raw data to virtual format if necessary.  */
+  /* Convert the raw register to the corresponding data value's memory
+     format, if necessary.  */
 
-  if (REGISTER_CONVERTIBLE (regnum))
+  if (CONVERT_REGISTER_P (regnum))
     {
-      REGISTER_CONVERT_TO_VIRTUAL (regnum, type,
-                                  raw_buffer, VALUE_CONTENTS_RAW (v));
+      REGISTER_TO_VALUE (regnum, type, raw_buffer, VALUE_CONTENTS_RAW (v));
     }
   else
     {
This page took 0.033998 seconds and 4 git commands to generate.