public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/8] pass gdb.btrace with clang
@ 2021-02-04  8:10 Markus Metzger
  2021-02-04  8:10 ` [PATCH 1/2] gdb, btrace: fix hang when stepping over a breakpoint at the end of the trace Markus Metzger
                   ` (11 more replies)
  0 siblings, 12 replies; 16+ messages in thread
From: Markus Metzger @ 2021-02-04  8:10 UTC (permalink / raw)
  To: gdb-patches

I noticed a number of fails when running gdb.btrace with clang instead of gcc
due to different diagnostics, different defaults, or slightly different debug
information.

Markus Metzger (8):
  testsuite: extend nopie handling to add -fno-pie to compiler flags
  testsuite, gdb.btrace: remove assembly-check in delta.exp
  testsuite, gdb.btrace: pass rn-dl-bind.exp with clang
  testsuite, gdb.btrace: move -Wl,-x to ldflags
  testsuite, gdb.btrace: adjust expected output to pass with clang
  testsuite, gdb.btrace: remove implicit debug option in stepi.exp
  testsuite, gdb.btrace: adjust expected source line in non-stop.exp
  gdb, testsuite: enforce lazy binding for gdb.btrace/rn-dl-bind.exp

 gdb/testsuite/README                          |  5 +++
 gdb/testsuite/gdb.btrace/delta.exp            |  9 +-----
 gdb/testsuite/gdb.btrace/exception.cc         |  6 +++-
 gdb/testsuite/gdb.btrace/exception.exp        | 26 ++++++++++------
 .../gdb.btrace/function_call_history.exp      | 20 ++++++------
 gdb/testsuite/gdb.btrace/non-stop.exp         |  4 +--
 gdb/testsuite/gdb.btrace/rn-dl-bind.exp       | 31 +++++++++++++------
 gdb/testsuite/gdb.btrace/stepi.exp            |  2 +-
 .../gdb.btrace/unknown_functions.exp          |  2 +-
 gdb/testsuite/lib/gdb.exp                     | 15 ++++++---
 10 files changed, 73 insertions(+), 47 deletions(-)

-- 
2.26.2

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* [PATCH 1/2] gdb, btrace: fix hang when stepping over a breakpoint at the end of the trace
  2021-02-04  8:10 [PATCH 0/8] pass gdb.btrace with clang Markus Metzger
@ 2021-02-04  8:10 ` Markus Metzger
  2021-02-04  8:10 ` [PATCH 1/8] testsuite: extend nopie handling to add -fno-pie to compiler flags Markus Metzger
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Markus Metzger @ 2021-02-04  8:10 UTC (permalink / raw)
  To: gdb-patches

When trying to step over a breakopint at the end of the trace, the
step-over will fail with no-history.  This does not clear step_over_info
so a subsequent resume will cause GDB to not resume the thread and expect
a SIGTRAP to complete the step-over.  This will never come causing GDB to
hang in the wait-for-event poll.

That step-over failed after actually completing the step.  This is wrong.
Fix it by moving the end of execution history check to before we are
stepping.

This exposes another issue, however.  When completing a step-over at the
end of the execution history, we implicitly stop replaying that thread.  A
continue command would resume after the step-over and, since we're no
longer replaying, would continue recording.

Fix that by recording the replay state in the thread's control state and
failing with no-history in keep_going if we're switching from replay to
recording.

gdb/ChangeLog:
2021-01-14  Markus Metzger  <markus.t.metzger@intel.com>

	* gdbthread.h (struct thread_control_state) <is_replaying>: New.
	* infrun.c (clear_proceed_status_thread): Set
	thread_control_state.is_replaying.
	(keep_going_pass_signal): Check thread_control_state.is_replaying.
	* record-btrace.c (record_btrace_single_step_forward): Move end of
	execution history check.

gdb/testsuite/ChangeLog:
2021-01-13  Markus Metzger  <markus.t.metzger@intel.com>

	* gdb.btrace/cont-hang.exp: New file.
	* gdb.btrace/step-hang.exp: New file.
---
 gdb/gdbthread.h                        |  3 ++
 gdb/infrun.c                           | 22 +++++++++++
 gdb/record-btrace.c                    | 19 ++++-----
 gdb/testsuite/gdb.btrace/cont-hang.exp | 49 +++++++++++++++++++++++
 gdb/testsuite/gdb.btrace/step-hang.exp | 48 ++++++++++++++++++++++
 gdb/testsuite/gdb.btrace/stepn.exp     | 55 ++++++++++++++++++++++++++
 6 files changed, 187 insertions(+), 9 deletions(-)
 create mode 100644 gdb/testsuite/gdb.btrace/cont-hang.exp
 create mode 100644 gdb/testsuite/gdb.btrace/step-hang.exp
 create mode 100644 gdb/testsuite/gdb.btrace/stepn.exp

diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index eef37f79e6a..563b7bd8954 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -159,6 +159,9 @@ struct thread_control_state
      command.  This is used to decide whether "set scheduler-locking
      step" behaves like "on" or "off".  */
   int stepping_command = 0;
+
+  /* Whether the thread was replaying when the command was issued.  */
+  bool is_replaying = false;
 };
 
 /* Inferior thread specific part of `struct infcall_suspend_state'.  */
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 6ec269adaa8..21513344be1 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2658,6 +2658,8 @@ clear_proceed_status_thread (struct thread_info *tp)
 
   /* Discard any remaining commands or status from previous stop.  */
   bpstat_clear (&tp->control.stop_bpstat);
+
+  tp->control.is_replaying = target_record_is_replaying (tp->ptid);
 }
 
 void
