Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Nils-Christian Kempke via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Cc: JiniSusan.George@amd.com, aburgess@redhat.com
Subject: [PATCH 17/18] gdb, testsuite, fortran: fixup mixed-lang-stack for Intel/LLVM compilers
Date: Tue, 10 May 2022 16:24:36 +0200	[thread overview]
Message-ID: <20220510142437.1397399-18-nils-christian.kempke@intel.com> (raw)
In-Reply-To: <20220510142437.1397399-1-nils-christian.kempke@intel.com>

When value-printing a pointer within GDB by default GDB will look for
defined symbols residing at the address of the pointer.  For the given
test the Intel/LLVM compiler stacks both display a symbol associated
with a printed pointer while the gnu stack does not.  This leads to
failures in the test when running the test with CC_FOR_TARGET='clang'
CXX_FOR_TARGET='clang' F90_FOR_TARGET='flang'"

  (gdb) b 37
  (gdb) r
  (gdb) f 6
  (gdb) info args
  a = 1
  b = 2
  c = 3
  d = 4 + 5i
  f = 0x419ed0 "abcdef"
  g = 0x4041a0 <.BSS4>

or CC_FOR_TARGET='icx' CXX_FOR_TARGET='icpx' F90_FOR_TARGET='ifx'"

  (gdb) b 37
  (gdb) r
  (gdb) f 6
  (gdb) info args
  a = 1
  b = 2
  c = 3
  d = 4 + 5i
  f = 0x52eee0 "abcdef"
  g = 0x4ca210 <mixed_func_1a_$OBJ>

For the compiled binary the Intel/LLVM compilers both decide to move the
local variable g into the .bss section of their executable.  The gnu
stack will keep the variable locally on the stack and not define a
symbol for it.

Since the behavior for Intel/LLVM is actually expected I adapted the
testcase at this point to be a bit more allowing for other outputs.
I added the optional "<SYMBOLNAME>" to the regex testing for g.

The given changes reduce the test fails for Intel/LLVM stack by 4 each.
---
 .../gdb.fortran/mixed-lang-stack.exp          | 21 ++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp
index eace4d439b..5bed3be869 100644
--- a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp
+++ b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp
@@ -129,22 +129,29 @@ proc run_tests { lang } {
 	    set f_pattern "$hex \"abcdef\""
 	}
 
+	# When value-printing pointers in GDB, GDB will try and look for any
+	# associated symbol and print it after the pointer as "<SYMBOL>". For
+	# this test Intel and LLVM compilers move g to the .bss section, thus
+	# creating a symbol, while the GNU compiler stack keeps g purely on the
+	# stack.
+	set g_pattern "$hex\( <\[^\r\n\]+>\)?"
+
 	set args_pattern [multi_line \
 			      "a = 1" \
 			      "b = 2" \
 			      "c = 3" \
 			      "d = ${d_pattern}" \
 			      "f = ${f_pattern}" \
-			      "g = $hex" ]
+			      "g = ${g_pattern}" ]
 
 	gdb_test "info args" $args_pattern \
 	    "info args in frame #6"
 	if { $lang == "fortran" } {
-	    set g_pattern " = \\( a = 1\\.5, b = 2\\.5 \\)"
+	    set g_val_pattern " = \\( a = 1\\.5, b = 2\\.5 \\)"
 	} else {
-	    set g_pattern " = \\{a = 1\\.5, b = 2\\.5\\}"
+	    set g_val_pattern " = \\{a = 1\\.5, b = 2\\.5\\}"
 	}
-	gdb_test "print *g" "${g_pattern}" \
+	gdb_test "print *g" "${g_val_pattern}" \
 	    "print object pointed to by g"
 
 	gdb_test "up" "#7\\s+$hex in mixed_func_1b .*" \
