RFA: remote_address_size changes

Kevin Buettner kevinb@cygnus.com
Wed Nov 3 09:44:00 GMT 1999


Andrew,

As you know, I'm working on a port for a 64 bit target and am using
the gdbarch machinery.

When connecting to my remote target, remote_address_size was not
being set properly.  The reason for this is because at the time
of initialization in _initialize_remote(), TARGET_PTR_BIT refers
to the ptr_bit field in default_gdbarch instead of in a gdbarch
struct created for the target.  As a result, remote_address_size
was set to the pointer size of the host and not the target.

I have fixed the problem by deferring the real initialization of
remote_address_size until we get into one of remote_open_1() or
remote_async_open_1().   In order to handle the situation where
the user wants to set it to something else prior to issuing a
"target remote ..." command, I set remote_address_size to 0 in
_initialize_remote().  If, when we get to remote_open_1(), it
hasn't been set to something non-zero by the user, it'll get
initialized properly via TARGET_PTR_BIT.

One of the things I don't like about this patch is that if the user
does "show remoteaddresssize" before connecting to a target, it'll
display as zero.  OTOH, it isn't correct to display the host pointer
size either, so perhaps this isn't so bad.

The other thing that bothers me is that if the user uses the same gdb
session to connect to several different targets with different address
sizes [does anyone ever do this?], the conditional initialization

      if (remote_address_size == 0)
	remote_address_size = TARGET_PTR_BIT;

will not set remote_address_size correctly.

Kevin

	* remote.c (_initialize_remote): Initialize remote_address_size
	to zero.
	(remote_open_1, remote_async_open_1): Set remote_address_size
	to TARGET_PTR_BIT if not already set by the user (or by
	already opening a target).

Index: remote.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/remote.c,v
retrieving revision 1.253
diff -u -r1.253 remote.c
--- remote.c	1999/10/25 08:36:49	1.253
+++ remote.c	1999/11/03 17:08:38
@@ -1775,6 +1775,9 @@
   general_thread = -2;
   continue_thread = -2;
 
+  if (remote_address_size == 0)
+    remote_address_size = TARGET_PTR_BIT;
+
   /* Force remote_write_bytes to check whether target supports
      binary downloading. */
   init_packet_config (&remote_protocol_binary_download);
@@ -1859,6 +1862,9 @@
   general_thread = -2;
   continue_thread = -2;
 
+  if (remote_address_size == 0)
+    remote_address_size = TARGET_PTR_BIT;
+
   /* Force remote_write_bytes to check whether target supports
      binary downloading. */
   init_packet_config (&remote_protocol_binary_download);
@@ -5305,7 +5311,7 @@
 		  &setlist),
      &showlist);
 
-  remote_address_size = TARGET_PTR_BIT;
+  remote_address_size = 0;
   add_show_from_set
     (add_set_cmd ("remoteaddresssize", class_obscure,
 		  var_integer, (char *) &remote_address_size,



More information about the Gdb-patches mailing list