Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: gdbserver
       [not found] <6703765BD7FDD411AB0900508BFCACD3017D106E@bnbeluimex01.barconet.com>
@ 2002-08-30 16:34 ` Daniel Jacobowitz
  2002-08-30 16:41   ` gdbserver Michael Snyder
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2002-08-30 16:34 UTC (permalink / raw)
  To: msnyder, gdb-patches; +Cc: Van Assche, Bart

[Bart, please try this patch.]

List folks,

I think the time has come for generic_prepare_to_proceed to actually be
used.  The problem addressed by this patch is that PREPARE_TO_PROCEED
is not a native-only macro (and not part of the target stack).  So
lin_lwp_prepare_to_proceed would be called when using gdbserver, and of
course trap_ptid would be null_ptid or stale. 
generic_prepare_to_proceed works correctly for lin-lwp native
debugging, and for remote debugging.  This patch fixes an incorrect
breakpoint hit after manually switching threads; i.e. the same
breakpoint would be hit a second time.  I'll try to write an
independent test case.

Patch look OK?

On Fri, Aug 23, 2002 at 08:35:17AM +0200, Van Assche, Bart wrote:
> Hello Dan,
> 
>    Thanks for your response. I tried with the latest snapshot, and debugging
> threads has indeed improved. However, I still get a SIGSEGV reported when I
> use remote debugging (that I do not get with native debugging -- see also
> below).


-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2002-08-30  Daniel Jacobowitz  <drow@mvista.com>

	* arch-utils.c (default_prepare_to_proceed): Remove.
	* arch-utils.h (default_prepare_to_proceed): Remove prototype.
	* gdbarch.sh (PREPARE_TO_PROCEED): Change default to
	generic_prepare_to_proceed.
	* gdbarch.c: Regenerated.
	* gdbarch.h: Regenerated.
	* lin-lwp.c (lin_lwp_prepare_to_proceed): Remove.
	* config/nm-linux.h (PREPARE_TO_PROCEED): Don't define.
	(lin_lwp_prepare_to_proceed): Remove prototype.

Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.67
diff -u -p -r1.67 arch-utils.c
--- arch-utils.c	24 Aug 2002 00:21:34 -0000	1.67
+++ arch-utils.c	30 Aug 2002 22:13:11 -0000
@@ -320,13 +320,6 @@ default_frame_address (struct frame_info
   return fi->frame;
 }
 
