if (get_traceframe_number () != -1)
{
int pos = 0;
+ enum target_xfer_status res;
/* Iterate through the traceframe's blocks, looking for
memory. */
/* Skip over this block. */
pos += (8 + 2 + mlen);
}
- }
- /* It's unduly pedantic to refuse to look at the executable for
- read-only pieces; so do the equivalent of readonly regions aka
- QTro packet. */
- /* FIXME account for relocation at some point. */
- if (exec_bfd)
- {
- asection *s;
- bfd_size_type size;
- bfd_vma vma;
+ /* Requested memory is unavailable in the context of traceframes,
+ and this address falls within a read-only section, fallback
+ to reading from executable. */
+ res = exec_read_partial_read_only (readbuf, offset, len, xfered_len);
- for (s = exec_bfd->sections; s; s = s->next)
+ if (res == TARGET_XFER_OK)
+ return TARGET_XFER_OK;
+ else
{
- if ((s->flags & SEC_LOAD) == 0
- || (s->flags & SEC_READONLY) == 0)
- continue;
-
- vma = s->vma;
- size = bfd_get_section_size (s);
- if (vma <= offset && offset < (vma + size))
- {
- ULONGEST amt;
-
- amt = (vma + size) - offset;
- if (amt > len)
- amt = len;
-
- *xfered_len = bfd_get_section_contents (exec_bfd, s,
- readbuf, offset - vma, amt);
- return TARGET_XFER_OK;
- }
+ /* No use trying further, we know some memory starting
+ at MEMADDR isn't available. */
+ *xfered_len = len;
+ return TARGET_XFER_UNAVAILABLE;
}
}
-
- /* Indicate failure to find the requested memory block. */
- return TARGET_XFER_E_IO;
+ else
+ {
+ /* Fallback to reading from read-only sections. */
+ return section_table_read_available_memory (readbuf, offset, len,
+ xfered_len);
+ }
}
/* Iterate through the blocks of a trace frame, looking for a 'V'
return found;
}
-static int
-tfile_has_all_memory (struct target_ops *ops)
-{
- return 1;
-}
-
-static int
-tfile_has_memory (struct target_ops *ops)
-{
- return 1;
-}
-
/* Callback for traceframe_walk_blocks. Builds a traceframe_info
object for the tfile target's current traceframe. */
tfile_ops.to_trace_find = tfile_trace_find;
tfile_ops.to_get_trace_state_variable_value
= tfile_get_trace_state_variable_value;
- tfile_ops.to_has_all_memory = tfile_has_all_memory;
- tfile_ops.to_has_memory = tfile_has_memory;
tfile_ops.to_traceframe_info = tfile_traceframe_info;
}