This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfc] [03/18] Cell multi-arch: Save/restore current_gdbarch


Hello Ulrich,

I wonder if it is the right thread to reply, but I would like to
mention about current_gdbarch, so I'll put my reply here.  

extract/store_*signed_integer expect that current_gdbarch points to
the same one as what of the value to be extracted or stored.  But it
seems that your patch set doesn't assure of them, for example, in
regcache_cooked_read_*signed and regcache_cooked_write_*signed.  

It would not be a problem while Cell/B.E. is the only target which has
multi-architecture for GDB, since the endian of both PPU(PPC64) and
SPU are big.  Also current_gdbarch should be removed in the near
future, however, we should take care of them now IMHO.  


From: Ulrich Weigand <uweigand at de.ibm.com>
Subject: [rfc] [03/18] Cell multi-arch: Save/restore current_gdbarch
Date: Sun, 07 Sep 2008 23:12:00 +0200 (CEST)

> Hello,
> 
> this patch would be unnecessary if we were already rid of current_gdbarch.
> 
> However, right now it is necessary in a multi-arch debugger to occasionally
> temporarily set current_gdbarch to the architecture a subsystem is supposed
> to be dealing with.  Those locations include:
> 
> - during target routines called from regcache_raw_read/write
> - while calling frame sniffer callbacks or gdbarch data post_init callbacks
> - while handling one frame during backtrace output
> 
> To do that, this patch introduced a new save_current_gdbarch routine 
> (that works like save_inferior_ptid) and adds calls at the appropriate places.
> 
> Bye,
> Ulrich
> 
> 
> ChangeLog:
> 
> 	* arch-utils.h (save_current_gdbarch): New.
> 	* arch-utils.c (restore_current_gdbarch): New function.
> 	(save_current_gdbarch): Likewise.
> 
> 	* frame.c: Include "arch-utils.h".
> 	(get_frame_id): Reset current_gdbarch while calling frame
> 	sniffer callbacks.
> 	(frame_unwind_register_value): Likewise.
> 	(get_frame_type): Likewise.
> 	(frame_arch_unwind): Likewise.
> 
> 	* stack.c: Include "arch-utils.h".
> 	(print_stack_frame): Reset current_gdbarch to frame arch
> 	while handling one frame.
> 	(print_frame_args): Likewise.
> 	(print_frame_info): Likewise.
> 	(print_frame_local_vars): Likewise.
> 
> 	* regcache.c (regcache_raw_read): Reset current_gdbarch
> 	while calling target routines.
> 	(regcache_raw_write): Likewise.
> 
> 	* gdbarch.sh (gdbarch_data): Reset current_gdbarch while
> 	calling data post_init callback.
> 	* gdbarch.c: Regenerate.

-- 
Emi SUZUKI / emi-suzuki at tjsys.co.jp


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]