Fix bit-/byte-offset mismatch in parameter to read_value_memory
authorAndreas Arnez <arnez@linux.vnet.ibm.com>
Tue, 13 Jun 2017 13:20:31 +0000 (15:20 +0200)
committerAndreas Arnez <arnez@linux.vnet.ibm.com>
Tue, 13 Jun 2017 13:20:31 +0000 (15:20 +0200)
The function read_value_memory accepts a parameter embedded_offset and
expects it to represent the byte offset into the given value.  However,
the only invocation with a possibly non-zero embedded_offset happens in
read_pieced_value, where a bit offset is passed instead.

Adjust the implementation of read_value_memory to meet the caller's
expectation.  This implicitly fixes the invocation in read_pieced_value.

gdb/ChangeLog:

* valops.c (read_value_memory): Change embedded_offset to
represent a bit offset instead of a byte offset.
* value.h (read_value_memory): Adjust comment.

gdb/ChangeLog
gdb/valops.c
gdb/value.h

index 6ca4b5ccca25441b7685e6204b1543a181d2a932..b4a9943ab9fb4c540a9b04d4e07e7c423918ceb8 100644 (file)
@@ -1,3 +1,9 @@
+2017-06-13  Andreas Arnez  <arnez@linux.vnet.ibm.com>
+
+       * valops.c (read_value_memory): Change embedded_offset to
+       represent a bit offset instead of a byte offset.
+       * value.h (read_value_memory): Adjust comment.
+
 2017-06-13  Andreas Arnez  <arnez@linux.vnet.ibm.com>
 
        * dwarf2loc.c (read_pieced_value): Remove unnecessary variables
index 93ae6cf807627124949c59a33a2f95b1be5c29f2..8675e6c00e2dbb2d9963edb28731a424e7388f30 100644 (file)
@@ -958,7 +958,7 @@ value_at_lazy (struct type *type, CORE_ADDR addr)
 }
 
 void
-read_value_memory (struct value *val, LONGEST embedded_offset,
+read_value_memory (struct value *val, LONGEST bit_offset,
                   int stack, CORE_ADDR memaddr,
                   gdb_byte *buffer, size_t length)
 {
@@ -984,8 +984,9 @@ read_value_memory (struct value *val, LONGEST embedded_offset,
       if (status == TARGET_XFER_OK)
        /* nothing */;
       else if (status == TARGET_XFER_UNAVAILABLE)
-       mark_value_bytes_unavailable (val, embedded_offset + xfered_total,
-                                     xfered_partial);
+       mark_value_bits_unavailable (val, (xfered_total * HOST_CHAR_BIT
+                                          + bit_offset),
+                                    xfered_partial * HOST_CHAR_BIT);
       else if (status == TARGET_XFER_EOF)
        memory_error (TARGET_XFER_E_IO, memaddr + xfered_total);
       else
index a1d1609777f0a7a85b2b140c76d068cb791780ef..fb7f13d29423093560723d47b238987613bdc3c3 100644 (file)
@@ -581,12 +581,11 @@ extern int value_contents_eq (const struct value *val1, LONGEST offset1,
 
 /* Read LENGTH addressable memory units starting at MEMADDR into BUFFER,
    which is (or will be copied to) VAL's contents buffer offset by
-   EMBEDDED_OFFSET (that is, to &VAL->contents[EMBEDDED_OFFSET]).
-   Marks value contents ranges as unavailable if the corresponding
-   memory is likewise unavailable.  STACK indicates whether the memory
-   is known to be stack memory.  */
+   BIT_OFFSET bits.  Marks value contents ranges as unavailable if
+   the corresponding memory is likewise unavailable.  STACK indicates
+   whether the memory is known to be stack memory.  */
 
-extern void read_value_memory (struct value *val, LONGEST embedded_offset,
+extern void read_value_memory (struct value *val, LONGEST bit_offset,
                               int stack, CORE_ADDR memaddr,
                               gdb_byte *buffer, size_t length);
 
This page took 0.029207 seconds and 4 git commands to generate.