@@ -7813,6 +7815,26 @@ keep_going_pass_signal (struct execution_control_state *ecs)
   gdb_assert (ecs->event_thread->ptid == inferior_ptid);
   gdb_assert (!ecs->event_thread->resumed);
 
+  /* When a thread reaches the end of its execution history, it automatically
+     stops replaying.  This is so the user doesn't need to explicitly stop it
+     with a separate command.
+
+     We do not want a single command (e.g. continue) to transition from
+     replaying to recording, though, e.g. when starting from a breakpoint we
+     needed to step over at the end of the trace.  When we reach the end of the
+     execution history during stepping, stop with no-history.
+
+     The other direction is fine.  When we're at the end of the execution
+     history, we may reverse-continue to start replaying.  */
+  if (ecs->event_thread->control.is_replaying
+      && !target_record_is_replaying (ecs->event_thread->ptid))
+    {
+      gdb::observers::no_history.notify ();
+      stop_waiting (ecs);
+      normal_stop ();
+      return;
+    }
+
   /* Save the pc before execution, to compare with pc after stop.  */
   ecs->event_thread->prev_pc
     = regcache_read_pc_protected (get_thread_regcache (ecs->event_thread));
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 81686ee867b..c309b0dc8e4 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -2350,6 +2350,16 @@ record_btrace_single_step_forward (struct thread_info *tp)
   if (replay == NULL)
     return btrace_step_no_history ();
 
+  /* The execution trace contains (and ends with) the current instruction.
+     This instruction has not been executed, yet, so the trace really ends
+     one instruction earlier.
+
+     We'd fail later on in btrace_insn_next () but we must not trigger
+     breakpoints as we're not really able to step.  */
+  btrace_insn_end (&end, btinfo);
+  if (btrace_insn_cmp (replay, &end) == 0)
+    return btrace_step_no_history ();
+
   /* Check if we're stepping a breakpoint.  */
   if (record_btrace_replay_at_breakpoint (tp))
     return btrace_step_stopped ();
@@ -2372,15 +2382,6 @@ record_btrace_single_step_forward (struct thread_info *tp)
     }
   while (btrace_insn_get (replay) == NULL);
 
-  /* Determine the end of the instruction trace.  */
-  btrace_insn_end (&end, btinfo);
-
-  /* The execution trace contains (and ends with) the current instruction.
-     This instruction has not been executed, yet, so the trace really ends
-     one instruction earlier.  */
-  if (btrace_insn_cmp (replay, &end) == 0)
-    return btrace_step_no_history ();
-
   return btrace_step_spurious ();
 }
 
diff --git a/gdb/testsuite/gdb.btrace/cont-hang.exp b/gdb/testsuite/gdb.btrace/cont-hang.exp
new file mode 100644
index 00000000000..44539a7d7b7
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/cont-hang.exp
@@ -0,0 +1,49 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2021 Free Software Foundation, Inc.
+#
+# Contributed by Intel Corp. <markus.t.metzger@intel.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test that we do not hang when trying to continue over a breakpoint at
+# the end of the trace.
+
+if { [skip_btrace_tests] } {
+    unsupported "target does not support record-btrace"
+    return -1
+}
+
+standard_testfile record_goto.c
+if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
+    return -1
+}
+
+if ![runto_main] {
+    untested "failed to run to main"
+    return -1
+}
+
+# trace the call to the test function.
+gdb_test_no_output "record btrace"
+gdb_test "next" "main\.3.*"
+
+# we need to be replaying, otherwise, we'd just continue recording.
+gdb_test "reverse-stepi"
+gdb_test "break"
+
+# continuing will step over the breakpoint and then run into the end of
+# the execution history.  this ends replay, so we can continue recording.
+gdb_test "continue" "No more reverse-execution history.*"
+gdb_continue_to_end
diff --git a/gdb/testsuite/gdb.btrace/step-hang.exp b/gdb/testsuite/gdb.btrace/step-hang.exp
new file mode 100644
index 00000000000..81d9757e0ab
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/step-hang.exp
@@ -0,0 +1,48 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2021 Free Software Foundation, Inc.
+#
+# Contributed by Intel Corp. <markus.t.metzger@intel.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test that we do not hang when trying to step over a breakpoint at the
+# end of the trace.
+
+if { [skip_btrace_tests] } {
+    unsupported "target does not support record-btrace"
+    return -1
+}
+
+standard_testfile record_goto.c
+if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
+    return -1
+}
+
+if ![runto_main] {
+    untested "failed to run to main"
+    return -1
+}
+
+# trace the call to the test function.
+gdb_test_no_output "record btrace"
+gdb_test "next" "main\.3.*"
+
+# we need to be replaying, otherwise, we'd just continue recording.
+gdb_test "reverse-stepi"
+gdb_test "break"
+
+# stepping over the breakpoint ends replaying and we can continue recording.
+gdb_test "step"  "main\.3.*"
+gdb_continue_to_end
diff --git a/gdb/testsuite/gdb.btrace/stepn.exp b/gdb/testsuite/gdb.btrace/stepn.exp
new file mode 100644
index 00000000000..4e6cd4c1aed
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/stepn.exp
@@ -0,0 +1,55 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2021 Free Software Foundation, Inc.
+#
+# Contributed by Intel Corp. <markus.t.metzger@intel.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test that step n does not start recording when issued while replaying.
+
+if { [skip_btrace_tests] } {
+    unsupported "target does not support record-btrace"
+    return -1
+}
+
+standard_testfile record_goto.c
+if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
+    return -1
+}
+
+if ![runto_main] {
+    untested "failed to run to main"
+    return -1
+}
+
+# trace the call to the test function.
+gdb_test_no_output "record btrace"
+gdb_test "next" "main\.3.*"
+
+# stepping should bring us to the end of the execution history, but not beyond.
+with_test_prefix "stepi" {
+    gdb_test "reverse-stepi"
+    gdb_test "stepi 5" "No more reverse-execution history.*main\.3.*"
+}
+
+with_test_prefix "step" {
+    gdb_test "reverse-step"
+    gdb_test "step 5" "No more reverse-execution history.*main\.3.*"
+}
+
+with_test_prefix "next" {
+    gdb_test "reverse-step"
+    gdb_test "next 5" "No more reverse-execution history.*main\.3.*"
+}
-- 
2.26.2

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* [PATCH 1/8] testsuite: extend nopie handling to add -fno-pie to compiler flags
  2021-02-04  8:10 [PATCH 0/8] pass gdb.btrace with clang Markus Metzger
  2021-02-04  8:10 ` [PATCH 1/2] gdb, btrace: fix hang when stepping over a breakpoint at the end of the trace Markus Metzger
@ 2021-02-04  8:10 ` Markus Metzger
  2021-03-02 16:00   ` Simon Marchi
  2021-02-04  8:10 ` [PATCH] testsuite: note on use_gdb_stub usage Markus Metzger
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 16+ messages in thread
From: Markus Metzger @ 2021-02-04  8:10 UTC (permalink / raw)
  To: gdb-patches

