This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap 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]

Re: Problem with 32-bit negative return values


Frank Ch. Eigler wrote:
Hi -

On Tue, Oct 10, 2006 at 10:34:07AM -0700, Mike Mason wrote:
[...]
I'm trying to use the return value from sock_recvmsg() to determine how many bytes are received. It ignores negative return values (errors).
[...]
But on x86_64, the negative values are interpreted and printed as large positive values:
RECV 1440
RECV 4294967285
[...]

It could easily be a typing/sign-extension bug in the loc2c-related code. Could you check the generated C code (-p3; look for the _dwarf_tvar_get function)?

Here's the suspect code generated with -p3:


     l->__tmp18 =
     ({

       if (unlikely (c->nesting+2 >= MAXNESTING)) {
         c->last_error = "MAXNESTING exceeded";
         c->last_stmt = "identifier '$return' at nettop3.stp:56:15";
       } else if (likely (! c->last_error)) {
         c->nesting ++;
         function__dwarf_tvar_get_return_8 (c);
         c->nesting --;
         if (c->last_error && ! c->last_error[0])
           c->last_error = 0;
       }
       c->locals[c->nesting+1].function__dwarf_tvar_get_return_8.__retvalue;
     });
     if (likely (! c->last_error)) {
       l->__tmp19 = 0;
       _stp_printf ("RECV %lld\n", l->__tmp18);
     }



- FChE


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