Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: Kevin Buettner <kevinb@redhat.com>
Cc: Jim Blandy <jimb@cygnus.com>, gdb-patches@sources.redhat.com
Subject: Re: RFA: Do solib address arithmetic with appropriate truncation
Date: Mon, 04 Feb 2002 09:01:00 -0000	[thread overview]
Message-ID: <3C5EBE78.1020500@cygnus.com> (raw)
In-Reply-To: <1020204161424.ZM16473@localhost.localdomain>

> 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


  reply	other threads:[~2002-02-04 17:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-02 17:29 Jim Blandy
2002-02-03 10:24 ` Andrew Cagney
2002-02-04  8:15   ` Kevin Buettner
2002-02-04  9:01     ` Andrew Cagney [this message]
2002-02-05 16:07       ` Jim Blandy
2002-02-05 16:39         ` Andrew Cagney
2002-02-06 11:27           ` Jim Blandy
2002-02-06 11:41             ` Andrew Cagney
2002-02-06 14:12             ` Daniel Jacobowitz
2002-02-03 23:09 ` Kevin Buettner
2002-02-05 15:30   ` Jim Blandy

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=3C5EBE78.1020500@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jimb@cygnus.com \
    --cc=kevinb@redhat.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