• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Distributed objects: can't send simple C struct by value
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Distributed objects: can't send simple C struct by value


  • Subject: Re: Distributed objects: can't send simple C struct by value
  • From: Wade Tregaskis <email@hidden>
  • Date: Sun, 31 Oct 2004 01:21:13 +1000

Here is a dump of the struct in the sender just before sending:

BFFFE990: AAAAAAAA 54686973 20697320 6D792074 ....This is my t
BFFFE9A0: 65737420 73747269 6E672077 68696368 est string which
BFFFE9B0: 20676574 73207061 72746C79 20776970 gets partly wip
BFFFE9C0: 6564206F 75742E00 00000000 00000000 ed out..........
BFFFE9D0: 00000000 BBBBBBBB ........

Here it is in the receiver:

BFFFE650: AAAAAAAA 54686973 20697320 6D792074 ....This is my t
BFFFE660: 65737420 73747269 6E672077 A0A03CD4 est string w..<.
BFFFE670: 00528BB0 BFFFE6F0 A0A01234 909FA88C .R.........4....
BFFFE680: BFFFEB00 24022244 909FABF0 02800000 ....$."D........
BFFFE690: 00000020 00000018 ... ....

If I set up authenticationDataForComponents / authenticateComponents delegates on both ends and look at the encoded data in the sender just after encoding the corruption has already happened. I suspect that this has something to do with the way structures are passed by value by the compiler -- I believe that the first part of structs are passed in registers, and the remainder on the stack. I'm guessing that the encoder is not properly taking this into account.

I'm pretty sure gcc doesn't pass values in registers unless specifically instructed to at compile time, so unless you're doing so with your own code, I doubt it. Nonetheless, your suspicion does seem plausible given the values that are being substituted... are these values in any way reliable, or do they appear to be random?

For a definitive test of your theory, check the contents of the registers at some stage before the data is actually sent down the wire, and compare it to what you receive... if your theory is correct (and you check the register contents close enough to where the data is actually sent) you should see some clear correlation.

I'd be very surprised, nonetheless, if this were the issue you postulate... it's hard to imagine no one else would have struck this at any point, even if it is limited to DO. I would imagine the struct is treated simply as a character array of length sizeof(_Msg), so if it were in any way broken, nothing would work (since ultimately everything has to be treated as a character array at one point or another).

I can't think of any alternatives possibilities, though. I'd be very interested to hear of any progress you make, and of course the final answer if you can find it.

Wade Tregaskis (AIM, Yahoo & Skype: wadetregaskis, ICQ: 40056898, MSN & email: email@hidden, Jabber: email@hidden
-- Sed quis custodiet ipsos custodes?

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: Distributed objects: can't send simple C struct by value
      • From: Michael Heins <email@hidden>
    • Re: Distributed objects: can't send simple C struct by value
      • From: Michael Heins <email@hidden>
References: 
 >Distributed objects: can't send simple C struct by value (From: Michael Heins <email@hidden>)
 >Re: Distributed objects: can't send simple C struct by value (From: Wade Tregaskis <email@hidden>)
 >Re: Distributed objects: can't send simple C struct by value (From: Michael Heins <email@hidden>)

  • Prev by Date: Re: Distributed objects: can't send simple C struct by value
  • Next by Date: Determining path to cocoa application in file system
  • Previous by thread: Re: Distributed objects: can't send simple C struct by value
  • Next by thread: Re: Distributed objects: can't send simple C struct by value
  • Index(es):
    • Date
    • Thread