contrib/gdb-7/gdb/jit.c
static file_ptr
mem_bfd_iovec_pread (struct bfd *abfd, void *stream, void *buf,
                     file_ptr nbytes, file_ptr offset)
{
  int err;
  struct target_buffer *buffer = (struct target_buffer *) stream;

  /* If this read will read all of the file, limit it to just the rest.  */
  if (offset + nbytes > buffer->size)
    nbytes = buffer->size - offset;

  /* If there are no more bytes left, we've reached EOF.  */
  if (nbytes == 0)
    return 0;

  err = target_read_memory (buffer->base + offset, (gdb_byte *) buf, nbytes);
  if (err)
    return -1;

  return nbytes;
}
/* For reading the file, we just need to pass through to target_read_memory and
   fix up the arguments and return values.  */
For reading the file, we just need to pass through to target_read_memory and
fix up the arguments and return values.
For reading the file we just need to pass through to target_read_memory and fix up the arguments and return values .
static file_ptr
mem_bfd_iovec_pread (struct bfd *abfd, void *stream, void *buf,
                     file_ptr nbytes, file_ptr offset)
{
  int err;
  struct target_buffer *buffer = (struct target_buffer *) stream;
  if (offset + nbytes > buffer->size)
    nbytes = buffer->size - offset;
  if (nbytes == 0)
    return 0;
  err = target_read_memory (buffer->base + offset, (gdb_byte *) buf, nbytes);
  if (err)
    return -1;
  return nbytes;
}
static file_ptr mem_bfd_iovec_pread ( struct bfd * abfd , void * stream , void * buf , file_ptr nbytes , file_ptr offset ) { int err ; struct target_buffer * buffer = ( struct target_buffer * ) stream ; if ( offset + nbytes > buffer -> size ) nbytes = buffer -> size - offset ; if ( nbytes == 0 ) return 0 ; err = target_read_memory ( buffer -> base + offset , ( gdb_byte * ) buf , nbytes ) ; if ( err ) return -1 ; return nbytes ; }
For reading the file, we just need to pass through to target_read_memory and
fix up the arguments and return values.
For reading the file we just need to pass through to target_read_memory and fix up the arguments and return values .
/* If this read will read all of the file, limit it to just the rest.  */ /* If there are no more bytes left, we've reached EOF.  */