This is the mail archive of the gdb-patches@sources.redhat.com 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: RFA: Do solib address arithmetic with appropriate truncation


> There must be something around that this code can use.  On something 
>> like a mips, this would be wrong - remember the sign extension problem.
> 
> 
> I've never really understood the MIPS sign extension problem.  Does it
> occur when TARGET_PTR_BIT is smaller than the size of one or more of
> the registers used to hold addresses?


The MIPS ISA when running 32 bit code, sign extends pointers.  GDB 
mimics this behavour.  If it encounters a 32 bit pointer it will convert 
it to/from a cannonical form (sign extended CORE_ADDR for MIPS).   Such 
pointers occure everywhere - debug info, registers, memory, ... By 
always sign extending, GDB avoids any potential inconsistency and latent 
bugs.  POINTER_TO_ADDRESS and ADDRESS_TO_POINTER handle this.

When debugging MIPS, the first thing to check is that CORE_ADDRs are 
sign exteded.  A value like ``0x80001234'' as the patch would generate, 
indicate a bug.

Interestingly, the SPARC is showing signs of the same, or similar, problems.

enjoy,
Andrew


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