* Re: gdb 5.0: solib.c (LM_ADDR) should be signed, not unsigned
[not found] <Pine.GSO.3.96.1000619191851.10348S-100000@delta.ds2.pg.gda.pl>
@ 2000-07-24 5:23 ` Maciej W. Rozycki
[not found] ` <397E6840.F0F99FA1@cygnus.com>
0 siblings, 1 reply; 3+ messages in thread
From: Maciej W. Rozycki @ 2000-07-24 5:23 UTC (permalink / raw)
To: gdb-patches
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 (®isters[REGISTER_BYTE (regno)],
- REGISTER_RAW_SIZE (regno));
+ return (CORE_ADDR) extract_signed_address (®isters[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. */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: gdb 5.0: solib.c (LM_ADDR) should be signed, not unsigned
[not found] ` <397E6840.F0F99FA1@cygnus.com>
@ 2000-07-26 15:49 ` Michael Snyder
2000-07-26 17:53 ` Andrew Cagney
0 siblings, 1 reply; 3+ messages in thread
From: Michael Snyder @ 2000-07-26 15:49 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Maciej W. Rozycki, gdb-patches
Andrew Cagney wrote:
>
> "Maciej W. Rozycki" wrote:
> >
> > Hi,
> >
> > It appeared not only LM_ADDR has problems with signedness. Here is an
> > updated patch that fixes read_register() as well.
> >
>
> > 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. */
>
> I don't think this is right. I think it would sign extend that address
> for all targets - wrong in 99% of cases.
By the way, I will shortly be submitting changes that
make all these macros into functions. Should I do it
sooner rather than later? Will that help at all?
> Can you provide more information on the problem you're seeing (+
> host/target etc).
>
> Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: gdb 5.0: solib.c (LM_ADDR) should be signed, not unsigned
2000-07-26 15:49 ` Michael Snyder
@ 2000-07-26 17:53 ` Andrew Cagney
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Cagney @ 2000-07-26 17:53 UTC (permalink / raw)
To: Michael Snyder; +Cc: Maciej W. Rozycki, gdb-patches
Michael Snyder wrote:
> > > -#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. */
> >
> > I don't think this is right. I think it would sign extend that address
> > for all targets - wrong in 99% of cases.
>
> By the way, I will shortly be submitting changes that
> make all these macros into functions. Should I do it
> sooner rather than later? Will that help at all?
Yes please.
It won't help Maciej's problem though. It looks to be a real bug - I
can't confirm or deny it (JimB?) as I don't have an ELF spec lying
around.
Andrew
From msnyder@redhat.com Wed Jul 26 18:04:00 2000
From: Michael Snyder <msnyder@redhat.com>
To: Jimmy Guo <guo@cup.hp.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: please remove control chars
Date: Wed, 26 Jul 2000 18:04:00 -0000
Message-id: <397F8846.66C4@redhat.com>
References: <Pine.LNX.4.10.10007261626510.8613-100000@hpcll168.cup.hp.com>
X-SW-Source: 2000-07/msg00315.html
Content-length: 6274
Done. Thanks.
Jimmy Guo wrote:
>
> Remove the '^@' control character from these three files. These files
> are under ClearCase source control at HP, as text_file type, which
> cannot accept funny control chars in updates. I don't think you can use
> 'patch' to apply this though, for the similar reason caused by the
> presence of these control chars. Nevertheless, the patch file is
> provided here to show the point. Thanks.
>
> Wed Jul 26 16:37:40 2000 Jimmy Guo <guo@cup.hp.com>
> * config/convex/tm-convex.h: Remove control characters.
> * config/m68k/tm-altos.h: Ditto.
> * config/tahoe/tm-tahoe.h: Ditto.
>
> *** config/convex/tm-convex.h Tue Jul 25 10:54:53 2000
> --- config/convex/tm-convex.h@@/main/cygnus/LATEST Wed Jun 14 12:42:12 2000
> ***************
> *** 52,58 ****
> /* OBSOLETE [ld.- -(ap),-] pcc/gcc register arg loads */
> /* OBSOLETE *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern CORE_ADDR convex_skip_prologue (CORE_ADDR pc);
> /* OBSOLETE #define SKIP_PROLOGUE(pc) (convex_skip_prologue (pc)) */
> /* OBSOLETE */
> /* OBSOLETE /* Immediately after a function call, return the saved pc. */
> --- 52,58 ----
> /* OBSOLETE [ld.- -(ap),-] pcc/gcc register arg loads */
> /* OBSOLETE *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern CORE_ADDR convex_skip_prologue (CORE_ADDR pc); */
> /* OBSOLETE #define SKIP_PROLOGUE(pc) (convex_skip_prologue (pc)) */
> /* OBSOLETE */
> /* OBSOLETE /* Immediately after a function call, return the saved pc. */
> ***************
> *** 265,271 ****
> /* OBSOLETE On convex, check at the return address for `callq' -- if so, frameless, */
> /* OBSOLETE otherwise, not. *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern int convex_frameless_function_invocation (struct frame_info *fi);
> /* OBSOLETE #define FRAMELESS_FUNCTION_INVOCATION(FI) (convex_frameless_function_invocatio (FI)) */
> /* OBSOLETE */
> /* OBSOLETE #define FRAME_SAVED_PC(fi) (read_memory_integer ((fi)->frame, 4)) */
> --- 265,271 ----
> /* OBSOLETE On convex, check at the return address for `callq' -- if so, frameless, */
> /* OBSOLETE otherwise, not. *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern int convex_frameless_function_invocation (struct frame_info *fi); */
> /* OBSOLETE #define FRAMELESS_FUNCTION_INVOCATION(FI) (convex_frameless_function_invocatio (FI)) */
> /* OBSOLETE */
> /* OBSOLETE #define FRAME_SAVED_PC(fi) (read_memory_integer ((fi)->frame, 4)) */
> ***************
> *** 277,283 ****
> /* OBSOLETE /* Return number of args passed to a frame. */
> /* OBSOLETE Can return -1, meaning no way to tell. *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern int convex_frame_num_args (struct frame_info *fi);
> /* OBSOLETE #define FRAME_NUM_ARGS(fi) (convex_frame_num_args ((fi))) */
> /* OBSOLETE */
> /* OBSOLETE /* Return number of bytes at start of arglist that are not really args. *x/ */
> --- 277,283 ----
> /* OBSOLETE /* Return number of args passed to a frame. */
> /* OBSOLETE Can return -1, meaning no way to tell. *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern int convex_frame_num_args (struct frame_info *fi); */
> /* OBSOLETE #define FRAME_NUM_ARGS(fi) (convex_frame_num_args ((fi))) */
> /* OBSOLETE */
> /* OBSOLETE /* Return number of bytes at start of arglist that are not really args. *x/ */
> *** config/m68k/tm-altos.h Tue Jul 25 10:54:57 2000
> --- config/m68k/tm-altos.h@@/main/cygnus/LATEST Wed Jun 14 12:45:07 2000
> ***************
> *** 38,44 ****
> /* OBSOLETE /* The only reason this is here is the tm-altos.h reference below. It */
> /* OBSOLETE was moved back here from tm-m68k.h. FIXME? *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern CORE_ADDR altos_skip_prologue (CORE_ADDR);
> /* OBSOLETE #define SKIP_PROLOGUE(pc) (altos_skip_prologue (pc)) */
> /* OBSOLETE */
> /* OBSOLETE #include "m68k/tm-m68k.h" */
> --- 38,44 ----
> /* OBSOLETE /* The only reason this is here is the tm-altos.h reference below. It */
> /* OBSOLETE was moved back here from tm-m68k.h. FIXME? *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern CORE_ADDR altos_skip_prologue (CORE_ADDR); */
> /* OBSOLETE #define SKIP_PROLOGUE(pc) (altos_skip_prologue (pc)) */
> /* OBSOLETE */
> /* OBSOLETE #include "m68k/tm-m68k.h" */
> *** config/tahoe/tm-tahoe.h Tue Jul 25 10:55:05 2000
> --- config/tahoe/tm-tahoe.h@@/main/cygnus/LATEST Wed Jun 14 12:48:01 2000
> ***************
> *** 34,40 ****
> /* OBSOLETE /* Advance PC across any function entry prologue instructions */
> /* OBSOLETE to reach some "real" code. *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern CORE_ADDR tahoe_skip_prologue (CORE_ADDR);
> /* OBSOLETE #define SKIP_PROLOGUE(pc) (tahoe_skip_prologue (pc)) */
> /* OBSOLETE */
> /* OBSOLETE /* Immediately after a function call, return the saved pc. */
> --- 34,40 ----
> /* OBSOLETE /* Advance PC across any function entry prologue instructions */
> /* OBSOLETE to reach some "real" code. *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern CORE_ADDR tahoe_skip_prologue (CORE_ADDR); */
> /* OBSOLETE #define SKIP_PROLOGUE(pc) (tahoe_skip_prologue (pc)) */
> /* OBSOLETE */
> /* OBSOLETE /* Immediately after a function call, return the saved pc. */
> ***************
> *** 190,196 ****
> /* OBSOLETE /* Return number of args passed to a frame. */
> /* OBSOLETE Can return -1, meaning no way to tell. *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern int tahoe_frame_num_args (struct frame_info * fi);
> /* OBSOLETE #define FRAME_NUM_ARGS(fi) (tahoe_frame_num_args ((fi))) */
> /* OBSOLETE */
> /* OBSOLETE /* Return number of bytes at start of arglist that are not really args. *x/ */
> --- 190,196 ----
> /* OBSOLETE /* Return number of args passed to a frame. */
> /* OBSOLETE Can return -1, meaning no way to tell. *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern int tahoe_frame_num_args (struct frame_info * fi); */
> /* OBSOLETE #define FRAME_NUM_ARGS(fi) (tahoe_frame_num_args ((fi))) */
> /* OBSOLETE */
> /* OBSOLETE /* Return number of bytes at start of arglist that are not really args. *x/ */
From ac131313@cygnus.com Wed Jul 26 18:04:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Jimmy Guo <guo@cup.hp.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: please remove control chars
Date: Wed, 26 Jul 2000 18:04:00 -0000
Message-id: <397F89DE.C9415ECE@cygnus.com>
References: <Pine.LNX.4.10.10007261626510.8613-100000@hpcll168.cup.hp.com>
X-SW-Source: 2000-07/msg00317.html
Content-length: 6433
Jimmy Guo wrote:
>
> Remove the '^@' control character from these three files. These files
> are under ClearCase source control at HP, as text_file type, which
> cannot accept funny control chars in updates. I don't think you can use
> 'patch' to apply this though, for the similar reason caused by the
> presence of these control chars. Nevertheless, the patch file is
> provided here to show the point. Thanks.
Jimmy,
If you haven't already, please feel free to commit (thanks!). Anyone is
free to do what they like (ok within reason :-) to the ``obsolete''
code :-)
enjoy,
Andrew
> Wed Jul 26 16:37:40 2000 Jimmy Guo <guo@cup.hp.com>
> * config/convex/tm-convex.h: Remove control characters.
> * config/m68k/tm-altos.h: Ditto.
> * config/tahoe/tm-tahoe.h: Ditto.
>
> *** config/convex/tm-convex.h Tue Jul 25 10:54:53 2000
> --- config/convex/tm-convex.h@@/main/cygnus/LATEST Wed Jun 14 12:42:12 2000
> ***************
> *** 52,58 ****
> /* OBSOLETE [ld.- -(ap),-] pcc/gcc register arg loads */
> /* OBSOLETE *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern CORE_ADDR convex_skip_prologue (CORE_ADDR pc);
> /* OBSOLETE #define SKIP_PROLOGUE(pc) (convex_skip_prologue (pc)) */
> /* OBSOLETE */
> /* OBSOLETE /* Immediately after a function call, return the saved pc. */
> --- 52,58 ----
> /* OBSOLETE [ld.- -(ap),-] pcc/gcc register arg loads */
> /* OBSOLETE *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern CORE_ADDR convex_skip_prologue (CORE_ADDR pc); */
> /* OBSOLETE #define SKIP_PROLOGUE(pc) (convex_skip_prologue (pc)) */
> /* OBSOLETE */
> /* OBSOLETE /* Immediately after a function call, return the saved pc. */
> ***************
> *** 265,271 ****
> /* OBSOLETE On convex, check at the return address for `callq' -- if so, frameless, */
> /* OBSOLETE otherwise, not. *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern int convex_frameless_function_invocation (struct frame_info *fi);
> /* OBSOLETE #define FRAMELESS_FUNCTION_INVOCATION(FI) (convex_frameless_function_invocatio (FI)) */
> /* OBSOLETE */
> /* OBSOLETE #define FRAME_SAVED_PC(fi) (read_memory_integer ((fi)->frame, 4)) */
> --- 265,271 ----
> /* OBSOLETE On convex, check at the return address for `callq' -- if so, frameless, */
> /* OBSOLETE otherwise, not. *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern int convex_frameless_function_invocation (struct frame_info *fi); */
> /* OBSOLETE #define FRAMELESS_FUNCTION_INVOCATION(FI) (convex_frameless_function_invocatio (FI)) */
> /* OBSOLETE */
> /* OBSOLETE #define FRAME_SAVED_PC(fi) (read_memory_integer ((fi)->frame, 4)) */
> ***************
> *** 277,283 ****
> /* OBSOLETE /* Return number of args passed to a frame. */
> /* OBSOLETE Can return -1, meaning no way to tell. *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern int convex_frame_num_args (struct frame_info *fi);
> /* OBSOLETE #define FRAME_NUM_ARGS(fi) (convex_frame_num_args ((fi))) */
> /* OBSOLETE */
> /* OBSOLETE /* Return number of bytes at start of arglist that are not really args. *x/ */
> --- 277,283 ----
> /* OBSOLETE /* Return number of args passed to a frame. */
> /* OBSOLETE Can return -1, meaning no way to tell. *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern int convex_frame_num_args (struct frame_info *fi); */
> /* OBSOLETE #define FRAME_NUM_ARGS(fi) (convex_frame_num_args ((fi))) */
> /* OBSOLETE */
> /* OBSOLETE /* Return number of bytes at start of arglist that are not really args. *x/ */
> *** config/m68k/tm-altos.h Tue Jul 25 10:54:57 2000
> --- config/m68k/tm-altos.h@@/main/cygnus/LATEST Wed Jun 14 12:45:07 2000
> ***************
> *** 38,44 ****
> /* OBSOLETE /* The only reason this is here is the tm-altos.h reference below. It */
> /* OBSOLETE was moved back here from tm-m68k.h. FIXME? *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern CORE_ADDR altos_skip_prologue (CORE_ADDR);
> /* OBSOLETE #define SKIP_PROLOGUE(pc) (altos_skip_prologue (pc)) */
> /* OBSOLETE */
> /* OBSOLETE #include "m68k/tm-m68k.h" */
> --- 38,44 ----
> /* OBSOLETE /* The only reason this is here is the tm-altos.h reference below. It */
> /* OBSOLETE was moved back here from tm-m68k.h. FIXME? *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern CORE_ADDR altos_skip_prologue (CORE_ADDR); */
> /* OBSOLETE #define SKIP_PROLOGUE(pc) (altos_skip_prologue (pc)) */
> /* OBSOLETE */
> /* OBSOLETE #include "m68k/tm-m68k.h" */
> *** config/tahoe/tm-tahoe.h Tue Jul 25 10:55:05 2000
> --- config/tahoe/tm-tahoe.h@@/main/cygnus/LATEST Wed Jun 14 12:48:01 2000
> ***************
> *** 34,40 ****
> /* OBSOLETE /* Advance PC across any function entry prologue instructions */
> /* OBSOLETE to reach some "real" code. *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern CORE_ADDR tahoe_skip_prologue (CORE_ADDR);
> /* OBSOLETE #define SKIP_PROLOGUE(pc) (tahoe_skip_prologue (pc)) */
> /* OBSOLETE */
> /* OBSOLETE /* Immediately after a function call, return the saved pc. */
> --- 34,40 ----
> /* OBSOLETE /* Advance PC across any function entry prologue instructions */
> /* OBSOLETE to reach some "real" code. *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern CORE_ADDR tahoe_skip_prologue (CORE_ADDR); */
> /* OBSOLETE #define SKIP_PROLOGUE(pc) (tahoe_skip_prologue (pc)) */
> /* OBSOLETE */
> /* OBSOLETE /* Immediately after a function call, return the saved pc. */
> ***************
> *** 190,196 ****
> /* OBSOLETE /* Return number of args passed to a frame. */
> /* OBSOLETE Can return -1, meaning no way to tell. *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern int tahoe_frame_num_args (struct frame_info * fi);
> /* OBSOLETE #define FRAME_NUM_ARGS(fi) (tahoe_frame_num_args ((fi))) */
> /* OBSOLETE */
> /* OBSOLETE /* Return number of bytes at start of arglist that are not really args. *x/ */
> --- 190,196 ----
> /* OBSOLETE /* Return number of args passed to a frame. */
> /* OBSOLETE Can return -1, meaning no way to tell. *x/ */
> /* OBSOLETE */
> ! /* OBSOLETE extern int tahoe_frame_num_args (struct frame_info * fi); */
> /* OBSOLETE #define FRAME_NUM_ARGS(fi) (tahoe_frame_num_args ((fi))) */
> /* OBSOLETE */
> /* OBSOLETE /* Return number of bytes at start of arglist that are not really args. *x/ */
From msnyder@redhat.com Wed Jul 26 18:04:00 2000
From: Michael Snyder <msnyder@redhat.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>, gdb-patches@sourceware.cygnus.com
Subject: Re: gdb 5.0: solib.c (LM_ADDR) should be signed, not unsigned
Date: Wed, 26 Jul 2000 18:04:00 -0000
Message-id: <397F8AB2.2EA@redhat.com>
References: <Pine.GSO.3.96.1000724141721.27187H-100000@delta.ds2.pg.gda.pl> <397E6840.F0F99FA1@cygnus.com> <397F3BD1.7E7F@redhat.com> <397F8797.BA883F79@cygnus.com>
X-SW-Source: 2000-07/msg00316.html
Content-length: 954
Andrew Cagney wrote:
>
> Michael Snyder wrote:
>
> > > > -#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. */
> > >
> > > I don't think this is right. I think it would sign extend that address
> > > for all targets - wrong in 99% of cases.
> >
> > By the way, I will shortly be submitting changes that
> > make all these macros into functions. Should I do it
> > sooner rather than later? Will that help at all?
>
> Yes please.
> It won't help Maciej's problem though. It looks to be a real bug - I
> can't confirm or deny it (JimB?) as I don't have an ELF spec lying
> around.
Well, at least it might make it easier to debug! ;-)
From kettenis@wins.uva.nl Thu Jul 27 00:10:00 2000
From: Mark Kettenis <kettenis@wins.uva.nl>
To: gdb-patches@sources.redhat.com
Cc: jimb@cygnus.com
Subject: [PING][RFA] Fall back on dynamic symtab in solib.c:bdf_lookup_symbol
Date: Thu, 27 Jul 2000 00:10:00 -0000
Message-id: <200007270710.e6R7AjS00711@delius.kettenis.local>
X-SW-Source: 2000-07/msg00318.html
Content-length: 127
I'm still looking for approval of the following patch:
http://sources.redhat.com/ml/gdb-patches/2000-05/msg00318.html
Mark
From ac131313@cygnus.com Thu Jul 27 00:37:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Stephane Carrez <Stephane.Carrez@worldnet.fr>
Cc: Stephane Carrez <Stephane.Carrez@free.fr>, gdb-patches@sourceware.cygnus.com
Subject: Re: [Patch 1/7]: 68HC11 port of gdb (gdb)
Date: Thu, 27 Jul 2000 00:37:00 -0000
Message-id: <397FE67E.EE089A8A@cygnus.com>
References: <3956899B.C774D787@free.fr> <39632042.9D4F7029@cygnus.com> <39718E95.A3C6045@worldnet.fr>
X-SW-Source: 2000-07/msg00319.html
Content-length: 25563
Stephane Carrez wrote:
> > What I can do as an interim step is pick the eyes out of these patches
> > for you and then check most of it in. You'll then need to go back
> > through and convert much of the remaining tm-m68hc11.h macros into
> > functions and the like.
> >
> > Sorry for this (but much thanks for the work so far),
> >
> > Andrew
>
> Ok, I guess this is not a big problem.
FYI,
I've checked in the attatched. I'd wait a bit more though, this turns
up a configury bug that needs fixing. You'll need to rework
m68hc11-tdep.c
Andrew
Thu Jul 27 14:06:27 2000 Andrew Cagney <cagney@b1.cygnus.com>
From 2000-06-25 Stephane Carrez <Stephane.Carrez@worldnet.fr>:
* configure.tgt: Recognize the 68hc11.
* m68hc11-tdep.c: New file for 68hc11 target.
* config/m68hc11/m68hc11.mt: New file for 68hc11 port.
* configure.tgt: When 68hc11, set gdb_multi_arch.
Index: configure.tgt
===================================================================
RCS file: /cvs/src/src/gdb/configure.tgt,v
retrieving revision 1.12
diff -p -r1.12 configure.tgt
*** configure.tgt 2000/06/13 15:21:27 1.12
--- configure.tgt 2000/07/27 07:12:44
*************** arm*) gdb_target_cpu=arm ;;
*** 17,22 ****
--- 17,23 ----
# OBSOLETE c[12]) gdb_target_cpu=convex ;;
hppa*) gdb_target_cpu=pa ;;
i[3456]86*) gdb_target_cpu=i386 ;;
+ m68hc11*|m6811*) gdb_target_cpu=m68hc11 ;;
m68*) gdb_target_cpu=m68k ;;
m88*) gdb_target_cpu=m88k ;;
mips*) gdb_target_cpu=mips ;;
*************** ia64-*-linux*) gdb_target=linux ;;
*** 133,138 ****
--- 134,141 ----
m32r-*-elf*) gdb_target=m32r ;;
+ m68hc11*-*-*|m6811*-*-*) gdb_target=m68hc11 ;;
+
m68000-*-sunos3*) gdb_target=sun2os3 ;;
m68000-*-sunos4*) gdb_target=sun2os4 ;;
*************** z8k-*-coff*) gdb_target=z8k ;;
*** 299,301 ****
--- 302,310 ----
esac
+
+ # map GDB target onto multi-arch support
+
+ case "${gdb_target}" in
+ m68hc11) gdb_multi_arch=yes ;;
+ esac
Index: m68hc11-tdep.c
===================================================================
RCS file: m68hc11-tdep.c
diff -N m68hc11-tdep.c
*** /dev/null Tue May 5 13:32:27 1998
--- m68hc11-tdep.c Thu Jul 27 00:12:46 2000
***************
*** 0 ****
--- 1,754 ----
+ /* Target-dependent code for Motorola 68HC11
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Contributed by Stephane Carrez, stcarrez@worldnet.fr
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+ #if 0
+ /* FIXME: This is from tm-m68hc1.h */
+
+ #define GDB_TARGET_IS_M6811
+
+ /* Define the bit, byte, and word ordering of the machine. */
+
+ #define TARGET_BYTE_ORDER BIG_ENDIAN
+
+ /* Offset from address of function to start of its code.
+ Zero on most machines. */
+
+ #define FUNCTION_START_OFFSET 0
+
+ #ifdef __STDC__ /* Forward decls for prototypes */
+ struct frame_info;
+ struct frame_saved_regs;
+ struct type;
+ struct value;
+ #endif
+
+ /* Advance PC across any function entry prologue instructions
+ to reach some "real" code. */
+
+ extern CORE_ADDR m68hc11_skip_prologue ();
+ #define SKIP_PROLOGUE(ip) \
+ m68hc11_skip_prologue (ip)
+
+
+ /* Stack grows downward. */
+
+ #define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
+
+ /* For a breakpoint, use "test". This is also the breakpoint
+ instruction on the 68HC12. */
+ #define BREAKPOINT {0x0}
+
+ /* If your kernel resets the pc after the trap happens you may need to
+ define this before including this file. */
+ #define DECR_PC_AFTER_BREAK 0
+
+ extern char *m68hc11_register_names[];
+ #define REGISTER_NAME(i) m68hc11_register_names[i]
+
+ #define REGISTER_SIZE 2
+
+ /* Register numbers of various important registers.
+ Note that some of these values are "real" register numbers,
+ and correspond to the general registers of the machine,
+ and some are "phony" register numbers which are too large
+ to be actual register numbers as far as the user is concerned
+ but do serve to get the desired values when passed to read_register. */
+
+ #define X_REGNUM 0
+ #define D_REGNUM 1
+ #define Y_REGNUM 2
+ #define SP_REGNUM 3
+ #define PC_REGNUM 4
+ #define A_REGNUM 5
+ #define B_REGNUM 6
+ #define PSW_REGNUM 7
+ #define Z_REGNUM 8
+ #define FP_REGNUM 9
+ #define TMP_REGNUM 10
+ #define ZS_REGNUM 11
+ #define XY_REGNUM 12
+ #define ZD1_REGNUM 13
+ #define ZD32_REGNUM (ZD1_REGNUM+31)
+
+ #define NUM_REGS (ZD32_REGNUM+1)
+
+ #include "opcode/m68hc11.h"
+
+ /* Say how much memory is needed to store a copy of the register set */
+ #define REGISTER_BYTES ((NUM_REGS)*2)
+
+ /* Index within `registers' of the first byte of the space for
+ register N. */
+
+ #define REGISTER_BYTE(N) ((N) * 2)
+
+ /* Number of bytes of storage in the actual machine representation
+ for register N. */
+
+ #define REGISTER_RAW_SIZE(N) (2)
+
+ /* Number of bytes of storage in the program's representation
+ for register N. */
+
+ #define REGISTER_VIRTUAL_SIZE(N) (2)
+
+ /* Largest value REGISTER_RAW_SIZE can have. */
+
+ #define MAX_REGISTER_RAW_SIZE 8
+
+ /* Largest value REGISTER_VIRTUAL_SIZE can have. */
+
+ #define MAX_REGISTER_VIRTUAL_SIZE 8
+
+ /* Return the GDB type object for the "standard" data type
+ of data in register N. */
+
+ #define REGISTER_VIRTUAL_TYPE(N) builtin_type_uint16
+
+ /* Store the address of the place in which to copy the structure the
+ subroutine will return. This is called from call_function.
+
+ We store structs through a pointer passed in D */
+
+ #define STORE_STRUCT_RETURN(ADDR, SP) \
+ { write_register (D_REGNUM, (ADDR)); }
+
+
+ /* Write into appropriate registers a function return value
+ of type TYPE, given in virtual format.
+
+ Things always get returned in D/X */
+
+ #define STORE_RETURN_VALUE(TYPE,VALBUF) \
+ write_register_bytes (REGISTER_BYTE (D_REGNUM), VALBUF, TYPE_LENGTH (TYPE))
+
+
+ /* Extract from an array REGBUF containing the (raw) register state
+ the address in which a function should return its structure value,
+ as a CORE_ADDR (or an expression that can be used as one). */
+
+ #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF))
+ \f
+
+ /* Define other aspects of the stack frame.
+ we keep a copy of the worked out return pc lying around, since it
+ is a useful bit of info */
+
+ #define EXTRA_FRAME_INFO \
+ int frame_reg; \
+ CORE_ADDR return_pc; \
+ CORE_ADDR dummy; \
+ int frameless; \
+ int size;
+
+ /* There's a mess in stack frame creation. See comments in blockframe.c
+ near reference to INIT_FRAME_PC_FIRST. */
+
+ #define INIT_FRAME_PC(fromleaf, prev) /* nada */
+
+ #define INIT_FRAME_PC_FIRST(fromleaf, prev) \
+ (prev)->pc = ((fromleaf) ? SAVED_PC_AFTER_CALL ((prev)->next) : \
+ (prev)->next ? FRAME_SAVED_PC ((prev)->next) : read_pc ());
+
+ #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \
+ m68hc11_init_extra_frame_info (fromleaf, fi)
+
+ extern void m68hc11_init_extra_frame_info (int fromleaf,
+ struct frame_info * fi);
+
+ /* A macro that tells us whether the function invocation represented
+ by FI does not have a frame on the stack associated with it. If it
+ does not, FRAMELESS is set to 1, else 0. */
+
+ #define FRAMELESS_FUNCTION_INVOCATION(FI) \
+ frameless_look_for_prologue (FI)
+
+ #define FRAME_CHAIN(FRAME) m68hc11_frame_chain (FRAME)
+ #define FRAME_CHAIN_VALID(chain,frame) \
+ ((chain) != 0 && (frame) != 0)
+ #define FRAME_SAVED_PC(FRAME) ((FRAME)->return_pc)
+ #define FRAME_ARGS_ADDRESS(fi) (fi)->frame
+ #define FRAME_LOCALS_ADDRESS(fi) (fi)->frame
+
+ #define SAVED_PC_AFTER_CALL(frame) m68hc11_saved_pc_after_call (frame)
+
+ /* Set VAL to the number of args passed to frame described by FI.
+ Can set VAL to -1, meaning no way to tell. */
+ /* We can't tell how many args there are */
+
+ #define FRAME_NUM_ARGS(fi) (-1)
+
+ /* Return number of bytes at start of arglist that are not really args. */
+
+ #define FRAME_ARGS_SKIP 0
+
+
+ /* Put here the code to store, into a struct frame_saved_regs,
+ the addresses of the saved registers of frame described by FRAME_INFO.
+ This includes special registers such as pc and fp saved in special
+ ways in the stack frame. sp is even more special:
+ the address we return for it IS the sp for the next frame. */
+
+ #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
+ m68hc11_frame_find_saved_regs (frame_info, &(frame_saved_regs))
+
+ extern void m68hc11_frame_find_saved_regs (struct frame_info *,
+ struct frame_saved_regs *);
+
+ #define CALL_DUMMY { 0 }
+ #define PUSH_DUMMY_FRAME
+ #define CALL_DUMMY_START_OFFSET 0
+ #define CALL_DUMMY_BREAKPOINT_OFFSET (0)
+
+ extern CORE_ADDR m68hc11_call_dummy_address (void);
+ #define CALL_DUMMY_ADDRESS() m68hc11_call_dummy_address ()
+
+ #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
+ sp = m68hc11_fix_call_dummy (dummyname, pc, fun, nargs, args, type, gcc_p)
+
+ extern CORE_ADDR m68hc11_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR,
+ int, struct value **,
+ struct type *, int);
+ #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \
+ sp = m68hc11_push_arguments ((nargs), (args), (sp), \
+ (struct_return), (struct_addr))
+ extern CORE_ADDR m68hc11_push_arguments (int, struct value **,
+ CORE_ADDR, int, CORE_ADDR);
+
+
+ /* Extract from an array REGBUF containing the (raw) register state
+ a function return value of type TYPE, and copy that, in virtual format,
+ into VALBUF. */
+
+ #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+ m68hc11_extract_return_value(TYPE, REGBUF, VALBUF)
+ extern void m68hc11_extract_return_value (struct type *, char *, char *);
+
+
+ /* Discard from the stack the innermost frame,
+ restoring all saved registers. */
+ #define POP_FRAME m68hc11_pop_frame();
+ extern void m68hc11_pop_frame (void);
+
+
+ /* Number of bits in the appropriate type. */
+
+ #define TARGET_INT_BIT (2 * TARGET_CHAR_BIT)
+ #define TARGET_PTR_BIT (2 * TARGET_CHAR_BIT)
+ #define TARGET_DOUBLE_BIT (4 * TARGET_CHAR_BIT)
+ #define TARGET_LONG_DOUBLE_BIT (8 * TARGET_CHAR_BIT)
+
+ #endif
+
+ #include "defs.h"
+ #include "frame.h"
+ #include "obstack.h"
+ #include "symtab.h"
+ #include "gdbtypes.h"
+ #include "gdbcmd.h"
+ #include "gdbcore.h"
+ #include "gdb_string.h"
+ #include "value.h"
+ #include "inferior.h"
+ #include "dis-asm.h"
+ #include "symfile.h"
+ #include "objfiles.h"
+
+ /* NOTE: This port is not finished. Several operations are not implemented
+ and will raise an error. Most of these functions concern the calling
+ of a function by GDB itself (command 'call') and retrieving data pushed
+ on the stack. */
+
+ void m68hc11_frame_find_saved_regs (struct frame_info *fi,
+ struct frame_saved_regs *fsr);
+ static void m68hc11_pop_dummy_frame (struct frame_info *fi);
+
+ /* Table of registers for 68HC11. This includes the hard registers
+ and the pseudo hard registers used by GCC. */
+ char*
+ m68hc11_register_names[] =
+ {
+ "x", "d", "y", "sp", "pc", "a", "b",
+ "ccr", "z", "frame","tmp", "zs", "xy",
+ "ZD1", "ZD2", "ZD3", "ZD4", "ZD5", "ZD6", "ZD7",
+ "ZD8", "ZD9", "ZD10", "ZD11", "ZD12", "ZD13", "ZD14",
+ "ZD15", "ZD16", "ZD17", "ZD18", "ZD19", "ZD20", "ZD21",
+ "ZD22", "ZD23", "ZD24", "ZD25", "ZD26", "ZD27", "ZD28",
+ "ZD29", "ZD30", "ZD31", "ZD32"
+ };
+
+ static int reg_last = 32 * 2 + 6;
+ static int frame_index = 6;
+
+ /* Raise an error for operations which are not yet provided. */
+ static void
+ m68hc11_not_yet (const char *operation)
+ {
+ error ("Operation '%s' is not yet implemented\n", operation);
+ }
+
+ /* Immediately after a function call, return the saved pc before the frame
+ is setup. For sun3's, we check for the common case of being inside of a
+ system call, and if so, we know that Sun pushes the call # on the stack
+ prior to doing the trap. */
+
+ CORE_ADDR
+ m68hc11_saved_pc_after_call (struct frame_info *frame)
+ {
+ unsigned addr = frame->frame + 1 + 2;
+
+ addr = read_register (SP_REGNUM) + 1;
+ addr &= 0x0ffff;
+ return read_memory_integer (addr, 2) & 0x0FFFF;
+ }
+
+ /* Discard from the stack the innermost frame, restoring all saved
+ registers. */
+
+ void
+ m68hc11_pop_frame ()
+ {
+ m68hc11_not_yet ("m68hc11_pop_frame");
+ }
+
+ /* Analyze the function prologue to find some information
+ about the function:
+ - the PC of the first line (for m68hc11_skip_prologue)
+ - the offset of the previous frame saved address (from current frame)
+ - the soft registers which are pushed. */
+ static void
+ m68hc11_guess_from_prologue (CORE_ADDR pc, CORE_ADDR* first_line,
+ int* frame_offset, int* pushed_regs)
+ {
+ CORE_ADDR func_end;
+ unsigned char op0, op1, op2;
+ int add_sp_mode;
+ int sp_adjust;
+ int size;
+ int found_frame_point;
+ int found_load;
+ CORE_ADDR first_pc;
+ int reg_saved;
+
+ first_pc = get_pc_function_start (pc);
+ size = 0;
+
+ if (first_pc == 0)
+ {
+ *frame_offset = 0;
+ *pushed_regs = 0;
+ *first_line = pc;
+ return;
+ }
+
+ #define OP_PAGE2 (0x18)
+ #define OP_LDX (0xde)
+ #define OP_LDY (0xde)
+ #define OP_PSHX (0x3c)
+ #define OP_PSHY (0x3c)
+ #define OP_STS (0x9f)
+ #define OP_TSX (0x30)
+ #define OP_TSY (0x30)
+ #define OP_XGDX (0x8f)
+ #define OP_XGDY (0x8f)
+ #define OP_ADDD (0xc3)
+ #define OP_TXS (0x35)
+ #define OP_TYS (0x35)
+
+ /* The 68hc11 stack is as follows:
+
+
+ | |
+ +-----------+
+ | |
+ | args |
+ | |
+ +-----------+
+ | PC-return |
+ +-----------+
+ | Old frame |
+ +-----------+
+ | |
+ | Locals |
+ | |
+ +-----------+ <--- current frame
+ | |
+
+ With most processors (like 68K) the previous frame can be computed
+ easily because it is always at a fixed offset (see link/unlink).
+ That is, locals are accessed with negative offsets, arguments are
+ accessed with positive ones. Since 68hc11 only supports offsets
+ in the range [0..255], the frame is defined at the bottom of
+ locals (see picture).
+
+ The purpose of the analysis made here is to find out the size
+ of locals in this function. An alternative to this is to use
+ DWARF2 info. This would be better but I don't know how to
+ access dwarf2 debug from this function.
+
+ Walk from the function entry point to the point where we save
+ the frame. While walking instructions, compute the size of bytes
+ which are pushed. This gives us the index to access the previous
+ frame.
+
+ We limit the search to 128 bytes so that the algorithm is bounded
+ in case of random and wrong code. We also stop and abort if
+ we find an instruction which is not supposed to appear in the
+ prologue (as generated by gcc 2.95, 2.96).
+ */
+ pc = first_pc;
+ func_end = pc + 128;
+ add_sp_mode = 0;
+ found_frame_point = 0;
+ while (pc + 2 < func_end)
+ {
+ op0 = read_memory_unsigned_integer (pc, 1);
+ op1 = read_memory_unsigned_integer (pc + 1, 1);
+ op2 = read_memory_unsigned_integer (pc + 2, 1);
+
+ /* ldx *frame */
+ if (op0 == OP_LDX && op1 == frame_index)
+ {
+ pc += 2;
+ }
+
+ /* ldy *frame */
+ else if (op0 == OP_PAGE2 && op1 == OP_LDY && op2 == frame_index)
+ {
+ pc += 3;
+ }
+
+ /* pshx */
+ else if (op0 == OP_PSHX)
+ {
+ pc += 1;
+ size += 2;
+ }
+
+ /* pshy */
+ else if (op0 == OP_PAGE2 && op1 == OP_PSHX)
+ {
+ pc += 2;
+ size += 2;
+ }
+
+ /* sts *frame */
+ else if (op0 == OP_STS && op1 == frame_index)
+ {
+ found_frame_point = 1;
+ pc += 2;
+ break;
+ }
+ else if (op0 == OP_TSX && op1 == OP_XGDX)
+ {
+ add_sp_mode = 1;
+ pc += 2;
+ }
+ else if (op0 == OP_PAGE2 && op1 == OP_TSY && op2 == OP_PAGE2)
+ {
+ op0 = read_memory_unsigned_integer (pc + 3, 1);
+ if (op0 != OP_XGDY)
+ break;
+
+ add_sp_mode = 2;
+ pc += 4;
+ }
+ else if (add_sp_mode && op0 == OP_ADDD)
+ {
+ sp_adjust = read_memory_unsigned_integer (pc + 1, 2);
+ if (sp_adjust & 0x8000)
+ sp_adjust |= 0xffff0000L;
+
+ sp_adjust = -sp_adjust;
+ add_sp_mode |= 4;
+ pc += 3;
+ }
+ else if (add_sp_mode == (1 | 4) && op0 == OP_XGDX
+ && op1 == OP_TXS)
+ {
+ size += sp_adjust;
+ pc += 2;
+ add_sp_mode = 0;
+ }
+ else if (add_sp_mode == (2 | 4) && op0 == OP_PAGE2
+ && op1 == OP_XGDY && op2 == OP_PAGE2)
+ {
+ op0 = read_memory_unsigned_integer (pc + 3, 1);
+ if (op0 != OP_TYS)
+ break;
+
+ size += sp_adjust;
+ pc += 4;
+ add_sp_mode = 0;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ if (found_frame_point == 0)
+ {
+ *frame_offset = 0;
+ }
+ else
+ {
+ *frame_offset = size;
+ }
+
+ /* Now, look forward to see how many registers are pushed on the stack.
+ We look only for soft registers so there must be a first LDX *REG
+ before a PSHX. */
+ reg_saved = 0;
+ found_load = 0;
+ while (pc + 2 < func_end)
+ {
+ op0 = read_memory_unsigned_integer (pc, 1);
+ op1 = read_memory_unsigned_integer (pc + 1, 1);
+ op2 = read_memory_unsigned_integer (pc + 2, 1);
+ if (op0 == OP_LDX && op1 > frame_index && op1 <= reg_last)
+ {
+ found_load = 1;
+ pc += 2;
+ }
+ else if (op0 == OP_PAGE2 && op1 == OP_LDY
+ && op2 > frame_index && op2 < reg_last)
+ {
+ found_load = 1;
+ pc += 3;
+ }
+ else if (op0 == OP_PSHX)
+ {
+ /* If there was no load, this is a push for a function call. */
+ if (found_load == 0)
+ break;
+
+ reg_saved += 2;
+ pc += 1;
+ found_load = 0;
+ }
+ else if (op0 == OP_PAGE2 && op1 == OP_PSHY)
+ {
+ if (found_load == 0)
+ break;
+
+ reg_saved += 2;
+ pc += 2;
+ found_load = 0;
+ }
+ else
+ {
+ break;
+ }
+ }
+ *pushed_regs = reg_saved;
+ *first_line = pc;
+ }
+
+
+ CORE_ADDR
+ m68hc11_skip_prologue (CORE_ADDR pc)
+ {
+ CORE_ADDR func_addr, func_end;
+ struct symtab_and_line sal;
+ int frame_offset;
+ int pushed_args;
+
+ /* If we have line debugging information, then the end of the. */
+ /* prologue should be the first assembly instruction of the
+ first source line. */
+ if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
+ {
+ sal = find_pc_line (func_addr, 0);
+ if (sal.end && sal.end < func_end)
+ return sal.end;
+ }
+
+ m68hc11_guess_from_prologue (pc, &pc, &frame_offset, &pushed_args);
+ return pc;
+ }
+
+ /* Given a GDB frame, determine the address of the calling function's frame.
+ This will be used to create a new GDB frame struct, and then
+ INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame.
+ */
+
+ CORE_ADDR
+ m68hc11_frame_chain (struct frame_info *frame)
+ {
+ unsigned addr;
+
+ if (frame->return_pc == 0 || inside_entry_file(frame->return_pc))
+ return (CORE_ADDR)0;
+
+ if (frame->frame == 0)
+ {
+ return (CORE_ADDR) 0;
+ }
+
+ addr = frame->frame + frame->size + 1 - 2;
+ addr = read_memory_unsigned_integer (addr, 2) & 0x0FFFF;
+ if (addr == 0)
+ {
+ return (CORE_ADDR)0;
+ }
+
+ return addr;
+ }
+
+ /* Put here the code to store, into a struct frame_saved_regs, the
+ addresses of the saved registers of frame described by FRAME_INFO.
+ This includes special registers such as pc and fp saved in special
+ ways in the stack frame. sp is even more special: the address we
+ return for it IS the sp for the next frame. */
+ void
+ m68hc11_frame_find_saved_regs (struct frame_info *fi,
+ struct frame_saved_regs *fsr)
+ {
+ CORE_ADDR pc;
+ int saved;
+
+ pc = fi->pc;
+ memset (fsr, 0, sizeof (*fsr));
+ m68hc11_guess_from_prologue (pc, &pc, &fi->size, &saved);
+ }
+
+ void
+ m68hc11_init_extra_frame_info (int fromleaf, struct frame_info *fi)
+ {
+ unsigned addr;
+ struct frame_saved_regs dummy;
+
+ m68hc11_frame_find_saved_regs (fi, &dummy);
+
+ if (fromleaf)
+ {
+ fi->return_pc = m68hc11_saved_pc_after_call (fi);
+ }
+ else
+ {
+ addr = fi->frame + fi->size + 1;
+ fi->return_pc = read_memory_unsigned_integer (addr, 2) & 0x0ffff;
+
+ #if 0
+ printf ("Pc@0x%04x, FR 0x%04x, size %d, read ret @0x%04x -> 0x%04x\n",
+ fi->pc,
+ fi->frame, fi->size,
+ addr & 0x0ffff,
+ fi->return_pc);
+ #endif
+ }
+ }
+
+ /* Same as 'info reg' but prints the registers in a different way. */
+ static void
+ show_regs (char *args, int from_tty)
+ {
+ int ccr = read_register (PSW_REGNUM);
+ int i;
+
+ printf_filtered ("PC=%04x SP=%04x FP=%04x CCR=%02x %c%c%c%c%c%c%c%c\n",
+ read_register (PC_REGNUM),
+ read_register (SP_REGNUM),
+ read_register (FP_REGNUM),
+ ccr,
+ ccr & M6811_S_BIT ? 'S' : '-',
+ ccr & M6811_X_BIT ? 'X' : '-',
+ ccr & M6811_H_BIT ? 'H' : '-',
+ ccr & M6811_I_BIT ? 'I' : '-',
+ ccr & M6811_N_BIT ? 'N' : '-',
+ ccr & M6811_Z_BIT ? 'Z' : '-',
+ ccr & M6811_V_BIT ? 'V' : '-',
+ ccr & M6811_C_BIT ? 'C' : '-');
+
+ printf_filtered ("D=%04x IX=%04x IY=%04x\n",
+ read_register (D_REGNUM),
+ read_register (X_REGNUM),
+ read_register (Y_REGNUM));
+ for (i = ZD1_REGNUM; i <= ZD32_REGNUM; i++)
+ {
+ printf_filtered ("ZD%d=%04x",
+ i - ZD1_REGNUM + 1,
+ read_register (i));
+ if (((i - ZD1_REGNUM) % 8) == 7)
+ printf_filtered ("\n");
+ else
+ printf_filtered (" ");
+ }
+ }
+
+ CORE_ADDR
+ m68hc11_fix_call_dummy (char *dummyname,
+ CORE_ADDR start_sp,
+ CORE_ADDR fun,
+ int nargs,
+ value_ptr *args,
+ struct type *type,
+ int gcc_p)
+ {
+ m68hc11_not_yet ("m68hc11_fix_call_dummy");
+ return 0;
+ }
+
+ static void
+ m68hc11_pop_dummy_frame (struct frame_info *fi)
+ {
+ m68hc11_not_yet ("m68hc11_pop_dummy_frame");
+ }
+
+
+ CORE_ADDR
+ m68hc11_push_arguments (int nargs,
+ value_ptr *args,
+ CORE_ADDR sp,
+ int struct_return,
+ CORE_ADDR struct_addr)
+ {
+ m68hc11_not_yet ("m68hc11_push_arguments");
+ return 0;
+ }
+
+
+ CORE_ADDR
+ m68hc11_call_dummy_address ()
+ {
+ m68hc11_not_yet ("m68hc11_call_dummy_address");
+ return 0;
+ }
+
+ /* Given a return value in `regbuf' with a type `valtype',
+ extract and copy its value into `valbuf'. */
+
+ void
+ m68hc11_extract_return_value (struct type *valtype,
+ char *regbuf,
+ char *valbuf)
+ {
+ m68hc11_not_yet ("m68hc11_extract_return_value");
+ }
+
+ void
+ _initialize_m68hc11_tdep ()
+ {
+ tm_print_insn = print_insn_m68hc11;
+
+ add_com ("regs", class_vars, show_regs, "Print all registers");
+ }
+
Index: config/m68hc11/m68hc11.mt
===================================================================
RCS file: m68hc11.mt
diff -N m68hc11.mt
*** /dev/null Tue May 5 13:32:27 1998
--- m68hc11.mt Thu Jul 27 00:12:48 2000
***************
*** 0 ****
--- 1,6 ----
+ # Target: Motorola 68HC11 processor
+ TDEPFILES= m68hc11-tdep.o
+ TM_FILE= tm-m68hc11.h
+ SIM_OBS= remote-sim.o
+ SIM= ../sim/m68hc11/libsim.a -lm
+
From ac131313@cygnus.com Thu Jul 27 01:58:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: [rfc] Really tm.h, nm.h and xm.h optional
Date: Thu, 27 Jul 2000 01:58:00 -0000
Message-id: <397FF9A0.3B9181B@cygnus.com>
X-SW-Source: 2000-07/msg00320.html
Content-length: 9694
Hello,
Following on from the m68hc11 and tm.h configury changes, the attached:
o fixes a buglet in that
configure.in didn't ignore tm.h
even when it claimed that it was.
o Removes the hardwired dependencies
in defs.h/Makefile.in on the files
on tm.h, xm.h, nm.h. The previous
change didn't quite get it right :-(
o Add (optional) macros GDB_NM_FILE,
GDB_XM_FILE and GDB_TM_FILE to
config.h.
This has the side effect of fixing
the buglet where changing the
configuration may not trigger a
full rebuild.
tm.h isn't needed when the target is pure mult-arch.
nm.h isn't needed when the target isn't native. (I suspect pure
multi-arch targets won't need it either.)
xm.h isn't needed when autoconf manages to handle all host dependencies.
I should note that there are N different ways of handling the optional
xm/nm/tm problem. I happened to have chosen this one. The optional
nm.h configury was previously handled by having an empty
config/nm-empty.h. I could change things to mimic that behaviour (if
anyone has a strong opinion).
Comments? Suggestions?
Andrew
PS, Stephane Carrez: You'll need to apply this patch or one like it to
your local tree for the m68hc11.
Thu Jul 27 17:38:35 2000 Andrew Cagney <cagney@b1.cygnus.com>
* configure.in (targetfile): Ignore TM_FILE, don't just issue
warning.
(tm_h, xm_h, nm_h, GDB_TM_FILE, GDB_XM_FILE, GDB_NM_FILE): Define.
* acconfig.h (GDB_XM_FILE, GDB_TM_FILE, GDB_NM_FILE): Add.
* config/nm-empty.h: Delete.
* defs.h (xm.h, nm.h, tm.h): Only include when GDB_XM_FILE,
GDB_NM_FILE or GDB_TM_FILE defined.
* Makefile.in (defs_h): Replace tm.h, xm.h and nm.h with tm_h,
xm_h and nm_h macro that are defined by configure.
(tm_h, xm_h, tm_h): New.
* configure, config.in: Regenerate
* TODO: Update.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.39
diff -p -r1.39 Makefile.in
*** Makefile.in 2000/07/10 06:16:51 1.39
--- Makefile.in 2000/07/27 08:24:29
*************** command_h = command.h
*** 548,554 ****
gdbcmd_h = gdbcmd.h $(command_h)
call_cmds_h = call-cmds.h
! defs_h = defs.h xm.h tm.h nm.h config.status config.h gdbarch.h ui-file.h
top_h = top.h
inferior_h = inferior.h $(breakpoint_h)
--- 548,557 ----
gdbcmd_h = gdbcmd.h $(command_h)
call_cmds_h = call-cmds.h
! xm_h = @xm_h@
! tm_h = @tm_h@
! nm_h = @nm_h@
! defs_h = defs.h $(xm_h) $(tm_h) $(nm_h) config.status config.h gdbarch.h ui-file.h
top_h = top.h
inferior_h = inferior.h $(breakpoint_h)
Index: TODO
===================================================================
RCS file: /cvs/src/src/gdb/TODO,v
retrieving revision 1.42
diff -p -r1.42 TODO
*** TODO 2000/07/24 14:49:05 1.42
--- TODO 2000/07/27 08:24:34
*************** fundamental architectural change.
*** 348,359 ****
Add built-by, build-date, tm, xm, nm and anything else into gdb binary
so that you can see how the GDB was created.
- Some of these (*m.h) would be added to the generated config.h. That
- in turn would fix a long standing bug where by the build process many
- not notice a changed tm.h file. Since everything depends on config.h,
- a change to *m.h forces a change to config.h and, consequently forces
- a rebuild.
-
--
Add an "info bfd" command that displays supported object formats,
--- 348,353 ----
Index: acconfig.h
===================================================================
RCS file: /cvs/src/src/gdb/acconfig.h,v
retrieving revision 1.10
diff -p -r1.10 acconfig.h
*** acconfig.h 2000/07/27 04:01:24 1.10
--- acconfig.h 2000/07/27 08:24:36
***************
*** 125,127 ****
--- 125,135 ----
/* Multi-arch enabled. */
#undef GDB_MULTI_ARCH
+ /* hostfile */
+ #undef GDB_XM_FILE
+
+ /* targetfile */
+ #undef GDB_TM_FILE
+
+ /* nativefile */
+ #undef GDB_NM_FILE
Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/configure.in,v
retrieving revision 1.40
diff -p -r1.40 configure.in
*** configure.in 2000/07/27 04:01:24 1.40
--- configure.in 2000/07/27 08:24:50
*************** case "${GDB_MULTI_ARCH}" in
*** 1042,1047 ****
--- 1042,1048 ----
GDB_MULTI_ARCH_PURE )
if test x"${targetfile}" != x ; then
AC_MSG_WARN("GDB: Ingoring TM_FILE in ${target_makefile_frag}")
+ targetfile=""
fi ;;
*) AC_MSG_ERROR("GDB: Unknown GDB_MULTI_ARCH value ${GDB_MULTI_ARCH}");;
esac
*************** fi
*** 1055,1086 ****
AC_SUBST(SUBDIRS)
# If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
! # (NAT_FILE) is not set in config/*/*.m[ht] files, we don't make the
! # corresponding links. But we have to remove the xm.h files and tm.h
! # files anyway, e.g. when switching from "configure host" to
! # "configure none".
files=
links=
rm -f xm.h
if test "${hostfile}" != ""; then
! files="${files} config/${gdb_host_cpu}/${hostfile}"
! links="${links} xm.h"
fi
rm -f tm.h
if test "${targetfile}" != ""; then
! files="${files} config/${gdb_target_cpu}/${targetfile}"
! links="${links} tm.h"
fi
rm -f nm.h
if test "${nativefile}" != ""; then
! files="${files} config/${gdb_host_cpu}/${nativefile}"
! links="${links} nm.h"
! else
! # A cross-only configuration.
! files="${files} config/nm-empty.h"
! links="${links} nm.h"
fi
AC_PROG_LN_S
AC_LINK_FILES($files, $links)
--- 1056,1100 ----
AC_SUBST(SUBDIRS)
# If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
! # (NAT_FILE) is not set in config/*/*.m[ht] files, we link to an empty
! # version.
files=
links=
+
rm -f xm.h
+ xm_h=""
if test "${hostfile}" != ""; then
! xm_h=xm.h
! GDB_XM_FILE="config/${gdb_host_cpu}/${hostfile}"
! files="${files} ${GDB_XM_FILE}"
! links="${links} xm.h"
! AC_DEFINE_UNQUOTED(GDB_XM_FILE, ${GDB_XM_FILE})
fi
+ AC_SUBST(xm_h)
+
rm -f tm.h
+ tm_h=""
if test "${targetfile}" != ""; then
! tm_h=tm.h
! GDB_TM_FILE="config/${gdb_target_cpu}/${targetfile}"
! files="${files} ${GDB_TM_FILE}"
! links="${links} tm.h"
! AC_DEFINE_UNQUOTED(GDB_TM_FILE, ${GDB_TM_FILE})
fi
+ AC_SUBST(tm_h)
+
rm -f nm.h
+ nm_h=""
if test "${nativefile}" != ""; then
! nm_h=nm.h
! GDB_NM_FILE="config/${gdb_host_cpu}/${nativefile}"
! files="${files} ${GDB_NM_FILE}"
! links="${links} nm.h"
! AC_DEFINE_UNQUOTED(GDB_NM_FILE, ${GDB_NM_FILE})
fi
+ AC_SUBST(nm_h)
+
AC_PROG_LN_S
AC_LINK_FILES($files, $links)
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.28
diff -p -r1.28 defs.h
*** defs.h 2000/07/27 04:01:24 1.28
--- defs.h 2000/07/27 08:24:54
***************
*** 79,85 ****
#define GDB_MULTI_ARCH_TM 2
/* The target is pure multi-arch. The MULTI-ARCH vector provides all
! definitions. "tm.h" is NOT included. */
#define GDB_MULTI_ARCH_PURE 3
--- 79,85 ----
#define GDB_MULTI_ARCH_TM 2
/* The target is pure multi-arch. The MULTI-ARCH vector provides all
! definitions. "tm.h" is linked to an empty file. */
#define GDB_MULTI_ARCH_PURE 3
*************** enum val_prettyprint
*** 710,738 ****
};
\f
! /* Host machine definition. This will be a symlink to one of the
! xm-*.h files, built by the `configure' script. */
#include "xm.h"
! /* Native machine support. This will be a symlink to one of the
! nm-*.h files, built by the `configure' script. */
#include "nm.h"
! /* Target machine definition. This will be a symlink to one of the
tm-*.h files, built by the `configure' script. */
! #if (GDB_MULTI_ARCH < GDB_MULTI_ARCH_PURE)
#include "tm.h"
#endif
/* GDB_MULTI_ARCH is normally set by configure.in using information
from configure.tgt or the config/%/%.mt Makefile fragment. Since
! some targets have defined it in their tm.h file, don't provide a
! default until after "tm.h" has been included. (In the above #if,
! GDB_MULTI_ARCH will be interpreted as zero if it is not
! defined). */
#ifndef GDB_MULTI_ARCH
#define GDB_MULTI_ARCH 0
--- 710,744 ----
};
\f
! /* Optional host machine definition. Pure autoconf targets will not
! need a "xm.h" file. This will be a symlink to one of the xm-*.h
! files, built by the `configure' script. */
+ #ifdef GDB_XM_FILE
#include "xm.h"
+ #endif
! /* Optional native machine support. Non-native (and possibly pure
! multi-arch) targets do not need a "nm.h" file. This will be a
! symlink to one of the nm-*.h files, built by the `configure'
! script. */
+ #ifdef GDB_NM_FILE
#include "nm.h"
+ #endif
! /* Optional target machine definition. Pure multi-arch configurations
! do not need a "tm.h" file. This will be a symlink to one of the
tm-*.h files, built by the `configure' script. */
! #ifdef GDB_TM_FILE
#include "tm.h"
#endif
/* GDB_MULTI_ARCH is normally set by configure.in using information
from configure.tgt or the config/%/%.mt Makefile fragment. Since
! some targets have defined it in their "tm.h" file, delay providing
! a default definition until after "tm.h" has been included.. */
#ifndef GDB_MULTI_ARCH
#define GDB_MULTI_ARCH 0
Index: config/nm-empty.h
===================================================================
RCS file: nm-empty.h
diff -N nm-empty.h
*** /sourceware/cvs-tmp/cvs2pxTar Thu Jul 27 01:24:58 2000
--- /dev/null Tue May 5 13:32:27 1998
***************
*** 1,2 ****
- /* This is just a dummy file to symlink to when GDB is configured as a
- cross-only debugger. */
--- 0 ----
From ac131313@cygnus.com Thu Jul 27 02:12:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Michael Snyder <msnyder@redhat.com>, GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: Re: [PATCH]: Update thread list
Date: Thu, 27 Jul 2000 02:12:00 -0000
Message-id: <397FFCE4.E0FB5CAF@cygnus.com>
References: <3978E783.37F9@cygnus.com> <397E6CE0.AD61DDD8@cygnus.com> <397F3D14.3B68@redhat.com>
X-SW-Source: 2000-07/msg00321.html
Content-length: 1199
Michael Snyder wrote:
>
> Andrew Cagney wrote:
> >
> > Michael Snyder wrote:
> > >
> > > I can think of two times when it is both safe and useful
> > > for GDB to go query the target to find out if there are
> > > any new threads.
> > > 1) "info threads" and
> > > 2) "thread apply all xxx"
> > >
> > > This change adds the second (the first is already in place).
> >
> > Should this (and the other) call be wrapped in something that stops GDB
> > updating the thread list more than once? Doing a
> > target_find_new_threads() can get expensive and, assuming the target has
> > stopped, shouldn't change between each call.
> >
> > But you're the thread maintainer.
>
> Good idea, I guess. I'd wanna think about what "level" it
> belongs at. Should we have the core GDB maintain a "once" flag,
> or should we go ahead and call the target_find_new_threads
> function, and let the target decide? Certainly there may
> be future targets where "all-stop" is not true, and in that
> day there may be some "all-stop" targets and some "some-stop"
> ones.
For the moment, I think thread.c can handle it. Worry about the
problems of the target still running when someone gets that working.
Andrew
From ac131313@cygnus.com Thu Jul 27 02:41:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Kazu Hirata <kazu@hxi.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: [patch] sim/h8300/compile.c
Date: Thu, 27 Jul 2000 02:41:00 -0000
Message-id: <398003D3.1DFC6E6F@cygnus.com>
References: <200006160432.VAA28090@cygnus.com>
X-SW-Source: 2000-07/msg00322.html
Content-length: 326
Kazu Hirata wrote:
> 2000-06-15 Kazu Hirata <kazu@hxi.com>
>
> * compile.c (decode): Distinguish inc/dec.[wl] and adds/subs
> correctly.
>
Applied.
Andrew
PS:
+ if ((looking_for & 7) != (thisnib & 7))
goto fail;
Someone should think about eliminating the goto :-)
From macro@ds2.pg.gda.pl Thu Jul 27 03:30:00 2000
From: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: Michael Snyder <msnyder@redhat.com>, gdb-patches@sourceware.cygnus.com
Subject: Re: gdb 5.0: solib.c (LM_ADDR) should be signed, not unsigned
Date: Thu, 27 Jul 2000 03:30:00 -0000
Message-id: <Pine.GSO.3.96.1000727120845.3315C-100000@delta.ds2.pg.gda.pl>
References: <397F8797.BA883F79@cygnus.com>
X-SW-Source: 2000-07/msg00323.html
Content-length: 502
On Thu, 27 Jul 2000, Andrew Cagney wrote:
> It won't help Maciej's problem though. It looks to be a real bug - I
> can't confirm or deny it (JimB?) as I don't have an ELF spec lying
> around.
You can get the SYSV ABI which includes chapters on ELF from
' http://www.sco.com/developer/devspecs/ '.
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2000-07-26 17:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <Pine.GSO.3.96.1000619191851.10348S-100000@delta.ds2.pg.gda.pl>
2000-07-24 5:23 ` gdb 5.0: solib.c (LM_ADDR) should be signed, not unsigned Maciej W. Rozycki
[not found] ` <397E6840.F0F99FA1@cygnus.com>
2000-07-26 15:49 ` Michael Snyder
2000-07-26 17:53 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox