1 /* Find a variable's value in memory, for GDB, the GNU debugger.
2 Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
3 1996, 1997, 1998, 1999, 2000, 2001
4 Free Software Foundation, Inc.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
31 #include "gdb_string.h"
32 #include "floatformat.h"
33 #include "symfile.h" /* for overlay functions */
36 /* This is used to indicate that we don't know the format of the floating point
37 number. Typically, this is useful for native ports, where the actual format
38 is irrelevant, since no conversions will be taking place. */
40 const struct floatformat floatformat_unknown;
42 /* Basic byte-swapping routines. GDB has needed these for a long time...
43 All extract a target-format integer at ADDR which is LEN bytes long. */
45 #if TARGET_CHAR_BIT != 8 || HOST_CHAR_BIT != 8
46 /* 8 bit characters are a pretty safe assumption these days, so we
47 assume it throughout all these swapping routines. If we had to deal with
48 9 bit characters, we would need to make len be in bits and would have
49 to re-write these routines... */
54 extract_signed_integer (void *addr, int len)
58 unsigned char *startaddr = (unsigned char *) addr;
59 unsigned char *endaddr = startaddr + len;
61 if (len > (int) sizeof (LONGEST))
63 That operation is not available on integers of more than %d bytes.",
66 /* Start at the most significant end of the integer, and work towards
67 the least significant. */
68 if (TARGET_BYTE_ORDER == BIG_ENDIAN)
71 /* Do the sign extension once at the start. */
72 retval = ((LONGEST) * p ^ 0x80) - 0x80;
73 for (++p; p < endaddr; ++p)
74 retval = (retval << 8) | *p;
79 /* Do the sign extension once at the start. */
80 retval = ((LONGEST) * p ^ 0x80) - 0x80;
81 for (--p; p >= startaddr; --p)
82 retval = (retval << 8) | *p;
88 extract_unsigned_integer (void *addr, int len)
92 unsigned char *startaddr = (unsigned char *) addr;
93 unsigned char *endaddr = startaddr + len;
95 if (len > (int) sizeof (ULONGEST))
97 That operation is not available on integers of more than %d bytes.",
100 /* Start at the most significant end of the integer, and work towards
101 the least significant. */
103 if (TARGET_BYTE_ORDER == BIG_ENDIAN)
105 for (p = startaddr; p < endaddr; ++p)
106 retval = (retval << 8) | *p;
110 for (p = endaddr - 1; p >= startaddr; --p)
111 retval = (retval << 8) | *p;
116 /* Sometimes a long long unsigned integer can be extracted as a
117 LONGEST value. This is done so that we can print these values
118 better. If this integer can be converted to a LONGEST, this
119 function returns 1 and sets *PVAL. Otherwise it returns 0. */
122 extract_long_unsigned_integer (void *addr, int orig_len, LONGEST *pval)
124 char *p, *first_addr;
128 if (TARGET_BYTE_ORDER == BIG_ENDIAN)
130 for (p = (char *) addr;
131 len > (int) sizeof (LONGEST) && p < (char *) addr + orig_len;
143 first_addr = (char *) addr;
144 for (p = (char *) addr + orig_len - 1;
145 len > (int) sizeof (LONGEST) && p >= (char *) addr;
155 if (len <= (int) sizeof (LONGEST))
157 *pval = (LONGEST) extract_unsigned_integer (first_addr,
166 /* Treat the LEN bytes at ADDR as a target-format address, and return
167 that address. ADDR is a buffer in the GDB process, not in the
170 This function should only be used by target-specific code. It
171 assumes that a pointer has the same representation as that thing's
172 address represented as an integer. Some machines use word
173 addresses, or similarly munged things, for certain types of
174 pointers, so that assumption doesn't hold everywhere.
176 Common code should use extract_typed_address instead, or something
177 else based on POINTER_TO_ADDRESS. */
180 extract_address (void *addr, int len)
182 /* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
183 whether we want this to be true eventually. */
184 return (CORE_ADDR) extract_unsigned_integer (addr, len);
188 /* Treat the bytes at BUF as a pointer of type TYPE, and return the
189 address it represents. */
191 extract_typed_address (void *buf, struct type *type)
193 if (TYPE_CODE (type) != TYPE_CODE_PTR
194 && TYPE_CODE (type) != TYPE_CODE_REF)
195 internal_error (__FILE__, __LINE__,
196 "extract_typed_address: "
197 "type is not a pointer or reference");
199 return POINTER_TO_ADDRESS (type, buf);
204 store_signed_integer (void *addr, int len, LONGEST val)
207 unsigned char *startaddr = (unsigned char *) addr;
208 unsigned char *endaddr = startaddr + len;
210 /* Start at the least significant end of the integer, and work towards
211 the most significant. */
212 if (TARGET_BYTE_ORDER == BIG_ENDIAN)
214 for (p = endaddr - 1; p >= startaddr; --p)
222 for (p = startaddr; p < endaddr; ++p)
231 store_unsigned_integer (void *addr, int len, ULONGEST val)
234 unsigned char *startaddr = (unsigned char *) addr;
235 unsigned char *endaddr = startaddr + len;
237 /* Start at the least significant end of the integer, and work towards
238 the most significant. */
239 if (TARGET_BYTE_ORDER == BIG_ENDIAN)
241 for (p = endaddr - 1; p >= startaddr; --p)
249 for (p = startaddr; p < endaddr; ++p)
257 /* Store the address VAL as a LEN-byte value in target byte order at
258 ADDR. ADDR is a buffer in the GDB process, not in the inferior.
260 This function should only be used by target-specific code. It
261 assumes that a pointer has the same representation as that thing's
262 address represented as an integer. Some machines use word
263 addresses, or similarly munged things, for certain types of
264 pointers, so that assumption doesn't hold everywhere.
266 Common code should use store_typed_address instead, or something else
267 based on ADDRESS_TO_POINTER. */
269 store_address (void *addr, int len, LONGEST val)
271 store_unsigned_integer (addr, len, val);
275 /* Store the address ADDR as a pointer of type TYPE at BUF, in target
278 store_typed_address (void *buf, struct type *type, CORE_ADDR addr)
280 if (TYPE_CODE (type) != TYPE_CODE_PTR
281 && TYPE_CODE (type) != TYPE_CODE_REF)
282 internal_error (__FILE__, __LINE__,
283 "store_typed_address: "
284 "type is not a pointer or reference");
286 ADDRESS_TO_POINTER (type, buf, addr);
292 /* Extract a floating-point number from a target-order byte-stream at ADDR.
293 Returns the value as type DOUBLEST.
295 If the host and target formats agree, we just copy the raw data into the
296 appropriate type of variable and return, letting the host increase precision
297 as necessary. Otherwise, we call the conversion routine and let it do the
301 extract_floating (void *addr, int len)
305 if (len * TARGET_CHAR_BIT == TARGET_FLOAT_BIT)
307 if (HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT)
311 memcpy (&retval, addr, sizeof (retval));
315 floatformat_to_doublest (TARGET_FLOAT_FORMAT, addr, &dretval);
317 else if (len * TARGET_CHAR_BIT == TARGET_DOUBLE_BIT)
319 if (HOST_DOUBLE_FORMAT == TARGET_DOUBLE_FORMAT)
323 memcpy (&retval, addr, sizeof (retval));
327 floatformat_to_doublest (TARGET_DOUBLE_FORMAT, addr, &dretval);
329 else if (len * TARGET_CHAR_BIT == TARGET_LONG_DOUBLE_BIT)
331 if (HOST_LONG_DOUBLE_FORMAT == TARGET_LONG_DOUBLE_FORMAT)
335 memcpy (&retval, addr, sizeof (retval));
339 floatformat_to_doublest (TARGET_LONG_DOUBLE_FORMAT, addr, &dretval);
343 error ("Can't deal with a floating point number of %d bytes.", len);
350 store_floating (void *addr, int len, DOUBLEST val)
352 if (len * TARGET_CHAR_BIT == TARGET_FLOAT_BIT)
354 if (HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT)
356 float floatval = val;
358 memcpy (addr, &floatval, sizeof (floatval));
361 floatformat_from_doublest (TARGET_FLOAT_FORMAT, &val, addr);
363 else if (len * TARGET_CHAR_BIT == TARGET_DOUBLE_BIT)
365 if (HOST_DOUBLE_FORMAT == TARGET_DOUBLE_FORMAT)
367 double doubleval = val;
369 memcpy (addr, &doubleval, sizeof (doubleval));
372 floatformat_from_doublest (TARGET_DOUBLE_FORMAT, &val, addr);
374 else if (len * TARGET_CHAR_BIT == TARGET_LONG_DOUBLE_BIT)
376 if (HOST_LONG_DOUBLE_FORMAT == TARGET_LONG_DOUBLE_FORMAT)
377 memcpy (addr, &val, sizeof (val));
379 floatformat_from_doublest (TARGET_LONG_DOUBLE_FORMAT, &val, addr);
383 error ("Can't deal with a floating point number of %d bytes.", len);
387 /* Return a `value' with the contents of register REGNUM
388 in its virtual format, with the type specified by
389 REGISTER_VIRTUAL_TYPE.
391 NOTE: returns NULL if register value is not available.
392 Caller will check return value or die! */
395 value_of_register (int regnum)
399 register value_ptr reg_val;
400 char *raw_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
403 get_saved_register (raw_buffer, &optim, &addr,
404 selected_frame, regnum, &lval);
406 if (register_cached (regnum) < 0)
407 return NULL; /* register value not available */
409 reg_val = allocate_value (REGISTER_VIRTUAL_TYPE (regnum));
411 /* Convert raw data to virtual format if necessary. */
413 if (REGISTER_CONVERTIBLE (regnum))
415 REGISTER_CONVERT_TO_VIRTUAL (regnum, REGISTER_VIRTUAL_TYPE (regnum),
416 raw_buffer, VALUE_CONTENTS_RAW (reg_val));
418 else if (REGISTER_RAW_SIZE (regnum) == REGISTER_VIRTUAL_SIZE (regnum))
419 memcpy (VALUE_CONTENTS_RAW (reg_val), raw_buffer,
420 REGISTER_RAW_SIZE (regnum));
422 internal_error (__FILE__, __LINE__,
423 "Register \"%s\" (%d) has conflicting raw (%d) and virtual (%d) size",
424 REGISTER_NAME (regnum),
426 REGISTER_RAW_SIZE (regnum),
427 REGISTER_VIRTUAL_SIZE (regnum));
428 VALUE_LVAL (reg_val) = lval;
429 VALUE_ADDRESS (reg_val) = addr;
430 VALUE_REGNO (reg_val) = regnum;
431 VALUE_OPTIMIZED_OUT (reg_val) = optim;
435 /* Given a pointer of type TYPE in target form in BUF, return the
436 address it represents. */
438 unsigned_pointer_to_address (struct type *type, void *buf)
440 return extract_address (buf, TYPE_LENGTH (type));
444 signed_pointer_to_address (struct type *type, void *buf)
446 return extract_signed_integer (buf, TYPE_LENGTH (type));
449 /* Given an address, store it as a pointer of type TYPE in target
452 unsigned_address_to_pointer (struct type *type, void *buf, CORE_ADDR addr)
454 store_address (buf, TYPE_LENGTH (type), addr);
458 address_to_signed_pointer (struct type *type, void *buf, CORE_ADDR addr)
460 store_signed_integer (buf, TYPE_LENGTH (type), addr);
463 /* Will calling read_var_value or locate_var_value on SYM end
464 up caring what frame it is being evaluated relative to? SYM must
467 symbol_read_needs_frame (struct symbol *sym)
469 switch (SYMBOL_CLASS (sym))
471 /* All cases listed explicitly so that gcc -Wall will detect it if
472 we failed to consider one. */
477 case LOC_REGPARM_ADDR:
481 case LOC_BASEREG_ARG:
482 case LOC_THREAD_LOCAL_STATIC:
492 /* Getting the address of a label can be done independently of the block,
493 even if some *uses* of that address wouldn't work so well without
497 case LOC_CONST_BYTES:
499 case LOC_OPTIMIZED_OUT:
505 /* Given a struct symbol for a variable,
506 and a stack frame id, read the value of the variable
507 and return a (pointer to a) struct value containing the value.
508 If the variable cannot be found, return a zero pointer.
509 If FRAME is NULL, use the selected_frame. */
512 read_var_value (register struct symbol *var, struct frame_info *frame)
514 register value_ptr v;
515 struct type *type = SYMBOL_TYPE (var);
519 v = allocate_value (type);
520 VALUE_LVAL (v) = lval_memory; /* The most likely possibility. */
521 VALUE_BFD_SECTION (v) = SYMBOL_BFD_SECTION (var);
523 len = TYPE_LENGTH (type);
526 frame = selected_frame;
528 switch (SYMBOL_CLASS (var))
531 /* Put the constant back in target format. */
532 store_signed_integer (VALUE_CONTENTS_RAW (v), len,
533 (LONGEST) SYMBOL_VALUE (var));
534 VALUE_LVAL (v) = not_lval;
538 /* Put the constant back in target format. */
539 if (overlay_debugging)
542 = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
543 SYMBOL_BFD_SECTION (var));
544 store_typed_address (VALUE_CONTENTS_RAW (v), type, addr);
547 store_typed_address (VALUE_CONTENTS_RAW (v), type,
548 SYMBOL_VALUE_ADDRESS (var));
549 VALUE_LVAL (v) = not_lval;
552 case LOC_CONST_BYTES:
555 bytes_addr = SYMBOL_VALUE_BYTES (var);
556 memcpy (VALUE_CONTENTS_RAW (v), bytes_addr, len);
557 VALUE_LVAL (v) = not_lval;
562 if (overlay_debugging)
563 addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
564 SYMBOL_BFD_SECTION (var));
566 addr = SYMBOL_VALUE_ADDRESS (var);
570 /* The import slot does not have a real address in it from the
571 dynamic loader (dld.sl on HP-UX), if the target hasn't begun
572 execution yet, so check for that. */
573 if (!target_has_execution)
575 Attempt to access variable defined in different shared object or load module when\n\
576 addresses have not been bound by the dynamic loader. Try again when executable is running.");
578 addr = SYMBOL_VALUE_ADDRESS (var);
579 addr = read_memory_unsigned_integer
580 (addr, TARGET_PTR_BIT / TARGET_CHAR_BIT);
586 addr = FRAME_ARGS_ADDRESS (frame);
589 addr += SYMBOL_VALUE (var);
595 addr = FRAME_ARGS_ADDRESS (frame);
598 addr += SYMBOL_VALUE (var);
599 addr = read_memory_unsigned_integer
600 (addr, TARGET_PTR_BIT / TARGET_CHAR_BIT);
607 addr = FRAME_LOCALS_ADDRESS (frame);
608 addr += SYMBOL_VALUE (var);
612 case LOC_BASEREG_ARG:
614 char *buf = (char*) alloca (MAX_REGISTER_RAW_SIZE);
615 get_saved_register (buf, NULL, NULL, frame, SYMBOL_BASEREG (var),
617 addr = extract_address (buf, REGISTER_RAW_SIZE (SYMBOL_BASEREG (var)));
618 addr += SYMBOL_VALUE (var);
622 case LOC_THREAD_LOCAL_STATIC:
624 char *buf = (char*) alloca (MAX_REGISTER_RAW_SIZE);
626 get_saved_register (buf, NULL, NULL, frame, SYMBOL_BASEREG (var),
628 addr = extract_address (buf, REGISTER_RAW_SIZE (SYMBOL_BASEREG (var)));
629 addr += SYMBOL_VALUE (var);
634 error ("Cannot look up value of a typedef");
638 if (overlay_debugging)
639 VALUE_ADDRESS (v) = symbol_overlayed_address
640 (BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_BFD_SECTION (var));
642 VALUE_ADDRESS (v) = BLOCK_START (SYMBOL_BLOCK_VALUE (var));
647 case LOC_REGPARM_ADDR:
650 int regno = SYMBOL_VALUE (var);
655 b = get_frame_block (frame);
657 if (SYMBOL_CLASS (var) == LOC_REGPARM_ADDR)
659 regval = value_from_register (lookup_pointer_type (type),
664 error ("Value of register variable not available.");
666 addr = value_as_pointer (regval);
667 VALUE_LVAL (v) = lval_memory;
671 regval = value_from_register (type, regno, frame);
674 error ("Value of register variable not available.");
682 struct minimal_symbol *msym;
684 msym = lookup_minimal_symbol (SYMBOL_NAME (var), NULL, NULL);
687 if (overlay_debugging)
688 addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (msym),
689 SYMBOL_BFD_SECTION (msym));
691 addr = SYMBOL_VALUE_ADDRESS (msym);
695 case LOC_OPTIMIZED_OUT:
696 VALUE_LVAL (v) = not_lval;
697 VALUE_OPTIMIZED_OUT (v) = 1;
701 error ("Cannot look up value of a botched symbol.");
705 VALUE_ADDRESS (v) = addr;
710 /* Return a value of type TYPE, stored in register REGNUM, in frame
713 NOTE: returns NULL if register value is not available.
714 Caller will check return value or die! */
717 value_from_register (struct type *type, int regnum, struct frame_info *frame)
719 char *raw_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
722 value_ptr v = allocate_value (type);
723 char *value_bytes = 0;
724 int value_bytes_copied = 0;
725 int num_storage_locs;
729 CHECK_TYPEDEF (type);
730 len = TYPE_LENGTH (type);
732 /* Pointers on D10V are really only 16 bits,
733 but we lie to gdb elsewhere... */
734 if (GDB_TARGET_IS_D10V && TYPE_CODE (type) == TYPE_CODE_PTR)
737 VALUE_REGNO (v) = regnum;
739 num_storage_locs = (len > REGISTER_VIRTUAL_SIZE (regnum) ?
740 ((len - 1) / REGISTER_RAW_SIZE (regnum)) + 1 :
743 if (num_storage_locs > 1
744 #ifdef GDB_TARGET_IS_H8500
745 || TYPE_CODE (type) == TYPE_CODE_PTR
749 /* Value spread across multiple storage locations. */
752 int mem_stor = 0, reg_stor = 0;
753 int mem_tracking = 1;
754 CORE_ADDR last_addr = 0;
755 CORE_ADDR first_addr = 0;
757 value_bytes = (char *) alloca (len + MAX_REGISTER_RAW_SIZE);
759 /* Copy all of the data out, whereever it may be. */
761 #ifdef GDB_TARGET_IS_H8500
762 /* This piece of hideosity is required because the H8500 treats registers
763 differently depending upon whether they are used as pointers or not. As a
764 pointer, a register needs to have a page register tacked onto the front.
765 An alternate way to do this would be to have gcc output different register
766 numbers for the pointer & non-pointer form of the register. But, it
767 doesn't, so we're stuck with this. */
769 if (TYPE_CODE (type) == TYPE_CODE_PTR
780 page_regnum = SEG_D_REGNUM;
784 page_regnum = SEG_E_REGNUM;
788 page_regnum = SEG_T_REGNUM;
793 get_saved_register (value_bytes + 1,
800 if (register_cached (page_regnum) == -1)
801 return NULL; /* register value not available */
803 if (lval == lval_register)
810 get_saved_register (value_bytes + 2,
817 if (register_cached (regnum) == -1)
818 return NULL; /* register value not available */
820 if (lval == lval_register)
825 mem_tracking = mem_tracking && (addr == last_addr);
830 #endif /* GDB_TARGET_IS_H8500 */
831 for (local_regnum = regnum;
832 value_bytes_copied < len;
833 (value_bytes_copied += REGISTER_RAW_SIZE (local_regnum),
836 get_saved_register (value_bytes + value_bytes_copied,
843 if (register_cached (local_regnum) == -1)
844 return NULL; /* register value not available */
846 if (regnum == local_regnum)
848 if (lval == lval_register)
856 && (regnum == local_regnum
857 || addr == last_addr));
862 if ((reg_stor && mem_stor)
863 || (mem_stor && !mem_tracking))
864 /* Mixed storage; all of the hassle we just went through was
865 for some good purpose. */
867 VALUE_LVAL (v) = lval_reg_frame_relative;
868 VALUE_FRAME (v) = FRAME_FP (frame);
869 VALUE_FRAME_REGNUM (v) = regnum;
873 VALUE_LVAL (v) = lval_memory;
874 VALUE_ADDRESS (v) = first_addr;
878 VALUE_LVAL (v) = lval_register;
879 VALUE_ADDRESS (v) = first_addr;
882 internal_error (__FILE__, __LINE__,
883 "value_from_register: Value not stored anywhere!");
885 VALUE_OPTIMIZED_OUT (v) = optim;
887 /* Any structure stored in more than one register will always be
888 an integral number of registers. Otherwise, you'd need to do
889 some fiddling with the last register copied here for little
892 /* Copy into the contents section of the value. */
893 memcpy (VALUE_CONTENTS_RAW (v), value_bytes, len);
895 /* Finally do any conversion necessary when extracting this
896 type from more than one register. */
897 #ifdef REGISTER_CONVERT_TO_TYPE
898 REGISTER_CONVERT_TO_TYPE (regnum, type, VALUE_CONTENTS_RAW (v));
903 /* Data is completely contained within a single register. Locate the
904 register's contents in a real register or in core;
905 read the data in raw format. */
907 get_saved_register (raw_buffer, &optim, &addr, frame, regnum, &lval);
909 if (register_cached (regnum) == -1)
910 return NULL; /* register value not available */
912 VALUE_OPTIMIZED_OUT (v) = optim;
913 VALUE_LVAL (v) = lval;
914 VALUE_ADDRESS (v) = addr;
916 /* Convert raw data to virtual format if necessary. */
918 if (REGISTER_CONVERTIBLE (regnum))
920 REGISTER_CONVERT_TO_VIRTUAL (regnum, type,
921 raw_buffer, VALUE_CONTENTS_RAW (v));
925 /* Raw and virtual formats are the same for this register. */
927 if (TARGET_BYTE_ORDER == BIG_ENDIAN && len < REGISTER_RAW_SIZE (regnum))
929 /* Big-endian, and we want less than full size. */
930 VALUE_OFFSET (v) = REGISTER_RAW_SIZE (regnum) - len;
933 memcpy (VALUE_CONTENTS_RAW (v), raw_buffer + VALUE_OFFSET (v), len);
936 if (GDB_TARGET_IS_D10V
937 && TYPE_CODE (type) == TYPE_CODE_PTR)
942 snum = (unsigned short)
943 extract_unsigned_integer (VALUE_CONTENTS_RAW (v), 2);
945 if (TYPE_TARGET_TYPE (type) /* pointer to function */
946 && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC))
947 num = D10V_MAKE_IADDR (snum);
948 else /* pointer to data */
949 num = D10V_MAKE_DADDR (snum);
951 store_address (VALUE_CONTENTS_RAW (v), 4, num);
957 /* Given a struct symbol for a variable or function,
958 and a stack frame id,
959 return a (pointer to a) struct value containing the properly typed
963 locate_var_value (register struct symbol *var, struct frame_info *frame)
966 struct type *type = SYMBOL_TYPE (var);
967 value_ptr lazy_value;
969 /* Evaluate it first; if the result is a memory address, we're fine.
970 Lazy evaluation pays off here. */
972 lazy_value = read_var_value (var, frame);
974 error ("Address of \"%s\" is unknown.", SYMBOL_SOURCE_NAME (var));
976 if (VALUE_LAZY (lazy_value)
977 || TYPE_CODE (type) == TYPE_CODE_FUNC)
981 addr = VALUE_ADDRESS (lazy_value);
982 val = value_from_pointer (lookup_pointer_type (type), addr);
983 VALUE_BFD_SECTION (val) = VALUE_BFD_SECTION (lazy_value);
987 /* Not a memory address; check what the problem was. */
988 switch (VALUE_LVAL (lazy_value))
991 case lval_reg_frame_relative:
992 error ("Address requested for identifier \"%s\" which is in a register.",
993 SYMBOL_SOURCE_NAME (var));
997 error ("Can't take address of \"%s\" which isn't an lvalue.",
998 SYMBOL_SOURCE_NAME (var));
1001 return 0; /* For lint -- never reached */