This is the mail archive of the
mailing list for the GDB project.
Re: [PING2] : [RFC/RFA] PING: skip __main
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: drow at false dot org
- Cc: muller at ics dot u-strasbg dot fr, pedro at codesourcery dot com, gdb-patches at sourceware dot org
- Date: Thu, 5 Jun 2008 22:41:49 +0200 (CEST)
- Subject: Re: [PING2] : [RFC/RFA] PING: skip __main
- References: <firstname.lastname@example.org> <email@example.com> <200805301157.m4UBvOL5009408@brahms.sibelius.xs4all.nl> <firstname.lastname@example.org> <email@example.com> <200805301457.m4UEvnGD028393@brahms.sibelius.xs4all.nl> <firstname.lastname@example.org> <20080605202640.GL25085@caradoc.them.org>
> Date: Thu, 5 Jun 2008 16:26:40 -0400
> From: Daniel Jacobowitz <email@example.com>
> 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.
The diff should use extract_signed_integer().
I'm not sure if the wrapping is actually necessary. Does the
assembler/linker actually depend on it? Or does it error out on such
large jumps? If so, alternatively you could explicity truncate the
generated address to 32 bits using & 0xffffffffU.