+2020-01-29 Tom de Vries <tdevries@suse.de>
+
+ * gdb.threads/watchpoint-fork-child.c: Guard prints with #if DEBUG.
+ * gdb.threads/watchpoint-fork-mt.c: Same.
+ * gdb.threads/watchpoint-fork-parent.c: Same.
+ * gdb.threads/watchpoint-fork-st.c: Same.
+ * gdb.threads/watchpoint-fork.exp: Compile with DEBUG=0.
+
2020-01-27 Luis Machado <luis.machado@linaro.org>
* gdb.base/step-over-syscall.exp (setup): Check if we're already
case -1:
assert (0);
default:
+#if DEBUG
printf ("parent%d: %d\n", nr, (int) child);
+#endif
/* Sleep for a while to possibly get incorrectly ATTACH_THREADed by GDB
tracing the child fork with no longer valid thread/lwp entries of the
_exit (0);
case 0:
+#if DEBUG
printf ("child%d: %d\n", nr, (int) getpid ());
+#endif
/* Let the parent signal us about its success. Be careful of races. */
int i;
void *thread_result;
+#if DEBUG
setbuf (stdout, NULL);
printf ("main: %d\n", (int) gettid ());
+#endif
/* General hardware breakpoints and watchpoints validity. */
marker ();
case -1:
assert (0);
case 0:
+#if DEBUG
printf ("child%d: %d\n", nr, (int) getpid ());
/* Delay to get both the "child%d" and "parent%d" message printed without
a race breaking expect by its endless wait on `$gdb_prompt$':
(gdb) parent2: 14223 */
i = sleep (1);
assert (i == 0);
+#endif
/* We must not get caught here (against a forgotten breakpoint). */
var++;
_exit (exit_code);
default:
+#if DEBUG
printf ("parent%d: %d\n", nr, (int) child);
/* Delay to get both the "child%d" and "parent%d" message printed, see
above. */
i = sleep (1);
assert (i == 0);
+#endif
pid_got = wait (&status);
assert (pid_got == child);
int
main (void)
{
+#if DEBUG
setbuf (stdout, NULL);
printf ("main: %d\n", (int) getpid ());
+#endif
/* General hardware breakpoints and watchpoints validity. */
marker ();
set testfile watchpoint-fork
+# Set DEBUG to 0 or 1 in sources
+set debug 0
+
proc test {type symbol} {
+ global debug
with_test_prefix "$type" {
global testfile subdir srcdir gdb_prompt
set srcfile_main ${testfile}-st.c
if {[build_executable $testfile.exp $executable \
[list $srcfile_main ${testfile}-${type}.c] \
- [list debug additional_flags=-D$symbol]] == -1} {
+ [list debug additional_flags=-D$symbol \
+ additional_flags=-DDEBUG=$debug]] == -1} {
return -1
}
with_test_prefix "multithreaded" {
set executable ${testfile}-${type}-mt
set srcfile_main ${srcdir}/${subdir}/${testfile}-mt.c
- if { [gdb_compile_pthreads "${srcfile_main} ${srcfile_type}" [standard_output_file ${executable}] executable [list debug "additional_flags=-D$symbol -DTHREAD"]] != "" } {
+ if { [gdb_compile_pthreads "${srcfile_main} ${srcfile_type}" \
+ [standard_output_file ${executable}] executable \
+ [list debug "additional_flags=-D$symbol" \
+ "additional_flags=-DDEBUG=$debug" \
+ "-DTHREAD"]] != "" } {
untested "failed to compile"
return
}