@@ -155,11 +162,11 @@ proc run_tests { lang } {
 	if { $lang == "c" || $lang == "c++" } {
 	    set d_pattern "4 \\+ 5i"
 	    set e_pattern "\"abcdef\""
-	    set g_pattern "\{a = 1.5, b = 2.5\}"
+	    set g_val_pattern "\{a = 1.5, b = 2.5\}"
 	} else {
 	    set d_pattern "\\(4,5\\)"
 	    set e_pattern "'abcdef'"
-	    set g_pattern "\\( a = 1.5, b = 2.5 \\)"
+	    set g_val_pattern "\\( a = 1.5, b = 2.5 \\)"
 	}
 
 	set args_pattern [multi_line \
@@ -168,7 +175,7 @@ proc run_tests { lang } {
 			      "c = 3" \
 			      "d = ${d_pattern}" \
 			      "e = ${e_pattern}" \
-			      "g = ${g_pattern}" \
+			      "g = ${g_val_pattern}" \
 			      "_e = 6" ]
 
 	gdb_test "info args" $args_pattern \
-- 
2.25.1

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


  parent reply	other threads:[~2022-05-10 14:33 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 14:24 [PATCH 00/18] Fortran compiler identification and ifx testsuite support Nils-Christian Kempke via Gdb-patches
2022-05-10 14:24 ` [PATCH 01/18] gdb/testsuite: remove F77_FOR_TARGET support Nils-Christian Kempke via Gdb-patches
2022-05-10 14:24 ` [PATCH 02/18] gdb/testsuite: Use -module option for Intel Fortran compilers Nils-Christian Kempke via Gdb-patches
2022-05-10 14:24 ` [PATCH 03/18] gdb/testsuite: Fix fortran types for Intel compilers Nils-Christian Kempke via Gdb-patches
2022-05-11  9:49   ` Andrew Burgess via Gdb-patches
2022-05-11  9:57     ` Kempke, Nils-Christian via Gdb-patches
2022-05-10 14:24 ` [PATCH 04/18] gdb/testsuite: add local variable for passing 'getting_compiler_info' to gdb_compile Nils-Christian Kempke via Gdb-patches
2022-05-11 10:10   ` Andrew Burgess via Gdb-patches
2022-05-11 14:24     ` Kempke, Nils-Christian via Gdb-patches
2022-05-10 14:24 ` [PATCH 05/18] gdb/testsuite: add Fortran compiler identification to GDB Nils-Christian Kempke via Gdb-patches
2022-05-10 14:24 ` [PATCH 06/18] gdb/testsuite: rename intel next gen c/cpp compilers Nils-Christian Kempke via Gdb-patches
2022-05-11 11:23   ` Andrew Burgess via Gdb-patches
2022-05-11 14:28     ` Kempke, Nils-Christian via Gdb-patches
2022-05-10 14:24 ` [PATCH 07/18] gdb/testsuite: disable charset.exp for intel compilers Nils-Christian Kempke via Gdb-patches
2022-05-10 14:24 ` [PATCH 08/18] testsuite, fortran: make print-formatted.exp more robust Nils-Christian Kempke via Gdb-patches
2022-05-11 11:32   ` Andrew Burgess via Gdb-patches
2022-05-11 14:32     ` Kempke, Nils-Christian via Gdb-patches
2022-05-10 14:24 ` [PATCH 09/18] testsuite, fortran: add required external keyword Nils-Christian Kempke via Gdb-patches
2022-05-10 14:24 ` [PATCH 10/18] testsuite, fortran: add compiler dependent types to dynamic-ptype-whatis Nils-Christian Kempke via Gdb-patches
2022-05-10 14:24 ` [PATCH 11/18] testsuite, fortran: Add '-debug-parameters all' when compiling with ifx Nils-Christian Kempke via Gdb-patches
2022-05-11 11:56   ` Andrew Burgess via Gdb-patches
2022-05-11 14:36     ` Kempke, Nils-Christian via Gdb-patches
2022-05-10 14:24 ` [PATCH 12/18] testsuite/lib: add check_optional_entry for GDBInfoSymbols Nils-Christian Kempke via Gdb-patches
2022-05-10 14:24 ` [PATCH 13/18] testsuite, fortran: fix info-types for intel compilers Nils-Christian Kempke via Gdb-patches
2022-05-11 12:06   ` Andrew Burgess via Gdb-patches
2022-05-11 15:20     ` Kempke, Nils-Christian via Gdb-patches
2022-05-11 16:43       ` Kempke, Nils-Christian via Gdb-patches
2022-05-30 10:33         ` Andrew Burgess via Gdb-patches
2022-05-30 10:32       ` Andrew Burgess via Gdb-patches
2022-05-10 14:24 ` [PATCH 14/18] testsuite, fortran: Add type info of formal parameter for Intel compilers Nils-Christian Kempke via Gdb-patches
2022-05-10 14:24 ` [PATCH 15/18] testsuite, fortran: allow additional completions in module.exp Nils-Christian Kempke via Gdb-patches
2022-05-10 14:24 ` [PATCH 16/18] gdb, testsuite, fortran: fix double free in mixed-lang-stack.exp Nils-Christian Kempke via Gdb-patches
2022-05-10 14:24 ` Nils-Christian Kempke via Gdb-patches [this message]
2022-05-10 14:24 ` [PATCH 18/18] gdb/testsuite: fixup common-block.exp for intel compilers Nils-Christian Kempke via Gdb-patches
2022-05-11 13:29   ` Andrew Burgess via Gdb-patches
2022-05-11 15:31     ` Kempke, Nils-Christian via Gdb-patches
2022-05-16  6:36       ` George, Jini Susan via Gdb-patches
2022-05-16  7:59         ` Kempke, Nils-Christian via Gdb-patches
2022-05-11 13:32 ` [PATCH 00/18] Fortran compiler identification and ifx testsuite support Andrew Burgess via Gdb-patches

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=20220510142437.1397399-18-nils-christian.kempke@intel.com \
    --to=gdb-patches@sourceware.org \
    --cc=JiniSusan.George@amd.com \
    --cc=aburgess@redhat.com \
    --cc=nils-christian.kempke@intel.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