- Fix PPC software watchpoints active while stepping atomic instr. (BZ

237572).
This commit is contained in:
Jan Kratochvil 2007-06-26 04:37:05 +00:00
parent 5a72cdabf8
commit c78c51c0de
4 changed files with 98 additions and 82 deletions

View File

@ -1,7 +1,10 @@
Index: gdb-6.6/gdb/testsuite/gdb.threads/atomic-seq-threaded.c 2007-06-25 Jan Kratochvil <jan.kratochvil@redhat.com>
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000 * gdb.threads/atomic-seq-threaded.c,
+++ gdb-6.6/gdb/testsuite/gdb.threads/atomic-seq-threaded.c 2007-06-18 20:24:04.000000000 +0200 gdb.threads/atomic-seq-threaded.exp: New files.
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.threads/atomic-seq-threaded.c 25 Jun 2007 20:38:21 -0000
@@ -0,0 +1,171 @@ @@ -0,0 +1,171 @@
+/* This testcase is part of GDB, the GNU debugger. +/* This testcase is part of GDB, the GNU debugger.
+ +
@ -163,22 +166,20 @@ Index: gdb-6.6/gdb/testsuite/gdb.threads/atomic-seq-threaded.c
+ int i; + int i;
+ +
+ i = pthread_create (&thread, NULL, start1, NULL); /* _create_ */ + i = pthread_create (&thread, NULL, start1, NULL); /* _create_ */
+ assert (i == 0); /* _create_behind_ */ + assert (i == 0); /* _create_after_ */
+ +
+ sleep(1); + sleep (1);
+ +
+ start2 (NULL); + start2 (NULL);
+ +
+ i = pthread_join (thread, NULL); /* _delete_ */ + i = pthread_join (thread, NULL); /* _delete_ */
+ assert (i == 0); + assert (i == 0);
+ +
+ return 0; /* _success_ */ + return 0; /* _exit_ */
+} +}
Index: gdb-6.6/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp --- /dev/null 1 Jan 1970 00:00:00 -0000
=================================================================== +++ ./gdb/testsuite/gdb.threads/atomic-seq-threaded.exp 25 Jun 2007 20:38:21 -0000
--- /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -0,0 +1,84 @@
+++ gdb-6.6/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp 2007-06-18 20:24:04.000000000 +0200
@@ -0,0 +1,110 @@
+# atomic-seq-threaded.exp -- Test case for stepping over RISC atomic code seqs. +# atomic-seq-threaded.exp -- Test case for stepping over RISC atomic code seqs.
+# This variant testcases the code for stepping another thread while skipping +# This variant testcases the code for stepping another thread while skipping
+# over the atomic sequence in the former thread +# over the atomic sequence in the former thread
@ -226,15 +227,14 @@ Index: gdb-6.6/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp
+} +}
+ +
+# pthread_create () will not pass even on x86_64 with software watchpoint. +# pthread_create () will not pass even on x86_64 with software watchpoint.
+# Skip behind pthread_create () without any watchpoint active. +# Pass after pthread_create () without any watchpoint active.
+ +set line [gdb_get_line_number "_create_after_"]
+set line [gdb_get_line_number "_create_behind_"]
+gdb_test "tbreak $line" \ +gdb_test "tbreak $line" \
+ "Breakpoint (\[0-9\]+) at .*$srcfile, line $line\..*" \ + "Breakpoint (\[0-9\]+) at .*$srcfile, line $line\..*" \
+ "set breakpoint behind pthread_create ()" + "set breakpoint after pthread_create ()"
+gdb_test "c" \ +gdb_test "c" \
+ ".*/\\* _create_behind_ \\*/.*" \ + ".*/\\* _create_after_ \\*/.*" \
+ "run till behind pthread_create ()" + "run till after pthread_create ()"
+ +
+# Without a watchpoint being software no single-stepping would be used. +# Without a watchpoint being software no single-stepping would be used.
+set test "Start (software) watchpoint" +set test "Start (software) watchpoint"
@ -247,45 +247,20 @@ Index: gdb-6.6/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp
+ unsupported $test + unsupported $test
+ } + }
+} +}
+gdb_test "set \$watchnum=\$bpnum" "" "Store the watchpoint number"
+ +
+# pthread_join () will not pass even on x86_64 with software watchpoint. +# More thorough testing of the scheduling logic.
+# Now pass the __sync_* () functions and remove the watchpoint. +gdb_test "set scheduler-locking step" ""
+ +
+#set line [gdb_get_line_number "_delete_"] +# Critical code path is stepped through at this point.
+#gdb_test "break $line" \ +set line [gdb_get_line_number "_exit_"]
+# "Breakpoint \[0-9\]+ at .*$srcfile, line $line\..*" \
+# "set breakpoint at _delete_"
+#gdb_test "set \$deletenum=\$bpnum" "" "Store the _delete_ breakpoint number"
+#set line1 [gdb_get_line_number "_delete1_"]
+#gdb_test "break $line1" \
+# "Breakpoint \[0-9\]+ at .*$srcfile, line $line1\..*" \
+# "set breakpoint at _delete1_"
+#gdb_test "set \$delete1num=\$bpnum" "" "Store the _delete1_ breakpoint number"
+#set line2 [gdb_get_line_number "_delete2_"]
+#gdb_test "break $line2" \
+# "Breakpoint \[0-9\]+ at .*$srcfile, line $line2\..*" \
+# "set breakpoint at _delete2_"
+#gdb_test "set \$delete2num=\$bpnum" "" "Store the _delete2_ breakpoint number"
+#gdb_test "c" \
+# ".*/\\* (_delete_|_delete1_|_delete2_) \\*/.*" \
+# "run till (_delete_|_delete1_|_delete2_)"
+#gdb_test "delete \$watchnum" "" "Delete the watchpoint"
+#gdb_test "delete \$deletenum" "" "Delete the _delete_ breakpoint"
+#gdb_test "delete \$delete1num" "" "Delete the _delete1_ breakpoint"
+#gdb_test "delete \$delete2num" "" "Delete the _delete2_ breakpoint"
+
+# Pass pthread_join () without the software watchpoint being active.
+
+set line [gdb_get_line_number "_success_"]
+gdb_test "tbreak $line" \ +gdb_test "tbreak $line" \
+ "Breakpoint \[0-9\]+ at .*$srcfile, line $line\..*" \ + "Breakpoint \[0-9\]+ at .*$srcfile, line $line\..*" \
+ "set breakpoint at _success_" + "set breakpoint at _exit_"
+set timeout 1800
+gdb_test "c" \ +gdb_test "c" \
+ ".*/\\* _success_ \\*/.*" \ + ".*/\\* _exit_ \\*/.*" \
+ "run till _success_" + "run till _exit_"
+ +
+# Just a nonproblematic program exit.
+gdb_test "c" \ +gdb_test "c" \
+ ".*Program exited normally\\..*" \ + ".*Program exited normally\\..*" \
+ "run till program exit" + "run till program exit"

View File

@ -0,0 +1,11 @@
--- ./gdb/infrun.c 22 Jun 2007 12:47:48 -0000 1.243
+++ ./gdb/infrun.c 25 Jun 2007 20:43:18 -0000
@@ -466,7 +467,7 @@ static const char *scheduler_enums[] = {
schedlock_step,
NULL
};
-static const char *scheduler_mode = schedlock_off;
+static const char *scheduler_mode = schedlock_step;
static void
show_scheduler_mode (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)

View File

@ -1,10 +1,19 @@
Index: ./gdb/inferior.h 2007-06-25 Jan Kratochvil <jan.kratochvil@redhat.com>
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v * inferior.h (enum resume_step): New definition.
retrieving revision 1.83 (resume): Change STEP parameter type to ENUM RESUME_STEP.
diff -u -p -r1.83 inferior.h * infrun.c (resume): Likewise. Extend debug printing of the STEP
parameter. Lock the scheduler only for intentional stepping.
(proceed): Replace the variable ONESTEP with tristate RESUME_STEP.
Set the third RESUME_STEP state according to BPSTAT_SHOULD_STEP.
(currently_stepping): Change the return type to ENUM RESUME_STEP.
Return RESUME_STEP_NEEDED if it is just due to BPSTAT_SHOULD_STEP.
* linux-nat.c (select_singlestep_lwp_callback): Do not focus on
the software watchpoint events.
* linux-nat.h (struct lwp_info): Redeclare STEP as ENUM RESUME_STEP.
--- ./gdb/inferior.h 15 Jun 2007 22:44:55 -0000 1.83 --- ./gdb/inferior.h 15 Jun 2007 22:44:55 -0000 1.83
+++ ./gdb/inferior.h 19 Jun 2007 07:14:04 -0000 +++ ./gdb/inferior.h 25 Jun 2007 20:33:02 -0000
@@ -194,7 +194,15 @@ extern void reopen_exec_file (void); @@ -194,7 +194,15 @@ extern void reopen_exec_file (void);
/* The `resume' routine should only be called in special circumstances. /* The `resume' routine should only be called in special circumstances.
Normally, use `proceed', which handles a lot of bookkeeping. */ Normally, use `proceed', which handles a lot of bookkeeping. */
@ -22,13 +31,8 @@ diff -u -p -r1.83 inferior.h
/* From misc files */ /* From misc files */
Index: ./gdb/infrun.c --- ./gdb/infrun.c 22 Jun 2007 12:47:48 -0000 1.243
=================================================================== +++ ./gdb/infrun.c 25 Jun 2007 20:33:02 -0000
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.241
diff -u -p -r1.241 infrun.c
--- ./gdb/infrun.c 18 Jun 2007 18:23:08 -0000 1.241
+++ ./gdb/infrun.c 19 Jun 2007 07:14:32 -0000
@@ -76,7 +76,8 @@ static void set_schedlock_func (char *ar @@ -76,7 +76,8 @@ static void set_schedlock_func (char *ar
struct execution_control_state; struct execution_control_state;
@ -39,15 +43,6 @@ diff -u -p -r1.241 infrun.c
static void xdb_handle_command (char *args, int from_tty); static void xdb_handle_command (char *args, int from_tty);
@@ -466,7 +467,7 @@ static const char *scheduler_enums[] = {
schedlock_step,
NULL
};
-static const char *scheduler_mode = schedlock_off;
+static const char *scheduler_mode = schedlock_step;
static void
show_scheduler_mode (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
@@ -496,15 +497,18 @@ set_schedlock_func (char *args, int from @@ -496,15 +497,18 @@ set_schedlock_func (char *args, int from
STEP nonzero if we should step (zero to continue instead). STEP nonzero if we should step (zero to continue instead).
SIG is the signal to give the inferior (zero for none). */ SIG is the signal to give the inferior (zero for none). */
@ -70,9 +65,12 @@ diff -u -p -r1.241 infrun.c
/* FIXME: calling breakpoint_here_p (read_pc ()) three times! */ /* FIXME: calling breakpoint_here_p (read_pc ()) three times! */
@@ -595,7 +599,8 @@ a command like `return' or `jump' to con @@ -593,9 +597,10 @@ a command like `return' or `jump' to con
resume_ptid = inferior_ptid;
}
if ((scheduler_mode == schedlock_on) - if ((scheduler_mode == schedlock_on)
+ if (scheduler_mode == schedlock_on
|| (scheduler_mode == schedlock_step || (scheduler_mode == schedlock_step
- && (step || singlestep_breakpoints_inserted_p))) - && (step || singlestep_breakpoints_inserted_p)))
+ && (step == RESUME_STEP_USER + && (step == RESUME_STEP_USER
@ -80,7 +78,7 @@ diff -u -p -r1.241 infrun.c
{ {
/* User-settable 'scheduler' mode requires solo thread resume. */ /* User-settable 'scheduler' mode requires solo thread resume. */
resume_ptid = inferior_ptid; resume_ptid = inferior_ptid;
@@ -705,7 +710,8 @@ static CORE_ADDR prev_pc; @@ -711,7 +716,8 @@ static CORE_ADDR prev_pc;
void void
proceed (CORE_ADDR addr, enum target_signal siggnal, int step) proceed (CORE_ADDR addr, enum target_signal siggnal, int step)
{ {
@ -90,7 +88,7 @@ diff -u -p -r1.241 infrun.c
if (step > 0) if (step > 0)
step_start_function = find_pc_function (read_pc ()); step_start_function = find_pc_function (read_pc ());
@@ -719,13 +725,13 @@ proceed (CORE_ADDR addr, enum target_sig @@ -725,13 +731,13 @@ proceed (CORE_ADDR addr, enum target_sig
step one instruction before inserting breakpoints so that step one instruction before inserting breakpoints so that
we do not stop right away (and report a second hit at this we do not stop right away (and report a second hit at this
breakpoint). */ breakpoint). */
@ -106,7 +104,7 @@ diff -u -p -r1.241 infrun.c
} }
else else
{ {
@@ -749,9 +755,9 @@ proceed (CORE_ADDR addr, enum target_sig @@ -755,9 +761,9 @@ proceed (CORE_ADDR addr, enum target_sig
that reported the most recent event. If a step-over is required that reported the most recent event. If a step-over is required
it returns TRUE and sets the current thread to the old thread. */ it returns TRUE and sets the current thread to the old thread. */
if (prepare_to_proceed () && breakpoint_here_p (read_pc ())) if (prepare_to_proceed () && breakpoint_here_p (read_pc ()))
@ -118,7 +116,7 @@ diff -u -p -r1.241 infrun.c
/* We will get a trace trap after one instruction. /* We will get a trace trap after one instruction.
Continue it automatically and insert breakpoints then. */ Continue it automatically and insert breakpoints then. */
trap_expected = 1; trap_expected = 1;
@@ -800,8 +806,11 @@ proceed (CORE_ADDR addr, enum target_sig @@ -806,8 +812,11 @@ proceed (CORE_ADDR addr, enum target_sig
updated correctly when the inferior is stopped. */ updated correctly when the inferior is stopped. */
prev_pc = read_pc (); prev_pc = read_pc ();
@ -131,7 +129,7 @@ diff -u -p -r1.241 infrun.c
/* Wait for it to stop (if not standalone) /* Wait for it to stop (if not standalone)
and in any case decode why it stopped, and act accordingly. */ and in any case decode why it stopped, and act accordingly. */
@@ -2695,14 +2704,20 @@ process_event_stop_test: @@ -2681,14 +2690,20 @@ process_event_stop_test:
/* Are we in the middle of stepping? */ /* Are we in the middle of stepping? */
@ -158,3 +156,30 @@ diff -u -p -r1.241 infrun.c
} }
/* Subroutine call with source code we should not step over. Do step /* Subroutine call with source code we should not step over. Do step
--- ./gdb/linux-nat.c 16 Jun 2007 17:16:25 -0000 1.64
+++ ./gdb/linux-nat.c 25 Jun 2007 20:33:02 -0000
@@ -1720,7 +1720,10 @@ count_events_callback (struct lwp_info *
static int
select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
{
- if (lp->step && lp->status != 0)
+ /* We do not focus on software watchpoints as we would not catch
+ STEPPING_PAST_SINGLESTEP_BREAKPOINT breakpoints in some other thread
+ as they would remain pending due to `Push back breakpoint for %s'. */
+ if (lp->step == RESUME_STEP_USER && lp->status != 0)
return 1;
else
return 0;
--- ./gdb/linux-nat.h 10 May 2007 21:36:00 -0000 1.18
+++ ./gdb/linux-nat.h 25 Jun 2007 20:33:02 -0000
@@ -53,8 +53,8 @@ struct lwp_info
/* If non-zero, a pending wait status. */
int status;
- /* Non-zero if we were stepping this LWP. */
- int step;
+ /* The kind of stepping of this LWP. */
+ enum resume_step step;
/* If WAITSTATUS->KIND != TARGET_WAITKIND_SPURIOUS, the waitstatus
for this LWP's last event. This may correspond to STATUS above,

View File

@ -11,7 +11,7 @@ Name: gdb
Version: 6.6 Version: 6.6
# The release always contains a leading reserved number, start it at 1. # The release always contains a leading reserved number, start it at 1.
Release: 17%{?dist} Release: 18%{?dist}
License: GPL License: GPL
Group: Development/Debuggers Group: Development/Debuggers
@ -74,9 +74,10 @@ Patch108: gdb-6.3-ppc64section-20041026.patch
# correct symbol is found. # correct symbol is found.
Patch111: gdb-6.3-ppc64displaysymbol-20041124.patch Patch111: gdb-6.3-ppc64displaysymbol-20041124.patch
# Use upstream `set scheduler-locking step' as default.
# Fix upstream `set scheduler-locking step' vs. upstream PPC atomic seqs. # Fix upstream `set scheduler-locking step' vs. upstream PPC atomic seqs.
Patch112: gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch Patch112: gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch
# Make upstream `set scheduler-locking step' as default.
Patch260: gdb-6.6-scheduler_locking-step-is-default.patch
# Threaded watchpoint support # Threaded watchpoint support
Patch113: gdb-6.3-threaded-watchpoints-20041213.patch Patch113: gdb-6.3-threaded-watchpoints-20041213.patch
@ -503,6 +504,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch256 -p1 %patch256 -p1
%patch257 -p1 %patch257 -p1
%patch258 -p1 %patch258 -p1
%patch260 -p1
# Change the version that gets printed at GDB startup, so it is RedHat # Change the version that gets printed at GDB startup, so it is RedHat
# specific. # specific.
@ -652,6 +654,9 @@ fi
# don't include the files in include, they are part of binutils # don't include the files in include, they are part of binutils
%changelog %changelog
* Tue Jun 26 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-18
- Fix PPC software watchpoints active while stepping atomic instr. (BZ 237572).
* Thu Jun 21 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-17 * Thu Jun 21 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-17
- Support for stepping over PPC atomic instruction sequences (BZ 237572). - Support for stepping over PPC atomic instruction sequences (BZ 237572).
- `set scheduler-locking step' is no longer enforced but it is now default. - `set scheduler-locking step' is no longer enforced but it is now default.