forked from Imagelibrary/binutils-gdb
* fileread.cc (File_read::find_view): Add byteshift and vshifted
parameters. Update for new key type to views_. Change all callers. (File_read::read): Adjust for byteshift in returned view. (File_read::add_view): New function, broken out of find_and_make_view. (File_read::make_view): New function, broken out of find_and_make_view. (File_read::find_or_make_view): Add offset and aligned parameters. Rewrite accordingly. Change all callers. (File_read::get_view): Add offset and aligned parameters. Adjust for byteshift in return value. (File_read::get_lasting_view): Likewise. * fileread.h (class File_read): Update declarations. (class File_read::View): Add byteshift_ field. Add byteshift to constructor. Add byteshift method. * archive.h (Archive::clear_uncached_views): New function. (Archive::get_view): Add aligned parameter. Change all callers. * object.h (Object::get_view): Add aligned parameter. Change all callers. (Object::get_lasting_view): Likewise. * fileread.cc (File_read::release): Don't call clear_views if there are multiple objects. * fileread.h (File_read::clear_uncached_views): New function. * archive.cc (Add_archive_symbols::run): Call clear_uncached_views on the archive.
This commit is contained in:
@@ -295,7 +295,7 @@ class Object
|
||||
// Return a View.
|
||||
View
|
||||
view(off_t file_offset, section_size_type data_size)
|
||||
{ return View(this->get_view(file_offset, data_size, true)); }
|
||||
{ return View(this->get_view(file_offset, data_size, true, true)); }
|
||||
|
||||
// Report an error.
|
||||
void
|
||||
@@ -314,22 +314,23 @@ class Object
|
||||
|
||||
// Get a View given a Location.
|
||||
View view(Location loc)
|
||||
{ return View(this->get_view(loc.file_offset, loc.data_size, true)); }
|
||||
{ return View(this->get_view(loc.file_offset, loc.data_size, true, true)); }
|
||||
|
||||
// Get a view into the underlying file.
|
||||
const unsigned char*
|
||||
get_view(off_t start, section_size_type size, bool cache)
|
||||
get_view(off_t start, section_size_type size, bool aligned, bool cache)
|
||||
{
|
||||
return this->input_file()->file().get_view(start + this->offset_, size,
|
||||
cache);
|
||||
return this->input_file()->file().get_view(this->offset_, start, size,
|
||||
aligned, cache);
|
||||
}
|
||||
|
||||
// Get a lasting view into the underlying file.
|
||||
File_view*
|
||||
get_lasting_view(off_t start, section_size_type size, bool cache)
|
||||
get_lasting_view(off_t start, section_size_type size, bool aligned,
|
||||
bool cache)
|
||||
{
|
||||
return this->input_file()->file().get_lasting_view(start + this->offset_,
|
||||
size, cache);
|
||||
return this->input_file()->file().get_lasting_view(this->offset_, start,
|
||||
size, aligned, cache);
|
||||
}
|
||||
|
||||
// Read data from the underlying file.
|
||||
|
||||
Reference in New Issue
Block a user