Some older GCC, e.g. 7.5.0 on Ubuntu 18.04 need -fno-pie to be passed to
the compiler in addition to -no-pie to be passed to the linker for non-pie
code generation.

The gdb,nopie_flag is already documented as getting passed to the
compiler, not the linker.  Use that for the new -fno-pie compiler flag and
add a new gdb,nopie_ldflag for the existing -no-pie linker flag.

gdb/testsuite/ChangeLog:
2020-12-21  Markus Metzger  <markus.t.metzger@intel.com>

	* README: Add nopie_ldflag
	* lib/gdb.exp: Extend nopie handling.
---
 gdb/testsuite/README      |  5 +++++
 gdb/testsuite/lib/gdb.exp | 15 +++++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/README b/gdb/testsuite/README
index f3c2642db37..0036753eff0 100644
--- a/gdb/testsuite/README
+++ b/gdb/testsuite/README
@@ -528,6 +528,11 @@ gdb,nopie_flag
   The flag required to force the compiler to produce non-position-independent
   executables.
 
+gdb,nopie_ldflag
+
+  The flag required to force the linker to produce non-position-independent
+  executables.
+
 gdb,debug
 
   When set gdb debug is sent to the file gdb.debug in the test output
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index c38c7c37e98..62d85b44c29 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4221,16 +4221,23 @@ proc gdb_compile {source dest type options} {
 	lappend options "$flag"
     }
 
-    # Replace the "nopie" option with the appropriate linker flag to disable
-    # PIE executables.  There are no compiler flags for this option.
+    # Replace the "nopie" option with the appropriate compiler and linker
+    # flags to disable PIE executables.
     set nopie [lsearch -exact $options nopie]
     if {$nopie != -1} {
 	if [target_info exists gdb,nopie_flag] {
-	    set flag "ldflags=[target_info gdb,nopie_flag]"
+	    set flag "additional_flags=[target_info gdb,nopie_flag]"
 	} else {
-	    set flag "ldflags=-no-pie"
+	    set flag "additional_flags=-fno-pie"
 	}
 	set options [lreplace $options $nopie $nopie $flag]
+
+	if [target_info exists gdb,nopie_ldflag] {
+	    set flag "ldflags=[target_info gdb,nopie_ldflag]"
+	} else {
+	    set flag "ldflags=-no-pie"
+	}
+	lappend options "$flag"
     }
 
     if { $type == "executable" } {
-- 
2.26.2

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* [PATCH] testsuite: note on use_gdb_stub usage
  2021-02-04  8:10 [PATCH 0/8] pass gdb.btrace with clang Markus Metzger
  2021-02-04  8:10 ` [PATCH 1/2] gdb, btrace: fix hang when stepping over a breakpoint at the end of the trace Markus Metzger
  2021-02-04  8:10 ` [PATCH 1/8] testsuite: extend nopie handling to add -fno-pie to compiler flags Markus Metzger
@ 2021-02-04  8:10 ` Markus Metzger
  2021-02-26  7:48   ` Metzger, Markus T
  2021-02-04  8:10 ` [PATCH 2/2] gdb, record: move no-history notification into normal_stop Markus Metzger
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 16+ messages in thread
From: Markus Metzger @ 2021-02-04  8:10 UTC (permalink / raw)
  To: gdb-patches

Add a note to the comment on use_gdb_stub explaining the use of this check
for skipping tests that spawn new inferiors as discussed here:

    https://sourceware.org/pipermail/gdb-patches/2020-December/174186.html

gdb/testsuite/ChangeLog:
2020-12-21  Markus Metzger  <markus.t.metzger@intel.com>

	* lib/gdb.exp: Extend comment.
---
 gdb/testsuite/lib/gdb.exp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 53ac9f1408c..c38c7c37e98 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3653,6 +3653,9 @@ proc gdb_is_target_native { } {
 # This is the preferred way of checking use_gdb_stub, since it allows to check
 # the value before the gdb has been spawned and it will return the correct value
 # even when it was overriden by the test.
+#
+# Note that stub targets are not able to spawn new inferiors.  Use this
+# check for skipping respective tests.
 
 proc use_gdb_stub {} {
   global use_gdb_stub
-- 
2.26.2

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* [PATCH 2/2] gdb, record: move no-history notification into normal_stop
  2021-02-04  8:10 [PATCH 0/8] pass gdb.btrace with clang Markus Metzger
                   ` (2 preceding siblings ...)
  2021-02-04  8:10 ` [PATCH] testsuite: note on use_gdb_stub usage Markus Metzger
@ 2021-02-04  8:10 ` Markus Metzger
  2021-02-04  8:10 ` [PATCH 2/8] testsuite, gdb.btrace: remove assembly-check in delta.exp Markus Metzger
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Markus Metzger @ 2021-02-04  8:10 UTC (permalink / raw)
  To: gdb-patches

Leave calling gdb::observers::no_history.notify to normal_stop based on
the last waitstatus.

gdb/ChangeLog:
2021-01-15  Markus Metzger  <markus.t.metzger@intel.com>

	* infrun.c (handle_inferior_event): Remove no-history notification.
	(keep_going_pass_signal): Likewise.  Set last waitstatus.
	(normal_stop): Notify no-history observers.
---
 gdb/infrun.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 21513344be1..2de86f80274 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -5542,7 +5542,6 @@ handle_inferior_event (struct execution_control_state *ecs)
       if (handle_stop_requested (ecs))
 	return;
 
-      gdb::observers::no_history.notify ();
       stop_waiting (ecs);
       return;
     }
@@ -7829,7 +7828,8 @@ keep_going_pass_signal (struct execution_control_state *ecs)
   if (ecs->event_thread->control.is_replaying
       && !target_record_is_replaying (ecs->event_thread->ptid))
     {
-      gdb::observers::no_history.notify ();
+      ecs->ws.kind = TARGET_WAITKIND_NO_HISTORY;
+      target_last_waitstatus = ecs->ws;
       stop_waiting (ecs);
       normal_stop ();
       return;
@@ -8457,6 +8457,9 @@ normal_stop (void)
 	return 1;
     }
 
+  if (last.kind == TARGET_WAITKIND_NO_HISTORY)
+    gdb::observers::no_history.notify ();
+
   /* Notify observers about the stop.  This is where the interpreters
      print the stop event.  */
   if (inferior_ptid != null_ptid)
-- 
2.26.2

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* [PATCH 2/8] testsuite, gdb.btrace: remove assembly-check in delta.exp
  2021-02-04  8:10 [PATCH 0/8] pass gdb.btrace with clang Markus Metzger
                   ` (3 preceding siblings ...)
  2021-02-04  8:10 ` [PATCH 2/2] gdb, record: move no-history notification into normal_stop Markus Metzger
@ 2021-02-04  8:10 ` Markus Metzger
  2021-02-04  8:10 ` [PATCH 3/8] testsuite, gdb.btrace: pass rn-dl-bind.exp with clang Markus Metzger
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Markus Metzger @ 2021-02-04  8:10 UTC (permalink / raw)
  To: gdb-patches

In gdb.btrace/delta.exp, we test that we do not extend the trace
unintentionally.  This can be tested by checking the number of
instructions.

If we wanted to check the instruction history, as well, we'd need to work
on an assembly file to have deterministic behaviour.  This isn't really
necessary for this test, however, and covered elsewhere.  Also remove the
function call history check for the same reason.

gdb/testsuite/ChangeLog:
2020-12-15  Markus Metzger  <markus.t.metzger@intel.com>

	* gdb.btrace/delta.exp: Remove instruction-history and
	function-call-history checks.
---
 gdb/testsuite/gdb.btrace/delta.exp | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/gdb/testsuite/gdb.btrace/delta.exp b/gdb/testsuite/gdb.btrace/delta.exp
index 9f6d741c013..0d61e9aa54e 100644
--- a/gdb/testsuite/gdb.btrace/delta.exp
+++ b/gdb/testsuite/gdb.btrace/delta.exp
@@ -58,9 +58,6 @@ proc check_trace {} {
     "Recording format: .*" \
     "Recorded 1 instructions in 1 functions \\\(0 gaps\\\) for .*" \
     ]
-  gdb_test "record instruction-history /f 1" \
-    "1\t   0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tmov *\\\$0x0,%eax\r"
-  gdb_test "record function-call-history /c 1" "1\tmain"
 }
 
 # make sure we don't extend the trace when we ask twice.
@@ -86,9 +83,5 @@ with_test_prefix "reverse" {
 # and back
 with_test_prefix "forward" {
     gdb_test "stepi"
-    gdb_test "info record" [multi_line \
-      "Active record target: record-btrace" \
-      "Recording format: .*" \
-      "Recorded 1 instructions in 1 functions \\\(0 gaps\\\) for .*" \
-    ]
+    check_trace
 }
-- 
2.26.2

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* [PATCH 3/8] testsuite, gdb.btrace: pass rn-dl-bind.exp with clang
  2021-02-04  8:10 [PATCH 0/8] pass gdb.btrace with clang Markus Metzger
                   ` (4 preceding siblings ...)
  2021-02-04  8:10 ` [PATCH 2/8] testsuite, gdb.btrace: remove assembly-check in delta.exp Markus Metzger
@ 2021-02-04  8:10 ` Markus Metzger
  2021-02-04  8:10 ` [PATCH 4/8] testsuite, gdb.btrace: move -Wl,-x to ldflags Markus Metzger
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Markus Metzger @ 2021-02-04  8:10 UTC (permalink / raw)
  To: gdb-patches

Clang generates slightly different debug information causing
gdb.btrace/rn-dl-bind.exp to fail on its way to the actual test.

Modify the test to remove that dependency.

gdb/testsuite/ChangeLog:
2020-12-15  Markus Metzger  <markus.t.metzger@intel.com>

	* gdb.btrace/rn-dl-bind.exp: Replace reverse-step with
	reverse-continue to breakpoint.
---
 gdb/testsuite/gdb.btrace/rn-dl-bind.exp | 28 +++++++++++++++++--------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/gdb/testsuite/gdb.btrace/rn-dl-bind.exp b/gdb/testsuite/gdb.btrace/rn-dl-bind.exp
index a769db29cf0..65e445334af 100644
--- a/gdb/testsuite/gdb.btrace/rn-dl-bind.exp
+++ b/gdb/testsuite/gdb.btrace/rn-dl-bind.exp
@@ -38,18 +38,28 @@ if ![runto_main] {
 
 # trace the code for the call to test
 gdb_test_no_output "record btrace"
-gdb_test "next" ".*main\.2.*" "next.1"
+gdb_test "next" ".*main\.2.*"
 
 # just dump the function-call-history to help debugging
 gdb_test_no_output "set record function-call-history-size 0"
 gdb_test "record function-call-history /cli 1" ".*"
 
 # check that we can reverse-next and next
-gdb_test "reverse-next" ".*main\.1.*" "reverse-next.1"
-gdb_test "next" ".*main\.2.*" "next.2"
-
-# now go into test and try to reverse-next and next over the library call
-gdb_test "reverse-step" ".*test\.3.*" "reverse-step.1"
-gdb_test "reverse-step" ".*test\.2.*" "reverse-step.2"
-gdb_test "reverse-next" ".*test\.1.*" "reverse-next.2"
-gdb_test "next" ".*test\.2.*" "next.3"
+with_test_prefix "main" {
+    gdb_test "reverse-next" ".*main\.1.*"
+    gdb_test "next" ".*main\.2.*"
+}
+
+# now go into test and try to (reverse-)next over the library call
+#
+# reverse-stepping through the epilogue is not very reliable; depending on
+# debug information we may stop at the closing brace or at the return.
+#
+# instead, run to test
+gdb_breakpoint test {temporary}
+gdb_test "reverse-continue" ".*test\.1.*"
+
+with_test_prefix "test" {
+    gdb_test "next" ".*test\.2.*"
+    gdb_test "reverse-next" ".*test\.1.*"
+}
-- 
2.26.2

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* [PATCH 4/8] testsuite, gdb.btrace: move -Wl,-x to ldflags
  2021-02-04  8:10 [PATCH 0/8] pass gdb.btrace with clang Markus Metzger
                   ` (5 preceding siblings ...)
  2021-02-04  8:10 ` [PATCH 3/8] testsuite, gdb.btrace: pass rn-dl-bind.exp with clang Markus Metzger
@ 2021-02-04  8:10 ` Markus Metzger
  2021-02-04  8:10 ` [PATCH 5/8] testsuite, gdb.btrace: adjust expected output to pass with clang Markus Metzger
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Markus Metzger @ 2021-02-04  8:10 UTC (permalink / raw)
  To: gdb-patches

In gdb.btrace/unknown_functions.exp we need the linker to discard local
symbols so GDB wouldn't know about them from the symbol table.

When building with clang, it complains about the option not being used at
compile-time.  Move the option to ldflags to only pass it at link-time.

gdb/testsuite/ChangeLog:
2020-12-16  Markus Metzger  <markus.t.metzger@intel.com>

	* gdb.btrace/unknown_functions.exp: Move -Wl,-x to ldflags.
---
 gdb/testsuite/gdb.btrace/unknown_functions.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.btrace/unknown_functions.exp b/gdb/testsuite/gdb.btrace/unknown_functions.exp
index 5dfd8d10705..dc52d75c0f3 100644
--- a/gdb/testsuite/gdb.btrace/unknown_functions.exp
+++ b/gdb/testsuite/gdb.btrace/unknown_functions.exp
@@ -29,7 +29,7 @@ standard_testfile
 #
 # Also discard local symbols.
 if [prepare_for_testing "failed to prepare" $testfile $srcfile \
-	{additional_flags=-Wl,-x nopie}] {
+	{ldflags=-Wl,-x nopie}] {
     return -1
 }
 
-- 
2.26.2

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* [PATCH 5/8] testsuite, gdb.btrace: adjust expected output to pass with clang
  2021-02-04  8:10 [PATCH 0/8] pass gdb.btrace with clang Markus Metzger
                   ` (6 preceding siblings ...)
  2021-02-04  8:10 ` [PATCH 4/8] testsuite, gdb.btrace: move -Wl,-x to ldflags Markus Metzger
@ 2021-02-04  8:10 ` Markus Metzger
  2021-02-04  8:10 ` [PATCH 6/8] testsuite, gdb.btrace: remove implicit debug option in stepi.exp Markus Metzger
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Markus Metzger @ 2021-02-04  8:10 UTC (permalink / raw)
  To: gdb-patches

Clang generates slightly different debug information.  Adjust the expected
output of gdb.btrace/function_call_history.exp to work with both gcc and
clang.

Also modify gdb.btrace/exception.cc to reliably trace into main and update
the corresponding patterns in gdb.btrace/exception.exp.

gdb/testsuite/ChangeLog:
2020-12-15  Markus Metzger  <markus.t.metzger@intel.com>

	* gdb.btrace/exception.cc (main): Update test source.
	* gdb.btrace/exception.exp: Update patterns.
	* gdb.btrace/function_call_history.exp: Likewise.
---
 gdb/testsuite/gdb.btrace/exception.cc         |  6 ++++-
 gdb/testsuite/gdb.btrace/exception.exp        | 26 ++++++++++++-------
 .../gdb.btrace/function_call_history.exp      | 20 +++++++-------
 3 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/gdb/testsuite/gdb.btrace/exception.cc b/gdb/testsuite/gdb.btrace/exception.cc
index 6e4f872d8ff..0c660bb7051 100644
--- a/gdb/testsuite/gdb.btrace/exception.cc
+++ b/gdb/testsuite/gdb.btrace/exception.cc
@@ -50,7 +50,11 @@ test (void)
 int
 main (void)
 {
+  int ret;
+
   test ();
   test (); /* bp.1  */
-  return 0; /* bp.2  */
+
+  ret = 0;
+  return ret; /* bp.2  */
 }
diff --git a/gdb/testsuite/gdb.btrace/exception.exp b/gdb/testsuite/gdb.btrace/exception.exp
index 33cd0ea0bc9..7b840e41bfc 100755
--- a/gdb/testsuite/gdb.btrace/exception.exp
+++ b/gdb/testsuite/gdb.btrace/exception.exp
@@ -60,19 +60,25 @@ gdb_expect_list "flat" "\r\n$gdb_prompt $" [list \
     "3\tfoo\\(\\)" \
     "4\tbar\\(\\)" \
     "5\tbad\\(\\)\r" \
-  ] \
-  "" \
-  "\[0-9\]*\ttest\\(\\)"]
+  ] "" \
+  [multi_line \
+    "\[0-9\]*\ttest\\(\\)" \
+    "\[0-9\]*\tmain\\(\\)" \
+  ] "" \
+  ]
 
 # show the branch trace with calls indented
 send_gdb "record function-call-history /c 1\n"
 gdb_expect_list "indented" "\r\n$gdb_prompt $" [list \
   [multi_line \
     "1\tmain\\(\\)" \
-  "2\t  test\\(\\)" \
-  "3\t    foo\\(\\)" \
-  "4\t      bar\\(\\)" \
-  "5\t        bad\\(\\)\r" \
-  ] \
-  "" \
-  "\[0-9\]*\t  test\\(\\)"]
+    "2\t  test\\(\\)" \
+    "3\t    foo\\(\\)" \
+    "4\t      bar\\(\\)" \
+    "5\t        bad\\(\\)\r" \
+  ] "" \
+  [multi_line \
+    "\[0-9\]*\t  test\\(\\)" \
+    "\[0-9\]*\tmain\\(\\)" \
+  ] "" \
+  ]
diff --git a/gdb/testsuite/gdb.btrace/function_call_history.exp b/gdb/testsuite/gdb.btrace/function_call_history.exp
index 568f794db7e..f995016fafa 100644
--- a/gdb/testsuite/gdb.btrace/function_call_history.exp
+++ b/gdb/testsuite/gdb.btrace/function_call_history.exp
@@ -148,29 +148,29 @@ gdb_test_no_output "set filename-display basename"
 # moving forward again, but this time with file and line number, expected to see the first 15 entries
 gdb_test "record function-call-history /l +" [multi_line \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
   ] "forward /l - 1"
 
 # moving forward and expect to see the latest 6 entries
 gdb_test "record function-call-history /l +" [multi_line \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,43" \
   ] "forward /l - 2"
 
-- 
2.26.2

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* [PATCH 6/8] testsuite, gdb.btrace: remove implicit debug option in stepi.exp
  2021-02-04  8:10 [PATCH 0/8] pass gdb.btrace with clang Markus Metzger
                   ` (7 preceding siblings ...)
  2021-02-04  8:10 ` [PATCH 5/8] testsuite, gdb.btrace: adjust expected output to pass with clang Markus Metzger
@ 2021-02-04  8:10 ` Markus Metzger
  2021-02-04  8:10 ` [PATCH 7/8] testsuite, gdb.btrace: adjust expected source line in non-stop.exp Markus Metzger
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Markus Metzger @ 2021-02-04  8:10 UTC (permalink / raw)
  To: gdb-patches

We use pre-compiled assembly including debug information for stepi, yet we
compiled with -g, which was implicitly set by prepare_for_testing.

Add {} options to avoid the implicit {debug}.

gdb/testsuite/ChangeLog:
2020-12-17  Markus Metzger  <markus.t.metzger@intel.com>

	* gdb.btrace/stepi.exp: Add {} options to prepare_for_testing.
---
 gdb/testsuite/gdb.btrace/stepi.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.btrace/stepi.exp b/gdb/testsuite/gdb.btrace/stepi.exp
index bfb680bb30d..480c08c4875 100644
--- a/gdb/testsuite/gdb.btrace/stepi.exp
+++ b/gdb/testsuite/gdb.btrace/stepi.exp
@@ -44,7 +44,7 @@ if [info exists COMPILE] {
     return -1
 }
 
-if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
+if [prepare_for_testing "failed to prepare" $testfile $srcfile {}] {
     return -1
 }
 
-- 
2.26.2

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* [PATCH 7/8] testsuite, gdb.btrace: adjust expected source line in non-stop.exp
  2021-02-04  8:10 [PATCH 0/8] pass gdb.btrace with clang Markus Metzger
                   ` (8 preceding siblings ...)
  2021-02-04  8:10 ` [PATCH 6/8] testsuite, gdb.btrace: remove implicit debug option in stepi.exp Markus Metzger
@ 2021-02-04  8:10 ` Markus Metzger
  2021-02-04  8:10 ` [PATCH 8/8] gdb, testsuite: enforce lazy binding for gdb.btrace/rn-dl-bind.exp Markus Metzger
  2021-02-26  7:50 ` [PATCH 0/8] pass gdb.btrace with clang Metzger, Markus T
  11 siblings, 0 replies; 16+ messages in thread
From: Markus Metzger @ 2021-02-04  8:10 UTC (permalink / raw)
  To: gdb-patches

In gdb.btrace/non-stop.exp, we hard-code expected source lines assuming we
know how they would match to the recorded trace.  Despite the fact that we
should really have been using an assembly source, the assumptions work
pretty well.

With clang-6 -m32, we found a case where the assumptions do not hold.
Adjust the expected source lines a little bit to cover that case, as well.

Should we run into more cases like this, we will have to switch to an
assembly source file.

gdb/testsuite/ChangeLog:
2020-12-17  Markus Metzger  <markus.t.metzger@intel.com>

	* gdb.btrace/non-stop.exp: Adjust expected source lines.
---
 gdb/testsuite/gdb.btrace/non-stop.exp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.btrace/non-stop.exp b/gdb/testsuite/gdb.btrace/non-stop.exp
index 40cced7a8bb..e509d65d660 100644
--- a/gdb/testsuite/gdb.btrace/non-stop.exp
+++ b/gdb/testsuite/gdb.btrace/non-stop.exp
@@ -111,10 +111,10 @@ gdb_test "thread apply all info rec" ".*"
 gdb_test "info threads" ".*"
 
 with_test_prefix "navigate" {
-    gdb_test "thread apply 1 record goto 2" "$loop_line"
+    gdb_test "thread apply 1 record goto 3" "$loop_line"
     gdb_test "thread apply 2 record goto 4" "$loop_line"
     gdb_test "thread apply 1 info record" \
-        ".*Replay in progress\.  At instruction 2\." "thread 1 at insn 2"
+        ".*Replay in progress\.  At instruction 3\." "thread 1 at insn 3"
     gdb_test "thread apply 2 info record" \
         ".*Replay in progress\.  At instruction 4\." "thread 2 at insn 4"
 
-- 
2.26.2

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* [PATCH 8/8] gdb, testsuite: enforce lazy binding for gdb.btrace/rn-dl-bind.exp
  2021-02-04  8:10 [PATCH 0/8] pass gdb.btrace with clang Markus Metzger
                   ` (9 preceding siblings ...)
  2021-02-04  8:10 ` [PATCH 7/8] testsuite, gdb.btrace: adjust expected source line in non-stop.exp Markus Metzger
@ 2021-02-04  8:10 ` Markus Metzger
  2021-02-26  7:50 ` [PATCH 0/8] pass gdb.btrace with clang Metzger, Markus T
  11 siblings, 0 replies; 16+ messages in thread
From: Markus Metzger @ 2021-02-04  8:10 UTC (permalink / raw)
  To: gdb-patches

In gdb.btrace/rn-dl-bind.exp we test that we can reverse-step over
recorded dynamic linking.  The test covers specific behaviour to support
_dl_runtime_resolve calling the resolved function by returning to it.
This would normally mess up stepping as we'd end up with backtraces that
contain the same functions but different frame ids.

Since GDB needs to recognize a return from _dl_runtime_resolve, the test
only passes when debug information for _dl_runtime_resolve is available.

The test requires that symbols are bound lazily.  Otherwise, we won't
record dynamic linking and the test will be fairly pointless.

Recent GCC pass -z now by default to bind symbols eagerly.  Add -z lazy to
the test's ldflags to enforce lazy binding.

gdb/testsuite/ChangeLog:
2021-01-13  Markus Metzger  <markus.t.metzger@intel.com>

	* gdb.btrace/rn-dl-bind.exp: Add ldflags=-Wl,-z,lazy.
---
 gdb/testsuite/gdb.btrace/rn-dl-bind.exp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.btrace/rn-dl-bind.exp b/gdb/testsuite/gdb.btrace/rn-dl-bind.exp
index 65e445334af..204e88093a4 100644
--- a/gdb/testsuite/gdb.btrace/rn-dl-bind.exp
+++ b/gdb/testsuite/gdb.btrace/rn-dl-bind.exp
@@ -27,7 +27,8 @@ if { [skip_btrace_tests] } {
 }
 
 standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {c++ debug}] {
+if [prepare_for_testing "failed to prepare" $testfile $srcfile \
+	{c++ debug ldflags=-Wl,-z,lazy}] {
     return -1
 }
 
-- 
2.26.2

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* RE: [PATCH] testsuite: note on use_gdb_stub usage
  2021-02-04  8:10 ` [PATCH] testsuite: note on use_gdb_stub usage Markus Metzger
@ 2021-02-26  7:48   ` Metzger, Markus T
  0 siblings, 0 replies; 16+ messages in thread
From: Metzger, Markus T @ 2021-02-26  7:48 UTC (permalink / raw)
  To: gdb-patches

> Add a note to the comment on use_gdb_stub explaining the use of this check
> for skipping tests that spawn new inferiors as discussed here:
> 
>     https://sourceware.org/pipermail/gdb-patches/2020-December/174186.html
> 
> gdb/testsuite/ChangeLog:
> 2020-12-21  Markus Metzger  <markus.t.metzger@intel.com>
> 
> 	* lib/gdb.exp: Extend comment.

This patch was already reviewed in the cited email discussion.  I'm pushing it.

Regards,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* RE: [PATCH 0/8] pass gdb.btrace with clang
  2021-02-04  8:10 [PATCH 0/8] pass gdb.btrace with clang Markus Metzger
                   ` (10 preceding siblings ...)
  2021-02-04  8:10 ` [PATCH 8/8] gdb, testsuite: enforce lazy binding for gdb.btrace/rn-dl-bind.exp Markus Metzger
@ 2021-02-26  7:50 ` Metzger, Markus T
  11 siblings, 0 replies; 16+ messages in thread
From: Metzger, Markus T @ 2021-02-26  7:50 UTC (permalink / raw)
  To: gdb-patches

> I noticed a number of fails when running gdb.btrace with clang instead of gcc
> due to different diagnostics, different defaults, or slightly different debug
> information.
> 
> Markus Metzger (8):
>   testsuite: extend nopie handling to add -fno-pie to compiler flags
>   testsuite, gdb.btrace: remove assembly-check in delta.exp
>   testsuite, gdb.btrace: pass rn-dl-bind.exp with clang
>   testsuite, gdb.btrace: move -Wl,-x to ldflags
>   testsuite, gdb.btrace: adjust expected output to pass with clang
>   testsuite, gdb.btrace: remove implicit debug option in stepi.exp
>   testsuite, gdb.btrace: adjust expected source line in non-stop.exp
>   gdb, testsuite: enforce lazy binding for gdb.btrace/rn-dl-bind.exp

I plan to push this beginning of next week.

Regards,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* Re: [PATCH 1/8] testsuite: extend nopie handling to add -fno-pie to compiler flags
  2021-02-04  8:10 ` [PATCH 1/8] testsuite: extend nopie handling to add -fno-pie to compiler flags Markus Metzger
@ 2021-03-02 16:00   ` Simon Marchi
  2021-03-03  7:57     ` Metzger, Markus T
  0 siblings, 1 reply; 16+ messages in thread
From: Simon Marchi @ 2021-03-02 16:00 UTC (permalink / raw)
  To: Markus Metzger, gdb-patches

On 2021-02-04 3:10 a.m., Markus Metzger via Gdb-patches wrote:> Some older GCC, e.g. 7.5.0 on Ubuntu 18.04 need -fno-pie to be passed to
> the compiler in addition to -no-pie to be passed to the linker for non-pie
> code generation.
> 
> The gdb,nopie_flag is already documented as getting passed to the
> compiler, not the linker.  Use that for the new -fno-pie compiler flag and
> add a new gdb,nopie_ldflag for the existing -no-pie linker flag.

Ok, so this changes the meaning of gdb,nopie_flag.  It previously
contained linker flags and now contains compiler flags.  So if someone
was using gdb,nopie_flag in their board file, they should change it to
gdb,nopie_ldflag.  Perhaps make that clear in the commit message?

I don't know if we guarantee strict backwards compatibility for board
file definitions, I don't think so.  We just don't change it just for
fun.  In this case I think it's beneficial, because it brings it in line
with gdb,pie_flag and gdb_pie_ldflag.

So as far as I'm concerned, this patch LGTM.

Simon

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

* RE: [PATCH 1/8] testsuite: extend nopie handling to add -fno-pie to compiler flags
  2021-03-02 16:00   ` Simon Marchi
@ 2021-03-03  7:57     ` Metzger, Markus T
  0 siblings, 0 replies; 16+ messages in thread
From: Metzger, Markus T @ 2021-03-03  7:57 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

Thanks, Simon,

> Ok, so this changes the meaning of gdb,nopie_flag.  It previously
> contained linker flags and now contains compiler flags.  So if someone
> was using gdb,nopie_flag in their board file, they should change it to
> gdb,nopie_ldflag.  Perhaps make that clear in the commit message?
> 
> I don't know if we guarantee strict backwards compatibility for board
> file definitions, I don't think so.  We just don't change it just for
> fun.  In this case I think it's beneficial, because it brings it in line
> with gdb,pie_flag and gdb_pie_ldflag.

Indeed it would be odd to invent a new name and have people wonder
why _flags sometimes means compiler flags and sometimes means
linker flags.

I'll add a note to the commit message.

Markus.

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

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

end of thread, other threads:[~2021-03-03  7:57 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04  8:10 [PATCH 0/8] pass gdb.btrace with clang Markus Metzger
2021-02-04  8:10 ` [PATCH 1/2] gdb, btrace: fix hang when stepping over a breakpoint at the end of the trace Markus Metzger
2021-02-04  8:10 ` [PATCH 1/8] testsuite: extend nopie handling to add -fno-pie to compiler flags Markus Metzger
2021-03-02 16:00   ` Simon Marchi
2021-03-03  7:57     ` Metzger, Markus T
2021-02-04  8:10 ` [PATCH] testsuite: note on use_gdb_stub usage Markus Metzger
2021-02-26  7:48   ` Metzger, Markus T
2021-02-04  8:10 ` [PATCH 2/2] gdb, record: move no-history notification into normal_stop Markus Metzger
2021-02-04  8:10 ` [PATCH 2/8] testsuite, gdb.btrace: remove assembly-check in delta.exp Markus Metzger
2021-02-04  8:10 ` [PATCH 3/8] testsuite, gdb.btrace: pass rn-dl-bind.exp with clang Markus Metzger
2021-02-04  8:10 ` [PATCH 4/8] testsuite, gdb.btrace: move -Wl,-x to ldflags Markus Metzger
2021-02-04  8:10 ` [PATCH 5/8] testsuite, gdb.btrace: adjust expected output to pass with clang Markus Metzger
2021-02-04  8:10 ` [PATCH 6/8] testsuite, gdb.btrace: remove implicit debug option in stepi.exp Markus Metzger
2021-02-04  8:10 ` [PATCH 7/8] testsuite, gdb.btrace: adjust expected source line in non-stop.exp Markus Metzger
2021-02-04  8:10 ` [PATCH 8/8] gdb, testsuite: enforce lazy binding for gdb.btrace/rn-dl-bind.exp Markus Metzger
2021-02-26  7:50 ` [PATCH 0/8] pass gdb.btrace with clang Metzger, Markus T

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).