Bug 3055

Summary: SyscallEventInfo cross-platform oddity
Product: frysk Reporter: Tom Tromey <tromey>
Component: generalAssignee: Yao Qi <qiyaoltc>
Status: ASSIGNED ---    
Severity: normal CC: qiyaoltc
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Bug Depends on:    
Bug Blocks: 1524    

Description Tom Tromey 2006-08-15 15:18:24 UTC
On x86 SyscallEventInfo.returnCode apparently does not sign-extend
the return result of a 'close'.  However, Yao says that sign extension
does happen on PPC64.

I think it would be preferable for this behavior to be platform independent.
Also I think the sign extension approach is simpler for the end user.
Comment 1 Yao Qi 2006-08-31 16:29:09 UTC
Hi, Tom,
Could you explain a little about 
"SyscallEventInfo.returnCode apparently does not sign-extend the return result
of a 'close'"
What do you mean "close" here?  SYS_close?

I think I misunderstand "sign extend" for the first time on maillist, and I will
have a look about it.

On PPC64, the sign of the reture value is determined by one bit in
CCR,(Condation Code Register).
Comment 2 Tom Tromey 2006-08-31 18:43:51 UTC
Yes, I mean SYS_close.

The question is how to check whether a system call returned an error.
My current check looks like this:

	  && (int) syscallEventInfo.returnCode(task) < 0)

... where the explicit cast is needed to handle the lack of sign extension.
I think it would be friendlier to explicitly sign-extend.
Comment 3 Yao Qi 2006-09-08 11:43:32 UTC
Post my patch against this bug,
http://sources.redhat.com/ml/frysk/2006-q3/msg00400.html

but no one review this patch.

Tom, Could you have a look?  If it is OK, I will check in.  Thanks!