-/* Default prepare_to_procced().  */
-int
-default_prepare_to_proceed (int select_it)
-{
-  return 0;
-}
-
 /* Generic prepare_to_proceed().  This one should be suitable for most
    targets that support threads. */
 int
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.146
diff -u -p -r1.146 gdbarch.c
--- gdbarch.c	24 Aug 2002 00:21:34 -0000	1.146
+++ gdbarch.c	30 Aug 2002 22:13:12 -0000
@@ -530,7 +530,7 @@ gdbarch_alloc (const struct gdbarch_info
   current_gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint;
   current_gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
   current_gdbarch->decr_pc_after_break = -1;
-  current_gdbarch->prepare_to_proceed = default_prepare_to_proceed;
+  current_gdbarch->prepare_to_proceed = generic_prepare_to_proceed;
   current_gdbarch->function_start_offset = -1;
   current_gdbarch->remote_translate_xfer_address = generic_remote_translate_xfer_address;
   current_gdbarch->frame_args_skip = -1;
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.114
diff -u -p -r1.114 gdbarch.h
--- gdbarch.h	24 Aug 2002 00:21:34 -0000	1.114
+++ gdbarch.h	30 Aug 2002 22:13:13 -0000
@@ -1809,7 +1809,7 @@ extern void set_gdbarch_decr_pc_after_br
 
 /* Default (function) for non- multi-arch platforms. */
 #if (!GDB_MULTI_ARCH) && !defined (PREPARE_TO_PROCEED)
-#define PREPARE_TO_PROCEED(select_it) (default_prepare_to_proceed (select_it))
+#define PREPARE_TO_PROCEED(select_it) (generic_prepare_to_proceed (select_it))
 #endif
 
 typedef int (gdbarch_prepare_to_proceed_ftype) (int select_it);
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.158
diff -u -p -r1.158 gdbarch.sh
--- gdbarch.sh	24 Aug 2002 00:21:34 -0000	1.158
+++ gdbarch.sh	30 Aug 2002 22:13:14 -0000
@@ -549,7 +549,7 @@ f:2:BREAKPOINT_FROM_PC:const unsigned ch
 f:2:MEMORY_INSERT_BREAKPOINT:int:memory_insert_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_insert_breakpoint::0
 f:2:MEMORY_REMOVE_BREAKPOINT:int:memory_remove_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_remove_breakpoint::0
 v:2:DECR_PC_AFTER_BREAK:CORE_ADDR:decr_pc_after_break::::0:-1
-f::PREPARE_TO_PROCEED:int:prepare_to_proceed:int select_it:select_it::0:default_prepare_to_proceed::0
+f::PREPARE_TO_PROCEED:int:prepare_to_proceed:int select_it:select_it::0:generic_prepare_to_proceed::0
 v:2:FUNCTION_START_OFFSET:CORE_ADDR:function_start_offset::::0:-1
 #
 f:2:REMOTE_TRANSLATE_XFER_ADDRESS:void:remote_translate_xfer_address:CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len:gdb_addr, gdb_len, rem_addr, rem_len:::generic_remote_translate_xfer_address::0
Index: lin-lwp.c
===================================================================
RCS file: /cvs/src/src/gdb/lin-lwp.c,v
retrieving revision 1.35
diff -u -p -r1.35 lin-lwp.c
--- lin-lwp.c	27 Aug 2002 22:37:06 -0000	1.35
+++ lin-lwp.c	30 Aug 2002 22:13:14 -0000
@@ -294,46 +294,6 @@ iterate_over_lwps (int (*callback) (stru
 }
 \f
 
-/* Implementation of the PREPARE_TO_PROCEED hook for the GNU/Linux LWP
-   layer.
-
-   Note that this implementation is potentially redundant now that
-   default_prepare_to_proceed() has been added.
-
-   FIXME This may not support switching threads after Ctrl-C
-   correctly. The default implementation does support this. */
-
-int
-lin_lwp_prepare_to_proceed (void)
-{
-  if (! ptid_equal (trap_ptid, null_ptid)
-      && ! ptid_equal (inferior_ptid, trap_ptid))
-    {
-      /* Switched over from TRAP_PID.  */
-      CORE_ADDR stop_pc = read_pc ();
-      CORE_ADDR trap_pc;
-
-      /* Avoid switching where it wouldn't do any good, i.e. if both
-         threads are at the same breakpoint.  */
-      trap_pc = read_pc_pid (trap_ptid);
-      if (trap_pc != stop_pc && breakpoint_here_p (trap_pc))
-	{
-	  /* User hasn't deleted the breakpoint.  Return non-zero, and
-             switch back to TRAP_PID.  */
-	  inferior_ptid = trap_ptid;
-
-	  /* FIXME: Is this stuff really necessary?  */
-	  flush_cached_frames ();
-	  registers_changed ();
-
-	  return 1;
-	}
-    }
-
-  return 0;
-}
-\f
-
 #if 0
 static void
 lin_lwp_open (char *args, int from_tty)
Index: config/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/nm-linux.h,v
retrieving revision 1.12
diff -u -p -r1.12 nm-linux.h
--- config/nm-linux.h	24 Feb 2002 22:56:04 -0000	1.12
+++ config/nm-linux.h	30 Aug 2002 22:13:14 -0000
@@ -49,9 +49,6 @@ struct target_waitstatus;
 extern ptid_t child_wait (ptid_t ptid, struct target_waitstatus *ourstatus);
 #define CHILD_WAIT
 
-extern int lin_lwp_prepare_to_proceed (void);
-#define PREPARE_TO_PROCEED(select_it) lin_lwp_prepare_to_proceed ()
-
 extern void lin_lwp_attach_lwp (ptid_t ptid, int verbose);
 #define ATTACH_LWP(ptid, verbose) lin_lwp_attach_lwp ((ptid), (verbose))
 
Index: arch-utils.h
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.h,v
retrieving revision 1.41
diff -u -p -r1.41 arch-utils.h
--- arch-utils.h	24 Aug 2002 00:21:34 -0000	1.41
+++ arch-utils.h	30 Aug 2002 22:15:25 -0000
@@ -115,8 +115,6 @@ extern CORE_ADDR default_frame_address (
 
 /* Default prepare_to_procced. */
 
-extern int default_prepare_to_proceed (int select_it);
-
 extern int generic_prepare_to_proceed (int select_it);
 
 /* Versions of init_frame_pc().  Do nothing; do the default. */


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gdbserver
  2002-08-30 16:34 ` gdbserver Daniel Jacobowitz
@ 2002-08-30 16:41   ` Michael Snyder
  2002-08-31  5:05     ` gdbserver Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Snyder @ 2002-08-30 16:41 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches, Van Assche, Bart

Daniel Jacobowitz wrote:
> 
> [Bart, please try this patch.]
> 
> List folks,
> 
> I think the time has come for generic_prepare_to_proceed to actually be
> used.  The problem addressed by this patch is that PREPARE_TO_PROCEED
> is not a native-only macro (and not part of the target stack).  So
> lin_lwp_prepare_to_proceed would be called when using gdbserver, and of
> course trap_ptid would be null_ptid or stale.
> generic_prepare_to_proceed works correctly for lin-lwp native
> debugging, and for remote debugging.  This patch fixes an incorrect
> breakpoint hit after manually switching threads; i.e. the same
> breakpoint would be hit a second time.  I'll try to write an
> independent test case.
> 
> Patch look OK?

Of course, a simpler and less intrusive fix would be to simply
define PREPARE_TO_PROCEED as generic_prepare_to_proceed, and 
remove lin_lwp_prepare_to_proceed.  

I'm not necessarily objecting to this patch -- just pointing
out an alternative.  If people think we're ready for this step, 
it's fine with me.


> On Fri, Aug 23, 2002 at 08:35:17AM +0200, Van Assche, Bart wrote:
> > Hello Dan,
> >
> >    Thanks for your response. I tried with the latest snapshot, and debugging
> > threads has indeed improved. However, I still get a SIGSEGV reported when I
> > use remote debugging (that I do not get with native debugging -- see also
> > below).
> 
> --
> Daniel Jacobowitz
> MontaVista Software                         Debian GNU/Linux Developer
> 
> 2002-08-30  Daniel Jacobowitz  <drow@mvista.com>
> 
>         * arch-utils.c (default_prepare_to_proceed): Remove.
>         * arch-utils.h (default_prepare_to_proceed): Remove prototype.
>         * gdbarch.sh (PREPARE_TO_PROCEED): Change default to
>         generic_prepare_to_proceed.
>         * gdbarch.c: Regenerated.
>         * gdbarch.h: Regenerated.
>         * lin-lwp.c (lin_lwp_prepare_to_proceed): Remove.
>         * config/nm-linux.h (PREPARE_TO_PROCEED): Don't define.
>         (lin_lwp_prepare_to_proceed): Remove prototype.
> 
> Index: arch-utils.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/arch-utils.c,v
> retrieving revision 1.67
> diff -u -p -r1.67 arch-utils.c
> --- arch-utils.c        24 Aug 2002 00:21:34 -0000      1.67
> +++ arch-utils.c        30 Aug 2002 22:13:11 -0000
> @@ -320,13 +320,6 @@ default_frame_address (struct frame_info
>    return fi->frame;
>  }
> 
> -/* Default prepare_to_procced().  */
> -int
> -default_prepare_to_proceed (int select_it)
> -{
> -  return 0;
> -}
> -
>  /* Generic prepare_to_proceed().  This one should be suitable for most
>     targets that support threads. */
>  int
> Index: gdbarch.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbarch.c,v
> retrieving revision 1.146
> diff -u -p -r1.146 gdbarch.c
> --- gdbarch.c   24 Aug 2002 00:21:34 -0000      1.146
> +++ gdbarch.c   30 Aug 2002 22:13:12 -0000
> @@ -530,7 +530,7 @@ gdbarch_alloc (const struct gdbarch_info
>    current_gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint;
>    current_gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
>    current_gdbarch->decr_pc_after_break = -1;
> -  current_gdbarch->prepare_to_proceed = default_prepare_to_proceed;
> +  current_gdbarch->prepare_to_proceed = generic_prepare_to_proceed;
>    current_gdbarch->function_start_offset = -1;
>    current_gdbarch->remote_translate_xfer_address = generic_remote_translate_xfer_address;
>    current_gdbarch->frame_args_skip = -1;
> Index: gdbarch.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbarch.h,v
> retrieving revision 1.114
> diff -u -p -r1.114 gdbarch.h
> --- gdbarch.h   24 Aug 2002 00:21:34 -0000      1.114
> +++ gdbarch.h   30 Aug 2002 22:13:13 -0000
> @@ -1809,7 +1809,7 @@ extern void set_gdbarch_decr_pc_after_br
> 
>  /* Default (function) for non- multi-arch platforms. */
>  #if (!GDB_MULTI_ARCH) && !defined (PREPARE_TO_PROCEED)
> -#define PREPARE_TO_PROCEED(select_it) (default_prepare_to_proceed (select_it))
> +#define PREPARE_TO_PROCEED(select_it) (generic_prepare_to_proceed (select_it))
>  #endif
> 
>  typedef int (gdbarch_prepare_to_proceed_ftype) (int select_it);
> Index: gdbarch.sh
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbarch.sh,v
> retrieving revision 1.158
> diff -u -p -r1.158 gdbarch.sh
> --- gdbarch.sh  24 Aug 2002 00:21:34 -0000      1.158
> +++ gdbarch.sh  30 Aug 2002 22:13:14 -0000
> @@ -549,7 +549,7 @@ f:2:BREAKPOINT_FROM_PC:const unsigned ch
>  f:2:MEMORY_INSERT_BREAKPOINT:int:memory_insert_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_insert_breakpoint::0
>  f:2:MEMORY_REMOVE_BREAKPOINT:int:memory_remove_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_remove_breakpoint::0
>  v:2:DECR_PC_AFTER_BREAK:CORE_ADDR:decr_pc_after_break::::0:-1
> -f::PREPARE_TO_PROCEED:int:prepare_to_proceed:int select_it:select_it::0:default_prepare_to_proceed::0
> +f::PREPARE_TO_PROCEED:int:prepare_to_proceed:int select_it:select_it::0:generic_prepare_to_proceed::0
>  v:2:FUNCTION_START_OFFSET:CORE_ADDR:function_start_offset::::0:-1
>  #
>  f:2:REMOTE_TRANSLATE_XFER_ADDRESS:void:remote_translate_xfer_address:CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len:gdb_addr, gdb_len, rem_addr, rem_len:::generic_remote_translate_xfer_address::0
> Index: lin-lwp.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/lin-lwp.c,v
> retrieving revision 1.35
> diff -u -p -r1.35 lin-lwp.c
> --- lin-lwp.c   27 Aug 2002 22:37:06 -0000      1.35
> +++ lin-lwp.c   30 Aug 2002 22:13:14 -0000
> @@ -294,46 +294,6 @@ iterate_over_lwps (int (*callback) (stru
>  }
> 
> 
> -/* Implementation of the PREPARE_TO_PROCEED hook for the GNU/Linux LWP
> -   layer.
> -
> -   Note that this implementation is potentially redundant now that
> -   default_prepare_to_proceed() has been added.
> -
> -   FIXME This may not support switching threads after Ctrl-C
> -   correctly. The default implementation does support this. */
> -
> -int
> -lin_lwp_prepare_to_proceed (void)
> -{
> -  if (! ptid_equal (trap_ptid, null_ptid)
> -      && ! ptid_equal (inferior_ptid, trap_ptid))
> -    {
> -      /* Switched over from TRAP_PID.  */
> -      CORE_ADDR stop_pc = read_pc ();
> -      CORE_ADDR trap_pc;
> -
> -      /* Avoid switching where it wouldn't do any good, i.e. if both
> -         threads are at the same breakpoint.  */
> -      trap_pc = read_pc_pid (trap_ptid);
> -      if (trap_pc != stop_pc && breakpoint_here_p (trap_pc))
> -       {
> -         /* User hasn't deleted the breakpoint.  Return non-zero, and
> -             switch back to TRAP_PID.  */
> -         inferior_ptid = trap_ptid;
> -
> -         /* FIXME: Is this stuff really necessary?  */
> -         flush_cached_frames ();
> -         registers_changed ();
> -
> -         return 1;
> -       }
> -    }
> -
> -  return 0;
> -}
> -
> -
>  #if 0
>  static void
>  lin_lwp_open (char *args, int from_tty)
> Index: config/nm-linux.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/config/nm-linux.h,v
> retrieving revision 1.12
> diff -u -p -r1.12 nm-linux.h
> --- config/nm-linux.h   24 Feb 2002 22:56:04 -0000      1.12
> +++ config/nm-linux.h   30 Aug 2002 22:13:14 -0000
> @@ -49,9 +49,6 @@ struct target_waitstatus;
>  extern ptid_t child_wait (ptid_t ptid, struct target_waitstatus *ourstatus);
>  #define CHILD_WAIT
> 
> -extern int lin_lwp_prepare_to_proceed (void);
> -#define PREPARE_TO_PROCEED(select_it) lin_lwp_prepare_to_proceed ()
> -
>  extern void lin_lwp_attach_lwp (ptid_t ptid, int verbose);
>  #define ATTACH_LWP(ptid, verbose) lin_lwp_attach_lwp ((ptid), (verbose))
> 
> Index: arch-utils.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/arch-utils.h,v
> retrieving revision 1.41
> diff -u -p -r1.41 arch-utils.h
> --- arch-utils.h        24 Aug 2002 00:21:34 -0000      1.41
> +++ arch-utils.h        30 Aug 2002 22:15:25 -0000
> @@ -115,8 +115,6 @@ extern CORE_ADDR default_frame_address (
> 
>  /* Default prepare_to_procced. */
> 
> -extern int default_prepare_to_proceed (int select_it);
> -
>  extern int generic_prepare_to_proceed (int select_it);
> 
>  /* Versions of init_frame_pc().  Do nothing; do the default. */


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gdbserver
  2002-08-30 16:41   ` gdbserver Michael Snyder
@ 2002-08-31  5:05     ` Daniel Jacobowitz
  2002-09-02 18:47       ` gdbserver Andrew Cagney
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2002-08-31  5:05 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches, Van Assche, Bart

On Fri, Aug 30, 2002 at 04:34:39PM -0700, Michael Snyder wrote:
> Daniel Jacobowitz wrote:
> > 
> > [Bart, please try this patch.]
> > 
> > List folks,
> > 
> > I think the time has come for generic_prepare_to_proceed to actually be
> > used.  The problem addressed by this patch is that PREPARE_TO_PROCEED
> > is not a native-only macro (and not part of the target stack).  So
> > lin_lwp_prepare_to_proceed would be called when using gdbserver, and of
> > course trap_ptid would be null_ptid or stale.
> > generic_prepare_to_proceed works correctly for lin-lwp native
> > debugging, and for remote debugging.  This patch fixes an incorrect
> > breakpoint hit after manually switching threads; i.e. the same
> > breakpoint would be hit a second time.  I'll try to write an
> > independent test case.
> > 
> > Patch look OK?
> 
> Of course, a simpler and less intrusive fix would be to simply
> define PREPARE_TO_PROCEED as generic_prepare_to_proceed, and 
> remove lin_lwp_prepare_to_proceed.  
> 
> I'm not necessarily objecting to this patch -- just pointing
> out an alternative.  If people think we're ready for this step, 
> it's fine with me.

I think we're ready, but let's wait and see.  For any non-threaded
target generic_prepare_to_proceed won't do any harm, since it checks
inferior_ptid != resume_ptid; for threaded targets, some version of
this function must be better than none.

> 
> 
> > On Fri, Aug 23, 2002 at 08:35:17AM +0200, Van Assche, Bart wrote:
> > > Hello Dan,
> > >
> > >    Thanks for your response. I tried with the latest snapshot, and debugging
> > > threads has indeed improved. However, I still get a SIGSEGV reported when I
> > > use remote debugging (that I do not get with native debugging -- see also
> > > below).
> > 
> > --
> > Daniel Jacobowitz
> > MontaVista Software                         Debian GNU/Linux Developer
> > 
> > 2002-08-30  Daniel Jacobowitz  <drow@mvista.com>
> > 
> >         * arch-utils.c (default_prepare_to_proceed): Remove.
> >         * arch-utils.h (default_prepare_to_proceed): Remove prototype.
> >         * gdbarch.sh (PREPARE_TO_PROCEED): Change default to
> >         generic_prepare_to_proceed.
> >         * gdbarch.c: Regenerated.
> >         * gdbarch.h: Regenerated.
> >         * lin-lwp.c (lin_lwp_prepare_to_proceed): Remove.
> >         * config/nm-linux.h (PREPARE_TO_PROCEED): Don't define.
> >         (lin_lwp_prepare_to_proceed): Remove prototype.
> > 
> > Index: arch-utils.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/arch-utils.c,v
> > retrieving revision 1.67
> > diff -u -p -r1.67 arch-utils.c
> > --- arch-utils.c        24 Aug 2002 00:21:34 -0000      1.67
> > +++ arch-utils.c        30 Aug 2002 22:13:11 -0000
> > @@ -320,13 +320,6 @@ default_frame_address (struct frame_info
> >    return fi->frame;
> >  }
> > 
> > -/* Default prepare_to_procced().  */
> > -int
> > -default_prepare_to_proceed (int select_it)
> > -{
> > -  return 0;
> > -}
> > -
> >  /* Generic prepare_to_proceed().  This one should be suitable for most
> >     targets that support threads. */
> >  int
> > Index: gdbarch.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/gdbarch.c,v
> > retrieving revision 1.146
> > diff -u -p -r1.146 gdbarch.c
> > --- gdbarch.c   24 Aug 2002 00:21:34 -0000      1.146
> > +++ gdbarch.c   30 Aug 2002 22:13:12 -0000
> > @@ -530,7 +530,7 @@ gdbarch_alloc (const struct gdbarch_info
> >    current_gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint;
> >    current_gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
> >    current_gdbarch->decr_pc_after_break = -1;
> > -  current_gdbarch->prepare_to_proceed = default_prepare_to_proceed;
> > +  current_gdbarch->prepare_to_proceed = generic_prepare_to_proceed;
> >    current_gdbarch->function_start_offset = -1;
> >    current_gdbarch->remote_translate_xfer_address = generic_remote_translate_xfer_address;
> >    current_gdbarch->frame_args_skip = -1;
> > Index: gdbarch.h
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/gdbarch.h,v
> > retrieving revision 1.114
> > diff -u -p -r1.114 gdbarch.h
> > --- gdbarch.h   24 Aug 2002 00:21:34 -0000      1.114
> > +++ gdbarch.h   30 Aug 2002 22:13:13 -0000
> > @@ -1809,7 +1809,7 @@ extern void set_gdbarch_decr_pc_after_br
> > 
> >  /* Default (function) for non- multi-arch platforms. */
> >  #if (!GDB_MULTI_ARCH) && !defined (PREPARE_TO_PROCEED)
> > -#define PREPARE_TO_PROCEED(select_it) (default_prepare_to_proceed (select_it))
> > +#define PREPARE_TO_PROCEED(select_it) (generic_prepare_to_proceed (select_it))
> >  #endif
> > 
> >  typedef int (gdbarch_prepare_to_proceed_ftype) (int select_it);
> > Index: gdbarch.sh
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/gdbarch.sh,v
> > retrieving revision 1.158
> > diff -u -p -r1.158 gdbarch.sh
> > --- gdbarch.sh  24 Aug 2002 00:21:34 -0000      1.158
> > +++ gdbarch.sh  30 Aug 2002 22:13:14 -0000
> > @@ -549,7 +549,7 @@ f:2:BREAKPOINT_FROM_PC:const unsigned ch
> >  f:2:MEMORY_INSERT_BREAKPOINT:int:memory_insert_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_insert_breakpoint::0
> >  f:2:MEMORY_REMOVE_BREAKPOINT:int:memory_remove_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_remove_breakpoint::0
> >  v:2:DECR_PC_AFTER_BREAK:CORE_ADDR:decr_pc_after_break::::0:-1
> > -f::PREPARE_TO_PROCEED:int:prepare_to_proceed:int select_it:select_it::0:default_prepare_to_proceed::0
> > +f::PREPARE_TO_PROCEED:int:prepare_to_proceed:int select_it:select_it::0:generic_prepare_to_proceed::0
> >  v:2:FUNCTION_START_OFFSET:CORE_ADDR:function_start_offset::::0:-1
> >  #
> >  f:2:REMOTE_TRANSLATE_XFER_ADDRESS:void:remote_translate_xfer_address:CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len:gdb_addr, gdb_len, rem_addr, rem_len:::generic_remote_translate_xfer_address::0
> > Index: lin-lwp.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/lin-lwp.c,v
> > retrieving revision 1.35
> > diff -u -p -r1.35 lin-lwp.c
> > --- lin-lwp.c   27 Aug 2002 22:37:06 -0000      1.35
> > +++ lin-lwp.c   30 Aug 2002 22:13:14 -0000
> > @@ -294,46 +294,6 @@ iterate_over_lwps (int (*callback) (stru
> >  }
> > 
> > 
> > -/* Implementation of the PREPARE_TO_PROCEED hook for the GNU/Linux LWP
> > -   layer.
> > -
> > -   Note that this implementation is potentially redundant now that
> > -   default_prepare_to_proceed() has been added.
> > -
> > -   FIXME This may not support switching threads after Ctrl-C
> > -   correctly. The default implementation does support this. */
> > -
> > -int
> > -lin_lwp_prepare_to_proceed (void)
> > -{
> > -  if (! ptid_equal (trap_ptid, null_ptid)
> > -      && ! ptid_equal (inferior_ptid, trap_ptid))
> > -    {
> > -      /* Switched over from TRAP_PID.  */
> > -      CORE_ADDR stop_pc = read_pc ();
> > -      CORE_ADDR trap_pc;
> > -
> > -      /* Avoid switching where it wouldn't do any good, i.e. if both
> > -         threads are at the same breakpoint.  */
> > -      trap_pc = read_pc_pid (trap_ptid);
> > -      if (trap_pc != stop_pc && breakpoint_here_p (trap_pc))
> > -       {
> > -         /* User hasn't deleted the breakpoint.  Return non-zero, and
> > -             switch back to TRAP_PID.  */
> > -         inferior_ptid = trap_ptid;
> > -
> > -         /* FIXME: Is this stuff really necessary?  */
> > -         flush_cached_frames ();
> > -         registers_changed ();
> > -
> > -         return 1;
> > -       }
> > -    }
> > -
> > -  return 0;
> > -}
> > -
> > -
> >  #if 0
> >  static void
> >  lin_lwp_open (char *args, int from_tty)
> > Index: config/nm-linux.h
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/config/nm-linux.h,v
> > retrieving revision 1.12
> > diff -u -p -r1.12 nm-linux.h
> > --- config/nm-linux.h   24 Feb 2002 22:56:04 -0000      1.12
> > +++ config/nm-linux.h   30 Aug 2002 22:13:14 -0000
> > @@ -49,9 +49,6 @@ struct target_waitstatus;
> >  extern ptid_t child_wait (ptid_t ptid, struct target_waitstatus *ourstatus);
> >  #define CHILD_WAIT
> > 
> > -extern int lin_lwp_prepare_to_proceed (void);
> > -#define PREPARE_TO_PROCEED(select_it) lin_lwp_prepare_to_proceed ()
> > -
> >  extern void lin_lwp_attach_lwp (ptid_t ptid, int verbose);
> >  #define ATTACH_LWP(ptid, verbose) lin_lwp_attach_lwp ((ptid), (verbose))
> > 
> > Index: arch-utils.h
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/arch-utils.h,v
> > retrieving revision 1.41
> > diff -u -p -r1.41 arch-utils.h
> > --- arch-utils.h        24 Aug 2002 00:21:34 -0000      1.41
> > +++ arch-utils.h        30 Aug 2002 22:15:25 -0000
> > @@ -115,8 +115,6 @@ extern CORE_ADDR default_frame_address (
> > 
> >  /* Default prepare_to_procced. */
> > 
> > -extern int default_prepare_to_proceed (int select_it);
> > -
> >  extern int generic_prepare_to_proceed (int select_it);
> > 
> >  /* Versions of init_frame_pc().  Do nothing; do the default. */
> 

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gdbserver
  2002-08-31  5:05     ` gdbserver Daniel Jacobowitz
@ 2002-09-02 18:47       ` Andrew Cagney
  2002-09-02 19:12         ` gdbserver Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Cagney @ 2002-09-02 18:47 UTC (permalink / raw)
  To: Daniel Jacobowitz, Michael Snyder; +Cc: gdb-patches, Van Assche, Bart

> On Fri, Aug 30, 2002 at 04:34:39PM -0700, Michael Snyder wrote:
> 
>> Daniel Jacobowitz wrote:
> 
>> > 
>> > [Bart, please try this patch.]
>> > 
>> > List folks,
>> > 
>> > I think the time has come for generic_prepare_to_proceed to actually be
>> > used.  The problem addressed by this patch is that PREPARE_TO_PROCEED
>> > is not a native-only macro (and not part of the target stack).  So
>> > lin_lwp_prepare_to_proceed would be called when using gdbserver, and of
>> > course trap_ptid would be null_ptid or stale.
>> > generic_prepare_to_proceed works correctly for lin-lwp native
>> > debugging, and for remote debugging.  This patch fixes an incorrect
>> > breakpoint hit after manually switching threads; i.e. the same
>> > breakpoint would be hit a second time.  I'll try to write an
>> > independent test case.
>> > 
>> > Patch look OK?
> 
>> 
>> Of course, a simpler and less intrusive fix would be to simply
>> define PREPARE_TO_PROCEED as generic_prepare_to_proceed, and 
>> remove lin_lwp_prepare_to_proceed.  

Yes (well using set_gdbarch_prepare_to_proceed() :-).  Hmm, things to do 
for someone --- add a linux-tdep.c file?

>> I'm not necessarily objecting to this patch -- just pointing
>> out an alternative.  If people think we're ready for this step, 
>> it's fine with me.
> 
> 
> I think we're ready, but let's wait and see.  For any non-threaded
> target generic_prepare_to_proceed won't do any harm, since it checks
> inferior_ptid != resume_ptid; for threaded targets, some version of
> this function must be better than none.

Post branch, the whole lot can probably be ripped out.

Andrew



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gdbserver
  2002-09-02 18:47       ` gdbserver Andrew Cagney
@ 2002-09-02 19:12         ` Daniel Jacobowitz
  2002-09-03 14:44           ` gdbserver Andrew Cagney
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2002-09-02 19:12 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Michael Snyder, gdb-patches, Van Assche, Bart

On Mon, Sep 02, 2002 at 09:47:24PM -0400, Andrew Cagney wrote:
> >On Fri, Aug 30, 2002 at 04:34:39PM -0700, Michael Snyder wrote:
> >
> >>Daniel Jacobowitz wrote:
> >
> >>> 
> >>> [Bart, please try this patch.]
> >>> 
> >>> List folks,
> >>> 
> >>> I think the time has come for generic_prepare_to_proceed to actually be
> >>> used.  The problem addressed by this patch is that PREPARE_TO_PROCEED
> >>> is not a native-only macro (and not part of the target stack).  So
> >>> lin_lwp_prepare_to_proceed would be called when using gdbserver, and of
> >>> course trap_ptid would be null_ptid or stale.
> >>> generic_prepare_to_proceed works correctly for lin-lwp native
> >>> debugging, and for remote debugging.  This patch fixes an incorrect
> >>> breakpoint hit after manually switching threads; i.e. the same
> >>> breakpoint would be hit a second time.  I'll try to write an
> >>> independent test case.
> >>> 
> >>> Patch look OK?
> >
> >>
> >>Of course, a simpler and less intrusive fix would be to simply
> >>define PREPARE_TO_PROCEED as generic_prepare_to_proceed, and 
> >>remove lin_lwp_prepare_to_proceed.  
> 
> Yes (well using set_gdbarch_prepare_to_proceed() :-).  Hmm, things to do 
> for someone --- add a linux-tdep.c file?

I've got a linux-nat already in my local tree, might as well do a
linux-tdep... but then I'd need to hook this in to all the osabi stuff,
and I'd rather not add it as GNU/Linux-specific only to make it global
after we branch.

Are you saying we should do the less invasive fix as above?  It won't
work unless I move the definition to the tm headers, since this affects
cross targets too.  I'd rather see the default changed as I proposed,
if you're comfortable with it.  Then after the branch we can look at
the other platforms which have their own custom version.

[I'm never quite clear what you mean when you answer a thread with "yes"
 :)]

> >>I'm not necessarily objecting to this patch -- just pointing
> >>out an alternative.  If people think we're ready for this step, 
> >>it's fine with me.
> >
> >
> >I think we're ready, but let's wait and see.  For any non-threaded
> >target generic_prepare_to_proceed won't do any harm, since it checks
> >inferior_ptid != resume_ptid; for threaded targets, some version of
> >this function must be better than none.
> 
> Post branch, the whole lot can probably be ripped out.

Probably.  I don't know if the generic code will work right in HP/UX
but I can't really see why it wouldn't.... I don't suppose you're
interested in ripping out HP/UX period after the branch? :)  We may
have a PA-RISC maintainer now but he didn't sound enthusiastic about
getting HP/UX dumped on him too.



-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gdbserver
  2002-09-02 19:12         ` gdbserver Daniel Jacobowitz
@ 2002-09-03 14:44           ` Andrew Cagney
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Cagney @ 2002-09-03 14:44 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Michael Snyder, gdb-patches, Van Assche, Bart


>> >>Of course, a simpler and less intrusive fix would be to simply
>> >>define PREPARE_TO_PROCEED as generic_prepare_to_proceed, and 
>> >>remove lin_lwp_prepare_to_proceed.  
> 
>> 
>> Yes (well using set_gdbarch_prepare_to_proceed() :-).  Hmm, things to do 
>> for someone --- add a linux-tdep.c file?
> 
> 
> I've got a linux-nat already in my local tree, might as well do a
> linux-tdep... but then I'd need to hook this in to all the osabi stuff,
> and I'd rather not add it as GNU/Linux-specific only to make it global
> after we branch.
> 
> Are you saying we should do the less invasive fix as above?  It won't
> work unless I move the definition to the tm headers, since this affects
> cross targets too.  I'd rather see the default changed as I proposed,
> if you're comfortable with it.  Then after the branch we can look at
> the other platforms which have their own custom version.
> 
> [I'm never quite clear what you mean when you answer a thread with "yes"
>  :)]

I agree with michael.

I'm extreamly nervous about changing the current prepare-to-proceed 
behavour across all targets when the immediate problem is for just 
GNU/Linux.  All this when we're about to branch and so should be 
avoiding significant change.

However, once the branch is cut, I think we should consider simply 
ripping out all the old code and just using the generic version.

In the mean time, for GNU/Linux, isn't it be possible to set it in the 
*-linux-tdep.c files?  If that fails, then I guess an (ULGH and on the 
branch) tm*.h macro.

Andrew



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-09-03 21:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <6703765BD7FDD411AB0900508BFCACD3017D106E@bnbeluimex01.barconet.com>
2002-08-30 16:34 ` gdbserver Daniel Jacobowitz
2002-08-30 16:41   ` gdbserver Michael Snyder
2002-08-31  5:05     ` gdbserver Daniel Jacobowitz
2002-09-02 18:47       ` gdbserver Andrew Cagney
2002-09-02 19:12         ` gdbserver Daniel Jacobowitz
2002-09-03 14:44           ` gdbserver Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox