Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@gnat.com>
To: Andrew Cagney <ac131313@ges.redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] enable software single step on alpha-osf
Date: Fri, 16 Aug 2002 17:58:00 -0000	[thread overview]
Message-ID: <20020817005803.GH911@gnat.com> (raw)
In-Reply-To: <3D5D875F.6050405@ges.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1368 bytes --]

Following Andrew's suggestion, here is a revised patch to provide
software single stepping on alpha-osf1, plus fix all the quirks that
appeared after the switch.

I know the alpha-osf1-tdep.c change is approved, but since I haven't
committed it yet, I am including it in this patch for completeness.

No regression on alpha-osf1 (SW single step enabled) and on x86-linux
(sw single step disabled):

2002-07-18  Joel Brobecker  <brobecker@gnat.com>

        * alpha-osf1-tdep.c (alpha_osf1_init_abi): Unfortunately,
        procfs appears to be broken when debugging on multi-processor
        machines. So enable software single stepping in order to avoid
        using the procfs interface to do next/step operations, using
        internal breakpoints instead.

        * infrun.c (handle_inferior_event): Readjust the stop_pc by
        DECR_PC_AFTER_BREAK when hitting a single step breakpoint, to
        make this pc address equal to the value it would have if the
        system stepping capability was used. Also set a new flag used
        to ensure that we don't readjust the PC one more time later.

        * breakpoint.c (bpstat_stop_status): Do not adjust the PC
        address by DECR_PC_AFTER_BREAK when software single step is
        in use for this architecture, as this has already been taken
        care of in handle_inferior_event().

-- 
Joel

[-- Attachment #2: sw_single_step.diff --]
[-- Type: text/plain, Size: 4935 bytes --]

Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.66
diff -c -3 -p -r1.66 infrun.c
*** infrun.c	17 Aug 2002 00:16:54 -0000	1.66
--- infrun.c	17 Aug 2002 00:49:19 -0000
*************** handle_inferior_event (struct execution_
*** 1408,1413 ****
--- 1408,1414 ----
  {
    CORE_ADDR tmp;
    int stepped_after_stopped_by_watchpoint;
+   int sw_single_step_trap_p = 0;
  
    /* Cache the last pid/waitstatus. */
    target_last_wait_ptid = ecs->ptid;
*************** handle_inferior_event (struct execution_
*** 1888,1893 ****
--- 1889,1906 ----
  	}
        else if (SOFTWARE_SINGLE_STEP_P () && singlestep_breakpoints_inserted_p)
          {
+           /* Readjust the stop_pc as it is off by DECR_PC_AFTER_BREAK
+              compared to the value it would have if the system stepping
+              capability was used. This allows the rest of the code in
+              this function to use this address without having to worry
+              whether software single step is in use or not.  */
+           if (DECR_PC_AFTER_BREAK)
+             {
+               stop_pc -= DECR_PC_AFTER_BREAK;
+               write_pc_pid (stop_pc, ecs->ptid);
+             }
+ 
+           sw_single_step_trap_p = 1;
            ecs->random_signal = 0;
          }
      }
*************** handle_inferior_event (struct execution_
*** 2111,2124 ****
                (&stop_pc,
                 /* Pass TRUE if our reason for stopping is something other
                    than hitting a breakpoint.  We do this by checking that
                    1) stepping is going on and 2) we didn't hit a breakpoint
                    in a signal handler without an intervening stop in
                    sigtramp, which is detected by a new stack pointer value
                    below any usual function calling stack adjustments.  */
!                (currently_stepping (ecs)
!                 && prev_pc != stop_pc - DECR_PC_AFTER_BREAK
!                 && !(step_range_end
!                      && INNER_THAN (read_sp (), (step_sp - 16)))));
  	  /* Following in case break condition called a
  	     function.  */
  	  stop_print_frame = 1;
--- 2124,2139 ----
                (&stop_pc,
                 /* Pass TRUE if our reason for stopping is something other
                    than hitting a breakpoint.  We do this by checking that
+                   either we detected earlier a software single step trap or
                    1) stepping is going on and 2) we didn't hit a breakpoint
                    in a signal handler without an intervening stop in
                    sigtramp, which is detected by a new stack pointer value
                    below any usual function calling stack adjustments.  */
!                sw_single_step_trap_p
!                || (currently_stepping (ecs)
!                    && prev_pc != stop_pc - DECR_PC_AFTER_BREAK
!                    && !(step_range_end
!                         && INNER_THAN (read_sp (), (step_sp - 16)))));
  	  /* Following in case break condition called a
  	     function.  */
  	  stop_print_frame = 1;
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.79
diff -c -3 -p -r1.79 breakpoint.c
*** breakpoint.c	16 Aug 2002 15:37:54 -0000	1.79
--- breakpoint.c	17 Aug 2002 00:49:20 -0000
*************** bpstat_stop_status (CORE_ADDR *pc, int n
*** 2429,2436 ****
       trace/singlestep trap event, we would not want to subtract
       DECR_PC_AFTER_BREAK from the PC. */
  
!   bp_addr = *pc - (not_a_sw_breakpoint && !SOFTWARE_SINGLE_STEP_P () ? 
!                    0 : DECR_PC_AFTER_BREAK);
  
    ALL_BREAKPOINTS_SAFE (b, temp)
    {
--- 2429,2435 ----
       trace/singlestep trap event, we would not want to subtract
       DECR_PC_AFTER_BREAK from the PC. */
  
!   bp_addr = *pc - (not_a_sw_breakpoint ? 0 : DECR_PC_AFTER_BREAK);
  
    ALL_BREAKPOINTS_SAFE (b, temp)
    {
Index: alpha-osf1-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alpha-osf1-tdep.c,v
retrieving revision 1.5
diff -c -3 -p -r1.5 alpha-osf1-tdep.c
*** alpha-osf1-tdep.c	21 May 2002 15:36:02 -0000	1.5
--- alpha-osf1-tdep.c	17 Aug 2002 00:49:20 -0000
*************** alpha_osf1_init_abi (struct gdbarch_info
*** 58,63 ****
--- 58,67 ----
    struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
  
    set_gdbarch_pc_in_sigtramp (gdbarch, alpha_osf1_pc_in_sigtramp);
+   /* The next/step support via procfs on OSF1 is broken when running
+      on multi-processor machines. We need to use software single stepping
+      instead.  */
+   set_gdbarch_software_single_step (gdbarch, alpha_software_single_step);
  
    tdep->skip_sigtramp_frame = alpha_osf1_skip_sigtramp_frame;
    tdep->sigcontext_addr = alpha_osf1_sigcontext_addr;

  reply	other threads:[~2002-08-17  0:58 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-18 13:55 Joel Brobecker
2002-07-22  4:19 ` Eli Zaretskii
2002-07-25 16:38 ` Andrew Cagney
2002-07-26 10:17   ` Jason R Thorpe
2002-07-31 10:28     ` Joel Brobecker
2002-08-04 16:42 ` Andrew Cagney
2002-08-05 11:49   ` Joel Brobecker
2002-08-05 20:01     ` Andrew Cagney
2002-08-16 10:11     ` Andrew Cagney
2002-08-16 11:21       ` Joel Brobecker
2002-08-16 12:11         ` Andrew Cagney
2002-08-16 12:26           ` Daniel Jacobowitz
2002-08-16 12:40             ` Kevin Buettner
2002-08-16 14:40               ` Peter.Schauer
2002-08-16 12:41             ` Andrew Cagney
2002-08-16 16:05         ` Joel Brobecker
2002-08-16 16:45           ` Andrew Cagney
2002-08-16 17:58             ` Joel Brobecker [this message]
2002-08-16 18:23               ` Andrew Cagney
2002-08-16 23:29                 ` Joel Brobecker
2002-08-20  8:55                   ` Joel Brobecker
2002-08-20 17:29                     ` Andrew Cagney
2002-08-20 19:14                       ` Daniel Jacobowitz
2002-08-21  7:01                         ` Joel Brobecker

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=20020817005803.GH911@gnat.com \
    --to=brobecker@gnat.com \
    --cc=ac131313@ges.redhat.com \
    --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