This is the mail archive of the gdb-patches@sources.redhat.com 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]

[RFC] Bug in remote.c


While trying to get gdbserver working on FreeBSD, I discovered
something that really smells like a bug in remote.c.

In remote_prepare_to_store() we have the following:

  /* Make sure the entire registers array is valid.  */
  switch (remote_protocol_P.support)
    {
    case PACKET_DISABLE:
    case PACKET_SUPPORT_UNKNOWN:
      /* NOTE: This isn't rs->sizeof_g_packet because here, we are
         forcing the register cache to read its and not the target
         registers.  */
      deprecated_read_register_bytes (0, (char *) NULL,
				      DEPRECATED_REGISTER_BYTES); /* OK */

Recently, Andrew has removed the need to set REGISTER_BYTES and turned
it into DEPRECATED_REGISTER_BYTES.  On targets that don't set it,
DEPRECATED_REGISTER_BYTES will be zero, which reduces this
deprecated_read_register_bytes call to a no-op.  As a result GDB tries
to write garbage into the registers on the remote target, and sooner
or later things blow up in your face.

A possible solution would be to introduce a new function that
completely fills the register cache upon request.  Comments?

Mark


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