Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: drow@false.org
Cc: muller@ics.u-strasbg.fr, pedro@codesourcery.com,
	        gdb-patches@sourceware.org
Subject: Re: [PING2] : [RFC/RFA] PING: skip __main
Date: Thu, 05 Jun 2008 20:44:00 -0000	[thread overview]
Message-ID: <200806052041.m55Kfneh015684@brahms.sibelius.xs4all.nl> (raw)
In-Reply-To: <20080605202640.GL25085@caradoc.them.org> (message from Daniel 	Jacobowitz on Thu, 5 Jun 2008 16:26:40 -0400)

> Date: Thu, 5 Jun 2008 16:26:40 -0400
> From: Daniel Jacobowitz <drow@false.org>
> 
> 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.


  reply	other threads:[~2008-06-05 20:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-02 13:26 Pierre Muller
2008-05-04 19:57 ` Pedro Alves
2008-05-30 15:56 ` [PING2] : " Pierre Muller
2008-05-30 17:04   ` Mark Kettenis
2008-05-30 18:18     ` Pierre Muller
2008-05-30 18:45       ` Pierre Muller
2008-05-30 20:23         ` Mark Kettenis
2008-05-31  2:30           ` Pierre Muller
     [not found]           ` <000301c8c2ea$0c2d72a0$248857e0$@u-strasbg.fr>
2008-06-05 20:27             ` Daniel Jacobowitz
2008-06-05 20:44               ` Mark Kettenis [this message]
2008-06-06  7:18                 ` Pierre Muller
2008-06-07  7:48                   ` [RFA] New skip __main version Pierre Muller
2008-06-10 17:56                     ` Mark Kettenis
2008-06-11 23:18                       ` Pierre Muller
2008-05-31 16:06       ` [PING2] : [RFC/RFA] PING: skip __main Daniel Jacobowitz
2008-05-31 23:40       ` Mark Kettenis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200806052041.m55Kfneh015684@brahms.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=muller@ics.u-strasbg.fr \
    --cc=pedro@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox