public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Tomar, Sourabh Singh" <SourabhSingh.Tomar@amd.com>
To: Tom Tromey <tom@tromey.com>,
	"Tomar,
	Sourabh Singh via Gdb-patches" <gdb-patches@sourceware.org>
Cc: "George, Jini Susan" <JiniSusan.George@amd.com>,
	"Achra, Nitika" <Nitika.Achra@amd.com>,
	"Sharma, Alok Kumar" <AlokKumar.Sharma@amd.com>,
	"Kumar N, Bhuvanendra" <Bhuvanendra.KumarN@amd.com>,
	"E, Nagajyothi" <Nagajyothi.E@amd.com>
Subject: RE: [PATCH] [gdb.base] Enable macro test for clang compiler
Date: Mon, 15 Mar 2021 05:51:39 +0000	[thread overview]
Message-ID: <MW2PR12MB24740A70EEE2EC830683EB739D6C9@MW2PR12MB2474.namprd12.prod.outlook.com> (raw)
In-Reply-To: <MW2PR12MB247453230098961ECFE6CAB09D6C9@MW2PR12MB2474.namprd12.prod.outlook.com>

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

[AMD Public Use]

Apologies missed the attachment/patch.
PFA;

Thanks,
Sourabh.

-----Original Message-----
From: Tomar, Sourabh Singh 
Sent: Monday, March 15, 2021 11:18 AM
To: Tom Tromey <tom@tromey.com>; Tomar, Sourabh Singh via Gdb-patches <gdb-patches@sourceware.org>
Cc: George, Jini Susan <JiniSusan.George@amd.com>; Achra, Nitika <Nitika.Achra@amd.com>; Sharma, Alok Kumar <AlokKumar.Sharma@amd.com>; Kumar N, Bhuvanendra <Bhuvanendra.KumarN@amd.com>; E, Nagajyothi <Nagajyothi.E@amd.com>
Subject: RE: [PATCH] [gdb.base] Enable macro test for clang compiler

[AMD Public Use]

Hi Tom,

> I had a thought, though, that perhaps other tests use -g3, and I found:
> testsuite/gdb.asm/asm-source.exp:# The GNU assembler does not support level options like "-g2" or "-g3".
> testsuite/gdb.base/info-macros.exp:# command line, possibly overriding "-g3" (depending on gcc version).
> testsuite/gdb.base/info-macros.exp:set options "additional_flags=-g3"
> testsuite/gdb.base/lineinc.exp:#     $ gcc -g3 lineinc.c -o lineinc
> testsuite/gdb.base/macscp.exp:    lappend options additional_flags=-g3
> testsuite/gdb.base/style.exp:    lappend options additional_flags=-g3
> testsuite/gdb.compile/compile-cplus-print.exp:    lappend options additional_flags=-g3
> testsuite/gdb.compile/compile-cplus.exp:    lappend options additional_flags=-g3
> testsuite/gdb.compile/compile.exp:    lappend options additional_flags=-g3
> testsuite/gdb.linespec/macro-relative.exp:    lappend opts additional_flags=-g3

> Of these, a couple mentions are just in comments, and gdb.compile will only work with GCC anyway.  But you may want to consider updating the rest.

Thanks for the heads-up!, I've updated the relevant tests accordingly. Built and tested(clean) with gcc and clang.

Overall changes:
- Rebased on tip.
- Addressed review comments.

Updated ChangeLog:
2021-03-15  Sourabh Singh Tomar  <SourabhSingh.Tomar@amd.com>

       * gdb.base/info-macros.exp: Append -fdebug-macro to
         additional_flags for clang.
       * gdb.base/macscp.exp: Likewise.
       * gdb.base/style.exp: Likewise.
       * gdb.linespec/macro-relative.exp: Likewise.

Thank You,
Sourabh.

-----Original Message-----
From: Tom Tromey <tom@tromey.com> 
Sent: Friday, March 12, 2021 7:43 PM
To: Tomar, Sourabh Singh via Gdb-patches <gdb-patches@sourceware.org>
Cc: Tom Tromey <tom@tromey.com>; Tomar, Sourabh Singh <SourabhSingh.Tomar@amd.com>; George, Jini Susan <JiniSusan.George@amd.com>; Achra, Nitika <Nitika.Achra@amd.com>; Sharma, Alok Kumar <AlokKumar.Sharma@amd.com>; Kumar N, Bhuvanendra <Bhuvanendra.KumarN@amd.com>; E, Nagajyothi <Nagajyothi.E@amd.com>
Subject: Re: [PATCH] [gdb.base] Enable macro test for clang compiler

[CAUTION: External Email]

>> Overall changes:
>> - Rebased on tip.
>> - Addressed review comments.

Thank you.  This patch is ok.

I had a thought, though, that perhaps other tests use -g3, and I found:

murgatroyd. git grep -e -g3 -- '*.exp'
testsuite/gdb.asm/asm-source.exp:# The GNU assembler does not support level options like "-g2" or "-g3".
testsuite/gdb.base/info-macros.exp:# command line, possibly overriding "-g3" (depending on gcc version).
testsuite/gdb.base/info-macros.exp:set options "additional_flags=-g3"
testsuite/gdb.base/lineinc.exp:#     $ gcc -g3 lineinc.c -o lineinc
testsuite/gdb.base/macscp.exp:    lappend options additional_flags=-g3
testsuite/gdb.base/style.exp:    lappend options additional_flags=-g3
testsuite/gdb.compile/compile-cplus-print.exp:    lappend options additional_flags=-g3
testsuite/gdb.compile/compile-cplus.exp:    lappend options additional_flags=-g3
testsuite/gdb.compile/compile.exp:    lappend options additional_flags=-g3
testsuite/gdb.linespec/macro-relative.exp:    lappend opts additional_flags=-g3


Of these, a couple mentions are just in comments, and gdb.compile will only work with GCC anyway.  But you may want to consider updating the rest.

Tom

[-- Attachment #2: gdb.base-Enable-macro-test-for-clang-compiler.patch --]
[-- Type: application/octet-stream, Size: 4235 bytes --]

From a18247948c5d4ce665c1abe280cece0703cec8be Mon Sep 17 00:00:00 2001
From: Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
Date: Mon, 15 Mar 2021 10:53:21 +0530
Subject: [PATCH] [gdb.base] Enable macro test for clang compiler

`clang` uses `-fdebug-macro` switch to enable debug-info
for macros.

gdb/testsuite/ChangeLog:

2021-03-15  Sourabh Singh Tomar  <SourabhSingh.Tomar@amd.com>

* gdb.base/info-macros.exp: Append -fdebug-macro to
  additional_flags for clang.
* gdb.base/macscp.exp: Likewise.
* gdb.base/style.exp: Likewise.
* gdb.linespec/macro-relative.exp: Likewise.
---
 gdb/testsuite/ChangeLog                       |  8 ++++++++
 gdb/testsuite/gdb.base/info-macros.exp        | 12 +++++++-----
 gdb/testsuite/gdb.base/macscp.exp             |  4 +++-
 gdb/testsuite/gdb.base/style.exp              |  5 ++++-
 gdb/testsuite/gdb.linespec/macro-relative.exp |  2 ++
 5 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 6eddfc16c39..ae49857fcc9 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2021-03-15  Sourabh Singh Tomar  <SourabhSingh.Tomar@amd.com>
+
+	* gdb.base/info-macros.exp: Append -fdebug-macro to
+	  additional_flags for clang.
+	* gdb.base/macscp.exp: Likewise.
+	* gdb.base/style.exp: Likewise.
+	* gdb.linespec/macro-relative.exp: Likewise.
+
 2021-03-12  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* gdb.python/py-bad-printers.exp: Extend test names to make them
diff --git a/gdb/testsuite/gdb.base/info-macros.exp b/gdb/testsuite/gdb.base/info-macros.exp
index 90da9dbe16d..9d63b9b5e6b 100644
--- a/gdb/testsuite/gdb.base/info-macros.exp
+++ b/gdb/testsuite/gdb.base/info-macros.exp
@@ -22,14 +22,16 @@ if [using_fission] {
 }
 
 get_compiler_info
-if ![test_compiler_info gcc*] {
-  untested "no compiler info"
-  return -1
-}
-
+if {[test_compiler_info gcc*]} {
 # Don't use "debug" here.  Otherwise "-g" would be appended to the gcc
 # command line, possibly overriding "-g3" (depending on gcc version).
 set options "additional_flags=-g3"
+} elseif {[test_compiler_info clang*]} {
+set options "additional_flags=-fdebug-macro"
+} else {
+  untested "no compiler info"
+  return -1
+}
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $options] } {
     return -1
diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp
index 724f7377b57..9d295ad20de 100644
--- a/gdb/testsuite/gdb.base/macscp.exp
+++ b/gdb/testsuite/gdb.base/macscp.exp
@@ -21,8 +21,10 @@ set objfile [standard_output_file ${testfile}.o]
 set options { debug additional_flags=-DFROM_COMMANDLINE=ARG}
 
 get_compiler_info
-if { [test_compiler_info "gcc-*"] || [test_compiler_info "clang-*"] } {
+if { [test_compiler_info "gcc-*"] } {
     lappend options additional_flags=-g3
+} elseif { [test_compiler_info "clang-*"] } {
+    lappend options additional_flags=-fdebug-macro
 }
 
 # Generate the intermediate object file.  This is required by Darwin to
diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
index 0754c9daa49..4a3428bc63f 100644
--- a/gdb/testsuite/gdb.base/style.exp
+++ b/gdb/testsuite/gdb.base/style.exp
@@ -21,9 +21,12 @@ standard_testfile
 set test_macros 0
 set options debug
 get_compiler_info
-if { [test_compiler_info "gcc-*"] || [test_compiler_info "clang-*"] } {
+if { [test_compiler_info "gcc-*"] } {
     lappend options additional_flags=-g3
     set test_macros 1
+} elseif { [test_compiler_info "clang-*"] } {
+    lappend options additional_flags=-fdebug-macro
+    set test_macros 1
 }
 
 if {[build_executable "failed to build" $testfile $srcfile $options]} {
diff --git a/gdb/testsuite/gdb.linespec/macro-relative.exp b/gdb/testsuite/gdb.linespec/macro-relative.exp
index 32375e5cb7c..c8e5b29d81f 100644
--- a/gdb/testsuite/gdb.linespec/macro-relative.exp
+++ b/gdb/testsuite/gdb.linespec/macro-relative.exp
@@ -31,6 +31,8 @@ set opts {debug additional_flags=-I.}
 get_compiler_info
 if [test_compiler_info gcc*] {
     lappend opts additional_flags=-g3
+} elseif [test_compiler_info clang*] {
+    lappend opts additional_flags=-fdebug-macro
 }
 
 if { [file pathtype $objdir] == "relative" } {
-- 
2.17.1


  reply	other threads:[~2021-03-15  5:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 15:45 Tomar, Sourabh Singh
2021-03-10 19:10 ` Tom Tromey
2021-03-12  5:38   ` Tomar, Sourabh Singh
2021-03-12 14:12     ` Tom Tromey
2021-03-15  5:47       ` Tomar, Sourabh Singh
2021-03-15  5:51         ` Tomar, Sourabh Singh [this message]
2021-03-15 19:40           ` Tom Tromey
2021-03-16  5:14             ` Tomar, Sourabh Singh
2021-03-19  5:43               ` Tomar, Sourabh Singh
2021-04-26 19:38               ` Simon Marchi

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=MW2PR12MB24740A70EEE2EC830683EB739D6C9@MW2PR12MB2474.namprd12.prod.outlook.com \
    --to=sourabhsingh.tomar@amd.com \
    --cc=AlokKumar.Sharma@amd.com \
    --cc=Bhuvanendra.KumarN@amd.com \
    --cc=JiniSusan.George@amd.com \
    --cc=Nagajyothi.E@amd.com \
    --cc=Nitika.Achra@amd.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).