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


 I am not sure I understand your question about
assembler or linker, but
for sure if we call lookup_minimal_symbol_by_pc with
a CORE_ADDR outside the 0 to 0xffffffff range,
it might fail to find the right location
(although I must admit that I didn't try to look inside that
code to see if there is a bit truncation there)

  Anyhow, using extract_signed_integer followed by
a "& 0xffffffffU", we should be on the safe side.
  I will rerun a test a resubmit a modified patch after.



Pierre Muller
Pascal language support maintainer for GDB


  

-----Message d'origine-----
De?: Mark Kettenis [mailto:mark.kettenis@xs4all.nl] 
Envoyé?: Thursday, June 05, 2008 10:42 PM
À?: drow@false.org
Cc?: muller@ics.u-strasbg.fr; pedro@codesourcery.com;
gdb-patches@sourceware.org
Objet?: Re: [PING2] : [RFC/RFA] PING: skip __main

> 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.




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