Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pierre Muller <muller@cerbere.u-strasbg.fr>
To: gdb-patches@sources.redhat.com
Subject: [RFA/RFC] Add i386_cleanup_dregs at program exit.
Date: Wed, 09 Jan 2002 01:13:00 -0000	[thread overview]
Message-ID: <4.2.0.58.20020109091949.00a49380@ics.u-strasbg.fr> (raw)


   A rather long thread started by my
description of a failure to catch hardware watchpoints
on the second run of a linux i386 executable when debugging with 5.1 version.

See
http://sources.redhat.com/ml/gdb-patches/2001-11/msg00613.html
that contains a description of how to reproduce this bug.

The following patch does fix the problem and 
has the further advantage of being multi-target,
so it might well fix the same bug on FreeBSD for example 
(I didn't test if this bug is also present in FreeBSD).
But it isn't multi-arch yet.

The patch simply calls i386_cleanup_dregs
in breakpoint_init_inferior if context is inf_exited.

I have no idea if other processor might need a similar 
cleanup of debug registers, but if there are,
simply setting the HARDWARE_REGISTER_CLEANUP
macro should be enough.

Andrew, how can this be multi-arched ??
Should I add something like 
#ifndef HARDWARE_REGISTER_CLEANUP_P
#define HARDWARE_REGISTER_CLEANUP_P 0
#endif 
#ifndef HARDWARE_REGISTER_CLEANUP
#define HARDWARE_REGISTER_CLEANUP {}
#endif 
and replace the patch in breakpoint.c by
  if (HARDWARE_REGISTER_CLEANUP_P
      && (context == inf_exited))
       HARDWARE_REGISTER_CLEANUP; 

This removes the #ifdef
but full multi-arch probably will require 
to add two new fields to the gdbarch vector ?


  
2002-01-09  Pierre Muller <muller@ics.u-strasbg.fr>

	* breakpoint.c (breakpoint_init_inferior): Call
	HARDWARE_REGISTER_CLEANUP macro if defined
	if context is inf_exited.
	* config/i386/nm-i386.h: Define HARDWARE_REGISTER_CLEANUP
	macro to call i386_cleanup_dregs().

Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.57
diff -u -r1.57 breakpoint.c
--- breakpoint.c        2001/11/11 16:39:59     1.57
+++ breakpoint.c        2002/01/08 23:44:00
@@ -1487,6 +1487,10 @@
        warning ("You must reinsert them explicitly.");
        warning_needed = 0;
      }
+#ifdef HARDWARE_REGISTER_CLEANUP
+  if (context == inf_exited)
+     HARDWARE_REGISTER_CLEANUP;
+#endif
  }

  /* breakpoint_here_p (PC) returns non-zero if an enabled breakpoint
Index: config/i386/nm-i386.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-i386.h,v
retrieving revision 1.2
diff -u -r1.2 nm-i386.h
--- nm-i386.h   2001/03/23 16:17:45     1.2
+++ nm-i386.h   2002/01/08 23:44:01
@@ -115,6 +115,8 @@

  #define DECR_PC_AFTER_HW_BREAK 0

+#define HARDWARE_REGISTER_CLEANUP i386_cleanup_dregs ()
+
  #endif /* I386_USE_GENERIC_WATCHPOINTS */

  #endif /* NM_I386_H */




Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller@ics.u-strasbg.fr
Phone : (33)-3-88-41-40-07  Fax : (33)-3-88-41-40-99


             reply	other threads:[~2002-01-09  9:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-09  1:13 Pierre Muller [this message]
2002-01-09  1:21 ` Eli Zaretskii
2002-01-09  1:25   ` Pierre Muller
2002-01-09  2:19     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4.2.0.58.20020109091949.00a49380@ics.u-strasbg.fr \
    --to=muller@cerbere.u-strasbg.fr \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox