Skip navigation.
 
mlRe: Distributed objects: can't send simple C struct by value
FROM : Wade Tregaskis
DATE : Sat Oct 30 17:21:13 2004

> 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_removed>, Jabber:
<email_removed>
-- Sed quis custodiet ipsos custodes?

Related mailsAuthorDate
mlDistributed objects: can't send simple C struct by value Michael Heins Oct 30, 10:16
mlRe: Distributed objects: can't send simple C struct by value Wade Tregaskis Oct 30, 11:25
mlRe: Distributed objects: can't send simple C struct by value Michael Heins Oct 30, 16:28
mlRe: Distributed objects: can't send simple C struct by value Wade Tregaskis Oct 30, 17:21
mlRe: Distributed objects: can't send simple C struct by value Michael Heins Oct 30, 18:14
mlRe: Distributed objects: can't send simple C struct by value Jim Correia Oct 30, 19:46
mlRe: Distributed objects: can't send simple C struct by value Michael Heins Oct 30, 19:59
mlRe: Distributed objects: can't send simple C struct by value Michael Heins Oct 31, 17:53