Skip navigation.
 
mlRe: Distributed objects: can't send simple C struct by value
FROM : Michael Heins
DATE : Sun Oct 31 17:53:06 2004

Thanks to Wade and Jim for helping.  I have concluded that this feature
(passing structs by value to a remote object) is indeed broken for
simple C structs of more than 32 bytes.  I have filed bug report
3860011 for it.

The workaround is pretty benign:  Simply pass a pointer to the struct
instead; because of the way the DO software must work, the struct
contents must be transfered anyway, which is what I was after in the
first place.


On Oct 30, 2004, at 9:21 AM, Wade Tregaskis wrote:

>> 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?
>
>


Michael Heins AA7XY

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