This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [PING2] : [RFC/RFA] PING: skip __main


On Sat, May 31, 2008 at 08:46:25AM +0200, Pierre Muller wrote:
>   Should I use the 32bit typecast strategy:
> 
> unsigned int32 pc_after = pc + 5; 
> unsigned int32 depl = extract_unsigned_integer (buf, 4);
>    
> unsigned int32 dest = pc_after - depl;
> pc = dest;
> 
> I don't know the checks done in C,
> are there any overflow checks in code like this,
> or is it safe to assume that it will work,
> even on machine that perform their operations
> on more than 32 bits?

If you use uint32_t, then you are guaranteed wrapping at 32 bits.
So that is probably the best thing to do.  See the patch I just posted
to make stdint.h available everywhere.

-- 
Daniel Jacobowitz
CodeSourcery


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