diff options
author | Steve Chamberlain <sac@cygnus> | 1993-06-09 00:52:13 +0000 |
---|---|---|
committer | Steve Chamberlain <sac@cygnus> | 1993-06-09 00:52:13 +0000 |
commit | 86a5593e9ca49ebe907da6371ec90e95377cd45f (patch) | |
tree | 3eec2c7f89e04995c1c8b49d9f4feeb019db40dc /gdb | |
parent | df14b38bafeee2205a66b464643e5c5f6443296c (diff) | |
download | gdb-86a5593e9ca49ebe907da6371ec90e95377cd45f.zip gdb-86a5593e9ca49ebe907da6371ec90e95377cd45f.tar.gz gdb-86a5593e9ca49ebe907da6371ec90e95377cd45f.tar.bz2 |
(read_memory_unsigned_integer): New function.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/core.c | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -244,6 +244,44 @@ read_memory_integer (memaddr, len) error ("Cannot handle integers of %d bytes.", len); return -1; /* for lint */ } + + +unsigned long +read_memory_unsigned_integer (memaddr, len) + CORE_ADDR memaddr; + int len; +{ + unsigned char cbuf; + unsigned short sbuf; + unsigned int ibuf; + unsigned long lbuf; + + if (len == sizeof (char)) + { + read_memory (memaddr, &cbuf, len); + return cbuf; + } + if (len == sizeof (short)) + { + read_memory (memaddr, (char *)&sbuf, len); + SWAP_TARGET_AND_HOST (&sbuf, sizeof (short)); + return sbuf; + } + if (len == sizeof (int)) + { + read_memory (memaddr, (char *)&ibuf, len); + SWAP_TARGET_AND_HOST (&ibuf, sizeof (int)); + return ibuf; + } + if (len == sizeof (lbuf)) + { + read_memory (memaddr, (char *)&lbuf, len); + SWAP_TARGET_AND_HOST (&lbuf, sizeof (lbuf)); + return lbuf; + } + error ("Cannot handle unsigned integers of %d bytes.", len); + return -1; /* for lint */ +} void _initialize_core() |