projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* defs.h (extract_signed_integer, extract_unsigned_integer,
[deliverable/binutils-gdb.git]
/
gdb
/
findvar.c
diff --git
a/gdb/findvar.c
b/gdb/findvar.c
index 1048887fdc061cba49de10437d100665ded55df7..8c027c9156abb2cd2cf8933dff9f8f332d203e2b 100644
(file)
--- a/
gdb/findvar.c
+++ b/
gdb/findvar.c
@@
-48,7
+48,8
@@
you lose
#endif
LONGEST
#endif
LONGEST
-extract_signed_integer (const gdb_byte *addr, int len)
+extract_signed_integer (const gdb_byte *addr, int len,
+ enum bfd_endian byte_order)
{
LONGEST retval;
const unsigned char *p;
{
LONGEST retval;
const unsigned char *p;
@@
-62,7
+63,7
@@
That operation is not available on integers of more than %d bytes."),
/* Start at the most significant end of the integer, and work towards
the least significant. */
/* Start at the most significant end of the integer, and work towards
the least significant. */
- if (
gdbarch_byte_order (current_gdbarch)
== BFD_ENDIAN_BIG)
+ if (
byte_order
== BFD_ENDIAN_BIG)
{
p = startaddr;
/* Do the sign extension once at the start. */
{
p = startaddr;
/* Do the sign extension once at the start. */
@@
-82,7
+83,8
@@
That operation is not available on integers of more than %d bytes."),
}
ULONGEST
}
ULONGEST
-extract_unsigned_integer (const gdb_byte *addr, int len)
+extract_unsigned_integer (const gdb_byte *addr, int len,
+ enum bfd_endian byte_order)
{
ULONGEST retval;
const unsigned char *p;
{
ULONGEST retval;
const unsigned char *p;
@@
-97,7
+99,7
@@
That operation is not available on integers of more than %d bytes."),
/* Start at the most significant end of the integer, and work towards
the least significant. */
retval = 0;
/* Start at the most significant end of the integer, and work towards
the least significant. */
retval = 0;
- if (
gdbarch_byte_order (current_gdbarch)
== BFD_ENDIAN_BIG)
+ if (
byte_order
== BFD_ENDIAN_BIG)
{
for (p = startaddr; p < endaddr; ++p)
retval = (retval << 8) | *p;
{
for (p = startaddr; p < endaddr; ++p)
retval = (retval << 8) | *p;
@@
-117,14
+119,14
@@
That operation is not available on integers of more than %d bytes."),
int
extract_long_unsigned_integer (const gdb_byte *addr, int orig_len,
int
extract_long_unsigned_integer (const gdb_byte *addr, int orig_len,
- LONGEST *pval)
+
enum bfd_endian byte_order,
LONGEST *pval)
{
const gdb_byte *p;
const gdb_byte *first_addr;
int len;
len = orig_len;
{
const gdb_byte *p;
const gdb_byte *first_addr;
int len;
len = orig_len;
- if (
gdbarch_byte_order (current_gdbarch)
== BFD_ENDIAN_BIG)
+ if (
byte_order
== BFD_ENDIAN_BIG)
{
for (p = addr;
len > (int) sizeof (LONGEST) && p < addr + orig_len;
{
for (p = addr;
len > (int) sizeof (LONGEST) && p < addr + orig_len;
@@
-154,7
+156,8
@@
extract_long_unsigned_integer (const gdb_byte *addr, int orig_len,
if (len <= (int) sizeof (LONGEST))
{
*pval = (LONGEST) extract_unsigned_integer (first_addr,
if (len <= (int) sizeof (LONGEST))
{
*pval = (LONGEST) extract_unsigned_integer (first_addr,
- sizeof (LONGEST));
+ sizeof (LONGEST),
+ byte_order);
return 1;
}
return 1;
}
@@
-173,12
+176,13
@@
extract_typed_address (const gdb_byte *buf, struct type *type)
_("extract_typed_address: "
"type is not a pointer or reference"));
_("extract_typed_address: "
"type is not a pointer or reference"));
- return gdbarch_pointer_to_address (
current_gdbarch
, type, buf);
+ return gdbarch_pointer_to_address (
get_type_arch (type)
, type, buf);
}
void
}
void
-store_signed_integer (gdb_byte *addr, int len, LONGEST val)
+store_signed_integer (gdb_byte *addr, int len,
+ enum bfd_endian byte_order, LONGEST val)
{
gdb_byte *p;
gdb_byte *startaddr = addr;
{
gdb_byte *p;
gdb_byte *startaddr = addr;
@@
-186,7
+190,7
@@
store_signed_integer (gdb_byte *addr, int len, LONGEST val)
/* Start at the least significant end of the integer, and work towards
the most significant. */
/* Start at the least significant end of the integer, and work towards
the most significant. */
- if (
gdbarch_byte_order (current_gdbarch)
== BFD_ENDIAN_BIG)
+ if (
byte_order
== BFD_ENDIAN_BIG)
{
for (p = endaddr - 1; p >= startaddr; --p)
{
{
for (p = endaddr - 1; p >= startaddr; --p)
{
@@
-205,7
+209,8
@@
store_signed_integer (gdb_byte *addr, int len, LONGEST val)
}
void
}
void
-store_unsigned_integer (gdb_byte *addr, int len, ULONGEST val)
+store_unsigned_integer (gdb_byte *addr, int len,
+ enum bfd_endian byte_order, ULONGEST val)
{
unsigned char *p;
unsigned char *startaddr = (unsigned char *) addr;
{
unsigned char *p;
unsigned char *startaddr = (unsigned char *) addr;
@@
-213,7
+218,7
@@
store_unsigned_integer (gdb_byte *addr, int len, ULONGEST val)
/* Start at the least significant end of the integer, and work towards
the most significant. */
/* Start at the least significant end of the integer, and work towards
the most significant. */
- if (
gdbarch_byte_order (current_gdbarch)
== BFD_ENDIAN_BIG)
+ if (
byte_order
== BFD_ENDIAN_BIG)
{
for (p = endaddr - 1; p >= startaddr; --p)
{
{
for (p = endaddr - 1; p >= startaddr; --p)
{
@@
-242,7
+247,7
@@
store_typed_address (gdb_byte *buf, struct type *type, CORE_ADDR addr)
_("store_typed_address: "
"type is not a pointer or reference"));
_("store_typed_address: "
"type is not a pointer or reference"));
- gdbarch_address_to_pointer (
current_gdbarch
, type, buf, addr);
+ gdbarch_address_to_pointer (
get_type_arch (type)
, type, buf, addr);
}
}
@@
-275,7
+280,7
@@
value_of_register (int regnum, struct frame_info *frame)
memcpy (value_contents_raw (reg_val), raw_buffer,
register_size (gdbarch, regnum));
VALUE_LVAL (reg_val) = lval;
memcpy (value_contents_raw (reg_val), raw_buffer,
register_size (gdbarch, regnum));
VALUE_LVAL (reg_val) = lval;
-
VALUE_ADDRESS (reg_val) = addr
;
+
set_value_address (reg_val, addr)
;
VALUE_REGNUM (reg_val) = regnum;
set_value_optimized_out (reg_val, optim);
VALUE_FRAME_ID (reg_val) = get_frame_id (frame);
VALUE_REGNUM (reg_val) = regnum;
set_value_optimized_out (reg_val, optim);
VALUE_FRAME_ID (reg_val) = get_frame_id (frame);
@@
-309,30
+314,37
@@
value_of_register_lazy (struct frame_info *frame, int regnum)
/* Given a pointer of type TYPE in target form in BUF, return the
address it represents. */
CORE_ADDR
/* 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, const gdb_byte *buf)
+unsigned_pointer_to_address (struct gdbarch *gdbarch,
+ struct type *type, const gdb_byte *buf)
{
{
- return extract_unsigned_integer (buf, TYPE_LENGTH (type));
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+ return extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
}
CORE_ADDR
}
CORE_ADDR
-signed_pointer_to_address (struct type *type, const gdb_byte *buf)
+signed_pointer_to_address (struct gdbarch *gdbarch,
+ struct type *type, const gdb_byte *buf)
{
{
- return extract_signed_integer (buf, TYPE_LENGTH (type));
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+ return extract_signed_integer (buf, TYPE_LENGTH (type), byte_order);
}
/* Given an address, store it as a pointer of type TYPE in target
format in BUF. */
void
}
/* Given an address, store it as a pointer of type TYPE in target
format in BUF. */
void
-unsigned_address_to_pointer (struct
type *type, gdb_byte *buf
,
- CORE_ADDR addr)
+unsigned_address_to_pointer (struct
gdbarch *gdbarch, struct type *type
,
+
gdb_byte *buf,
CORE_ADDR addr)
{
{
- store_unsigned_integer (buf, TYPE_LENGTH (type), addr);
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+ store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order, addr);
}
void
}
void
-address_to_signed_pointer (struct type *type, gdb_byte *buf, CORE_ADDR addr)
+address_to_signed_pointer (struct gdbarch *gdbarch, struct type *type,
+ gdb_byte *buf, CORE_ADDR addr)
{
{
- store_signed_integer (buf, TYPE_LENGTH (type), addr);
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+ store_signed_integer (buf, TYPE_LENGTH (type), byte_order, addr);
}
\f
/* Will calling read_var_value or locate_var_value on SYM end
}
\f
/* Will calling read_var_value or locate_var_value on SYM end
@@
-347,11
+359,11
@@
symbol_read_needs_frame (struct symbol *sym)
we failed to consider one. */
case LOC_COMPUTED:
/* FIXME: cagney/2004-01-26: It should be possible to
we failed to consider one. */
case LOC_COMPUTED:
/* FIXME: cagney/2004-01-26: It should be possible to
- unconditionally call the SYMBOL_OPS method when available.
+ unconditionally call the SYMBOL_
COMPUTED_
OPS method when available.
Unfortunately DWARF 2 stores the frame-base (instead of the
function) location in a function's symbol. Oops! For the
moment enable this when/where applicable. */
Unfortunately DWARF 2 stores the frame-base (instead of the
function) location in a function's symbol. Oops! For the
moment enable this when/where applicable. */
- return SYMBOL_OPS (sym)->read_needs_frame (sym);
+ return SYMBOL_
COMPUTED_
OPS (sym)->read_needs_frame (sym);
case LOC_REGISTER:
case LOC_ARG:
case LOC_REGISTER:
case LOC_ARG:
@@
-412,6
+424,7
@@
read_var_value (struct symbol *var, struct frame_info *frame)
case LOC_CONST:
/* Put the constant back in target format. */
store_signed_integer (value_contents_raw (v), len,
case LOC_CONST:
/* Put the constant back in target format. */
store_signed_integer (value_contents_raw (v), len,
+ gdbarch_byte_order (get_type_arch (type)),
(LONGEST) SYMBOL_VALUE (var));
VALUE_LVAL (v) = not_lval;
return v;
(LONGEST) SYMBOL_VALUE (var));
VALUE_LVAL (v) = not_lval;
return v;
@@
-477,16
+490,17
@@
read_var_value (struct symbol *var, struct frame_info *frame)
case LOC_BLOCK:
if (overlay_debugging)
case LOC_BLOCK:
if (overlay_debugging)
-
VALUE_ADDRESS (v) =
symbol_overlayed_address
- (BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_OBJ_SECTION (var));
+
set_value_address (v,
symbol_overlayed_address
+ (BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_OBJ_SECTION (var))
)
;
else
else
-
VALUE_ADDRESS (v) = BLOCK_START (SYMBOL_BLOCK_VALUE (var
));
+
set_value_address (v, BLOCK_START (SYMBOL_BLOCK_VALUE (var)
));
return v;
case LOC_REGISTER:
case LOC_REGPARM_ADDR:
{
return v;
case LOC_REGISTER:
case LOC_REGPARM_ADDR:
{
- int regno = SYMBOL_VALUE (var);
+ int regno = SYMBOL_REGISTER_OPS (var)
+ ->register_number (var, get_frame_arch (frame));
struct value *regval;
if (SYMBOL_CLASS (var) == LOC_REGPARM_ADDR)
struct value *regval;
if (SYMBOL_CLASS (var) == LOC_REGPARM_ADDR)
@@
-514,11
+528,11
@@
read_var_value (struct symbol *var, struct frame_info *frame)
case LOC_COMPUTED:
/* FIXME: cagney/2004-01-26: It should be possible to
case LOC_COMPUTED:
/* FIXME: cagney/2004-01-26: It should be possible to
- unconditionally call the SYMBOL_OPS method when available.
+ unconditionally call the SYMBOL_
COMPUTED_
OPS method when available.
Unfortunately DWARF 2 stores the frame-base (instead of the
function) location in a function's symbol. Oops! For the
moment enable this when/where applicable. */
Unfortunately DWARF 2 stores the frame-base (instead of the
function) location in a function's symbol. Oops! For the
moment enable this when/where applicable. */
- return SYMBOL_OPS (var)->read_variable (var, frame);
+ return SYMBOL_
COMPUTED_
OPS (var)->read_variable (var, frame);
case LOC_UNRESOLVED:
{
case LOC_UNRESOLVED:
{
@@
-551,7
+565,7
@@
read_var_value (struct symbol *var, struct frame_info *frame)
break;
}
break;
}
-
VALUE_ADDRESS (v) = addr
;
+
set_value_address (v, addr)
;
set_value_lazy (v, 1);
return v;
}
set_value_lazy (v, 1);
return v;
}
This page took
0.028215 seconds
and
4
git commands to generate.