8e7767e Use partial register read/writes in transfer_regset

Authored and Committed by Alan Hayward 5 years ago
    Use partial register read/writes in transfer_regset
    
    This avoids assert failures when the register is bigger than the
    slot size. This happens on Aarch64 when truncating Z registers
    into an fpsimd structure. This can be triggered by running
    gdb command "generate-core-file".
    
    Also, when the register is smaller then the slot size, then
    zero pad when writing to the slot, and truncate when writing
    to the regcache. This happens on Aarch64 with the CPSR register.
    
    Continue to ensure registers are invalidated when both buffers
    are null.
    
    gdb/
    	* regcache.c (readable_regcache::read_part): Fix asserts.
    	(reg_buffer::raw_collect_part): New function.
    	(regcache::write_part): Fix asserts.
    	(reg_buffer::raw_supply_part): New function.
    	(regcache::transfer_regset_register): New helper function.
    	(regcache::transfer_regset): Call new functions.
    	(regcache_supply_regset): Use gdb_byte*.
    	(regcache::supply_regset): Likewise.
    	(regcache_collect_regset): Likewise.
    	(regcache::collect_regset): Likewise.
    	* regcache.h (reg_buffer::raw_collect_part): New declaration.
    	(reg_buffer::raw_supply_part): Likewise.
    	(regcache::transfer_regset_register): Likewise.
    	(regcache::transfer_regset): Use gdb_byte*.
    
        
file modified
+17 -0
file modified
+107 -23
file modified
+18 -2