Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
To: gdb-patches@sourceware.cygnus.com
Subject: Re: gdb 5.0: solib.c (LM_ADDR) should be signed, not unsigned
Date: Mon, 24 Jul 2000 05:23:00 -0000	[thread overview]
Message-ID: <Pine.GSO.3.96.1000724141721.27187H-100000@delta.ds2.pg.gda.pl> (raw)
In-Reply-To: <Pine.GSO.3.96.1000619191851.10348S-100000@delta.ds2.pg.gda.pl>

Hi,

 It appeared not only LM_ADDR has problems with signedness.  Here is an
updated patch that fixes read_register() as well.

  Maciej

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

diff -u --recursive --new-file gdb-5.0.macro/gdb/defs.h gdb-5.0/gdb/defs.h
--- gdb-5.0.macro/gdb/defs.h	Mon May  1 05:45:32 2000
+++ gdb-5.0/gdb/defs.h	Sun Jul 23 23:15:39 2000
@@ -1067,6 +1067,8 @@
 
 extern CORE_ADDR extract_address (void *, int);
 
+extern CORE_ADDR extract_signed_address (void *, int);
+
 extern void store_signed_integer (void *, int, LONGEST);
 
 extern void store_unsigned_integer (void *, int, ULONGEST);
diff -u --recursive --new-file gdb-5.0.macro/gdb/findvar.c gdb-5.0/gdb/findvar.c
--- gdb-5.0.macro/gdb/findvar.c	Fri Mar 31 22:04:50 2000
+++ gdb-5.0/gdb/findvar.c	Sun Jul 23 23:17:27 2000
@@ -177,6 +177,14 @@
   return (CORE_ADDR) extract_unsigned_integer (addr, len);
 }
 
+CORE_ADDR
+extract_signed_address (void *addr, int len)
+{
+  /* Assume a CORE_ADDR can fit in a LONGEST (for now).  Not sure
+     whether we want this to be true eventually.  */
+  return (CORE_ADDR) extract_signed_integer (addr, len);
+}
+
 void
 store_signed_integer (void *addr, int len, LONGEST val)
 {
@@ -831,8 +839,8 @@
   if (!register_valid[regno])
     target_fetch_registers (regno);
 
-  return (CORE_ADDR) extract_address (&registers[REGISTER_BYTE (regno)],
-				      REGISTER_RAW_SIZE (regno));
+  return (CORE_ADDR) extract_signed_address (&registers[REGISTER_BYTE (regno)],
+					     REGISTER_RAW_SIZE (regno));
 }
 
 CORE_ADDR
diff -u --recursive --new-file gdb-5.0.macro/gdb/solib.c gdb-5.0/gdb/solib.c
--- gdb-5.0.macro/gdb/solib.c	Wed Apr  5 20:40:22 2000
+++ gdb-5.0/gdb/solib.c	Sun Jul 23 23:16:32 2000
@@ -117,10 +117,12 @@
 
 #define SOLIB_EXTRACT_ADDRESS(member) \
   extract_address (&member, sizeof (member))
+#define SOLIB_EXTRACT_SIGNED_ADDRESS(member) \
+  extract_signed_address (&member, sizeof (member))
 
 #ifndef SVR4_SHARED_LIBS
 
-#define LM_ADDR(so) (SOLIB_EXTRACT_ADDRESS ((so) -> lm.lm_addr))
+#define LM_ADDR(so) (SOLIB_EXTRACT_SIGNED_ADDRESS ((so) -> lm.lm_addr))
 #define LM_NEXT(so) (SOLIB_EXTRACT_ADDRESS ((so) -> lm.lm_next))
 #define LM_NAME(so) (SOLIB_EXTRACT_ADDRESS ((so) -> lm.lm_name))
 /* Test for first link map entry; first entry is a shared library. */
@@ -133,7 +135,7 @@
 
 #else /* SVR4_SHARED_LIBS */
 
-#define LM_ADDR(so) (SOLIB_EXTRACT_ADDRESS ((so) -> lm.l_addr))
+#define LM_ADDR(so) (SOLIB_EXTRACT_SIGNED_ADDRESS ((so) -> lm.l_addr))
 #define LM_NEXT(so) (SOLIB_EXTRACT_ADDRESS ((so) -> lm.l_next))
 #define LM_NAME(so) (SOLIB_EXTRACT_ADDRESS ((so) -> lm.l_name))
 /* Test for first link map entry; first entry is the exec-file. */


       reply	other threads:[~2000-07-24  5:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.GSO.3.96.1000619191851.10348S-100000@delta.ds2.pg.gda.pl>
2000-07-24  5:23 ` Maciej W. Rozycki [this message]
     [not found]   ` <397E6840.F0F99FA1@cygnus.com>
2000-07-26 15:49     ` Michael Snyder
2000-07-26 17:53       ` Andrew Cagney

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=Pine.GSO.3.96.1000724141721.27187H-100000@delta.ds2.pg.gda.pl \
    --to=macro@ds2.pg.gda.pl \
    --cc=gdb-patches@sourceware.cygnus.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