public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [gdb.base] Enable macro test for clang compiler
@ 2021-03-10 15:45 Tomar, Sourabh Singh
  2021-03-10 19:10 ` Tom Tromey
  0 siblings, 1 reply; 10+ messages in thread
From: Tomar, Sourabh Singh @ 2021-03-10 15:45 UTC (permalink / raw)
  To: gdb-patches
  Cc: George, Jini Susan, Sharma, Alok Kumar, Achra, Nitika, Kumar N,
	 Bhuvanendra, E, Nagajyothi

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

[AMD Public Use]

Hi Everyone,

Requesting review on this patch, Please have a look.

Problem Description/Summary:
- clang compiler uses `-fdebug-macro` for the generating debug-info for macro's. Previously
Test `gdb/testsuite/gdb.base/macscp.exp` was appending `-g3` for `clang` compiler also. Resulting
In following error in `gdb.sum`:
```
UNSUPPORTED: gdb.base/macscp.exp: skipping test because debug information does not include macro 
information.
```
- This patch appends `-fdebug-macro` for clang compiler specifically.
- After this patch, above described error is resolved and all test cases are getting enabled and
tested with clang compiler.

gdb/testsuite/ChangeLog:

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

           * gdb.base/macscp.exp: Remove -g3 from additional_flags and
           append -fdebug-macro to additional_flags for clang.

Thank You so much!
Sourabh Singh Tomar

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

From 8982fb7a9507e15dfb77266f90c594b7c48e0321 Mon Sep 17 00:00:00 2001
From: Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
Date: Wed, 10 Mar 2021 20:27:22 +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-10  Sourabh Singh Tomar  <SourabhSingh.Tomar@amd.com>

       * gdb.base/macscp.exp: Remove -g3 from additional_flags and
       append -fdebug-macro to additional_flags for clang.
---
 gdb/testsuite/ChangeLog           | 5 +++++
 gdb/testsuite/gdb.base/macscp.exp | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 5767fa562c6..56653a25251 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -10902,6 +10902,11 @@
 
 	* gdb.base/macscp.exp: Append -g3 to additional_flags for clang.
 
+2021-03-10  Sourabh Singh Tomar  <SourabhSingh.Tomar@amd.com>
+
+	* gdb.base/macscp.exp: Remove -g3 from additional_flags and
+	append -fdebug-macro to additional_flags for clang.
+
 2017-11-22  Simon Marchi  <simon.marchi@ericsson.com>
 
 	* gdb.opt/inline-locals.exp: Mark tests as KFAIL.
diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp
index 724f7377b57..cbbdab526a4 100644
--- a/gdb/testsuite/gdb.base/macscp.exp
+++ b/gdb/testsuite/gdb.base/macscp.exp
@@ -21,10 +21,15 @@ 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
 }
 
+get_compiler_info
+if { [test_compiler_info "clang-*"] } {
+    lappend options additional_flags=-fdebug-macro
+}
+
 # Generate the intermediate object file.  This is required by Darwin to
 # have access to the .debug_macinfo section.
 if  {[gdb_compile "${srcdir}/${subdir}/macscp1.c" "${objfile}" \
-- 
2.17.1


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

* Re: [PATCH] [gdb.base] Enable macro test for clang compiler
  2021-03-10 15:45 [PATCH] [gdb.base] Enable macro test for clang compiler Tomar, Sourabh Singh
@ 2021-03-10 19:10 ` Tom Tromey
  2021-03-12  5:38   ` Tomar, Sourabh Singh
  0 siblings, 1 reply; 10+ messages in thread
From: Tom Tromey @ 2021-03-10 19:10 UTC (permalink / raw)
  To: Tomar, Sourabh Singh via Gdb-patches
  Cc: Tomar, Sourabh Singh, George, Jini Susan, Achra, Nitika, Sharma,
	Alok Kumar, E, Nagajyothi, Kumar N, Bhuvanendra

>>>>> ">" == Tomar, Sourabh Singh via Gdb-patches <gdb-patches@sourceware.org> writes:

>> Requesting review on this patch, Please have a look.

Thank you.

>>  	* gdb.base/macscp.exp: Append -g3 to additional_flags for clang.
 
>> +2021-03-10  Sourabh Singh Tomar  <SourabhSingh.Tomar@amd.com>
>> +
>> +	* gdb.base/macscp.exp: Remove -g3 from additional_flags and
>> +	append -fdebug-macro to additional_flags for clang.
>> +

This diff seems a little weird - there are newer ChangeLog entries
visible.

Maybe you have other patches after this one ... that's fine, but it's
good usually to make a new branch when submitting to avoid this kind of
thing.

 
>>  get_compiler_info
>> -if { [test_compiler_info "gcc-*"] || [test_compiler_info "clang-*"] } {
>> +if { [test_compiler_info "gcc-*"] } {
>>      lappend options additional_flags=-g3
>>  }
 
>> +get_compiler_info
>> +if { [test_compiler_info "clang-*"] } {
>> +    lappend options additional_flags=-fdebug-macro
>> +}

I suspect the second call to get_compiler_info isn't needed, and this
could be phrased as "else if { ... clang ... }".

Tom

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

* RE: [PATCH] [gdb.base] Enable macro test for clang compiler
  2021-03-10 19:10 ` Tom Tromey
@ 2021-03-12  5:38   ` Tomar, Sourabh Singh
  2021-03-12 14:12     ` Tom Tromey
  0 siblings, 1 reply; 10+ messages in thread
From: Tomar, Sourabh Singh @ 2021-03-12  5:38 UTC (permalink / raw)
  To: Tom Tromey, Tomar, Sourabh Singh via Gdb-patches
  Cc: George, Jini Susan, Achra, Nitika, Sharma, Alok Kumar, E,
	Nagajyothi, Kumar N, Bhuvanendra

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

[AMD Public Use]

Hi Tom,

Thanks for reviewing this!

>>>      * gdb.base/macscp.exp: Append -g3 to additional_flags for clang.

>>> +2021-03-10  Sourabh Singh Tomar  <SourabhSingh.Tomar@amd.com>
>>> +
>>> +    * gdb.base/macscp.exp: Remove -g3 from additional_flags and
>>> +    append -fdebug-macro to additional_flags for clang.
>>>+
>>>This diff seems a little weird - there are newer ChangeLog entries visible.

Thanks for suggestion/correction. Cleaned the changelog.

>>>I suspect the second call to get_compiler_info isn't needed, and this could be phrased as "else if { ... clang ... }".

Done. Thanks!

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

Thanks,
Sourabh.

-----Original Message-----
From: Tom Tromey <tom@tromey.com> 
Sent: Thursday, March 11, 2021 12:40 AM
To: Tomar, Sourabh Singh via Gdb-patches <gdb-patches@sourceware.org>
Cc: 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>; E, Nagajyothi <Nagajyothi.E@amd.com>; Kumar N, Bhuvanendra <Bhuvanendra.KumarN@amd.com>
Subject: Re: [PATCH] [gdb.base] Enable macro test for clang compiler

[CAUTION: External Email]

>>>>> ">" == Tomar, Sourabh Singh via Gdb-patches <gdb-patches@sourceware.org> writes:

>> Requesting review on this patch, Please have a look.

Thank you.

>>      * gdb.base/macscp.exp: Append -g3 to additional_flags for clang.

>> +2021-03-10  Sourabh Singh Tomar  <SourabhSingh.Tomar@amd.com>
>> +
>> +    * gdb.base/macscp.exp: Remove -g3 from additional_flags and
>> +    append -fdebug-macro to additional_flags for clang.
>> +

This diff seems a little weird - there are newer ChangeLog entries visible.

Maybe you have other patches after this one ... that's fine, but it's good usually to make a new branch when submitting to avoid this kind of thing.


>>  get_compiler_info
>> -if { [test_compiler_info "gcc-*"] || [test_compiler_info "clang-*"] 
>> } {
>> +if { [test_compiler_info "gcc-*"] } {
>>      lappend options additional_flags=-g3  }

>> +get_compiler_info
>> +if { [test_compiler_info "clang-*"] } {
>> +    lappend options additional_flags=-fdebug-macro }

I suspect the second call to get_compiler_info isn't needed, and this could be phrased as "else if { ... clang ... }".

Tom

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

From 3805cb1f51b017ebf32c0a1822d2c4dca07f7dad Mon Sep 17 00:00:00 2001
From: Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
Date: Fri, 12 Mar 2021 10:47:38 +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-10  Sourabh Singh Tomar  <SourabhSingh.Tomar@amd.com>

* gdb.base/macscp.exp: Remove -g3 from additional_flags and
  append -fdebug-macro to additional_flags for clang.
---
 gdb/testsuite/ChangeLog           | 5 +++++
 gdb/testsuite/gdb.base/macscp.exp | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 4ea506cc9df..bcb20baaea7 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2021-03-10  Sourabh Singh Tomar  <SourabhSingh.Tomar@amd.com>
+
+	* gdb.base/macscp.exp: Remove -g3 from additional_flags and
+	append -fdebug-macro to additional_flags for clang.
+
 2021-03-09  Tom Tromey  <tromey@adacore.com>
 
 	* gdb.base/cast-call.exp: New file.
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
-- 
2.17.1


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

* Re: [PATCH] [gdb.base] Enable macro test for clang compiler
  2021-03-12  5:38   ` Tomar, Sourabh Singh
@ 2021-03-12 14:12     ` Tom Tromey
  2021-03-15  5:47       ` Tomar, Sourabh Singh
  0 siblings, 1 reply; 10+ messages in thread
From: Tom Tromey @ 2021-03-12 14:12 UTC (permalink / raw)
  To: Tomar, Sourabh Singh via Gdb-patches
  Cc: Tom Tromey, Tomar, Sourabh Singh, George, Jini Susan, Achra,
	Nitika, Sharma, Alok Kumar, Kumar N, Bhuvanendra, E, Nagajyothi

>> 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

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

* RE: [PATCH] [gdb.base] Enable macro test for clang compiler
  2021-03-12 14:12     ` Tom Tromey
@ 2021-03-15  5:47       ` Tomar, Sourabh Singh
  2021-03-15  5:51         ` Tomar, Sourabh Singh
  0 siblings, 1 reply; 10+ messages in thread
From: Tomar, Sourabh Singh @ 2021-03-15  5:47 UTC (permalink / raw)
  To: Tom Tromey, Tomar, Sourabh Singh via Gdb-patches
  Cc: George, Jini Susan, Achra, Nitika, Sharma, Alok Kumar, Kumar N,
	Bhuvanendra, E, Nagajyothi

[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

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

* RE: [PATCH] [gdb.base] Enable macro test for clang compiler
  2021-03-15  5:47       ` Tomar, Sourabh Singh
@ 2021-03-15  5:51         ` Tomar, Sourabh Singh
  2021-03-15 19:40           ` Tom Tromey
  0 siblings, 1 reply; 10+ messages in thread
From: Tomar, Sourabh Singh @ 2021-03-15  5:51 UTC (permalink / raw)
  To: Tom Tromey, Tomar, Sourabh Singh via Gdb-patches
  Cc: George, Jini Susan, Achra, Nitika, Sharma, Alok Kumar, Kumar N,
	Bhuvanendra, E, Nagajyothi

[-- 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


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

* Re: [PATCH] [gdb.base] Enable macro test for clang compiler
  2021-03-15  5:51         ` Tomar, Sourabh Singh
@ 2021-03-15 19:40           ` Tom Tromey
  2021-03-16  5:14             ` Tomar, Sourabh Singh
  0 siblings, 1 reply; 10+ messages in thread
From: Tom Tromey @ 2021-03-15 19:40 UTC (permalink / raw)
  To: Tomar, Sourabh Singh via Gdb-patches
  Cc: Tom Tromey, Tomar, Sourabh Singh, George, Jini Susan, Achra,
	Nitika, Sharma, Alok Kumar, E, Nagajyothi, Kumar N, Bhuvanendra

>>>>> ">" == Tomar, Sourabh Singh via Gdb-patches <gdb-patches@sourceware.org> writes:

>> Apologies missed the attachment/patch.

No worries.

>> 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.

This is ok with one minor tweak.  If you have write access (I didn't
look) you can just fix it up and check it in.

>> +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
>> +}

The body of the if/elseif/else blocks should be indented.
For Tcl, GDB uses a 4 space indent.

thanks,
Tom

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

* RE: [PATCH] [gdb.base] Enable macro test for clang compiler
  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
  0 siblings, 2 replies; 10+ messages in thread
From: Tomar, Sourabh Singh @ 2021-03-16  5:14 UTC (permalink / raw)
  To: Tom Tromey, Tomar, Sourabh Singh via Gdb-patches
  Cc: George, Jini Susan, Achra, Nitika, Sharma, Alok Kumar, E,
	Nagajyothi, Kumar N, Bhuvanendra

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

[AMD Public Use]

Hi Tom,

>> This is ok with one minor tweak.  If you have write access (I didn't
>> look) you can just fix it up and check it in.
Thanks for reviewing this! I have made the suggested changes. I do not have write access(as of now),
Could you please commit this on my behalf 😊

>> The body of the if/elseif/else blocks should be indented.
>> For Tcl, GDB uses a 4 space indent.
Thanks for the pointers, I'll keep this in mind for future reviews/patches.

ChangeLog:
gdb/testsuite/ChangeLog
2021-03-16  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.

Thanks,
Sourabh.

-----Original Message-----
From: Tom Tromey <tom@tromey.com> 
Sent: Tuesday, March 16, 2021 1:11 AM
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>; E, Nagajyothi <Nagajyothi.E@amd.com>; Kumar N, Bhuvanendra <Bhuvanendra.KumarN@amd.com>
Subject: Re: [PATCH] [gdb.base] Enable macro test for clang compiler

[CAUTION: External Email]

>>>>> ">" == Tomar, Sourabh Singh via Gdb-patches <gdb-patches@sourceware.org> writes:

>> Apologies missed the attachment/patch.

No worries.

>> 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.

This is ok with one minor tweak.  If you have write access (I didn't
look) you can just fix it up and check it in.

>> +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
>> +}

The body of the if/elseif/else blocks should be indented.
For Tcl, GDB uses a 4 space indent.

thanks,
Tom

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

From 519c45ce18827be589a33440c97e3f9b8ff8219a Mon Sep 17 00:00:00 2001
From: Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
Date: Tue, 16 Mar 2021 10:27:01 +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-16  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        | 16 +++++++++-------
 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, 26 insertions(+), 9 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 6eddfc16c39..7a16d36f2c8 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2021-03-16  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..c75229f80d9 100644
--- a/gdb/testsuite/gdb.base/info-macros.exp
+++ b/gdb/testsuite/gdb.base/info-macros.exp
@@ -22,15 +22,17 @@ 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
 }
 
-# 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"
-
 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


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

* RE: [PATCH] [gdb.base] Enable macro test for clang compiler
  2021-03-16  5:14             ` Tomar, Sourabh Singh
@ 2021-03-19  5:43               ` Tomar, Sourabh Singh
  2021-04-26 19:38               ` Simon Marchi
  1 sibling, 0 replies; 10+ messages in thread
From: Tomar, Sourabh Singh @ 2021-03-19  5:43 UTC (permalink / raw)
  To: Tom Tromey, Tomar, Sourabh Singh via Gdb-patches

[AMD Public Use]

Hi Tom,

We've committed the patch, I've asked a colleague of mine who has write access.

Details:
commit a088215ae37be0f44bce508ca0050fe9149beb39 (HEAD -> master, origin/master, origin/HEAD)
Author: Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
Date:   Fri Mar 19 10:37:58 2021 +0530
...

Thanks,
Sourabh.

-----Original Message-----
From: Tomar, Sourabh Singh
Sent: Tuesday, March 16, 2021 10:44 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>; E, Nagajyothi <Nagajyothi.E@amd.com>; Kumar N, Bhuvanendra <Bhuvanendra.KumarN@amd.com>
Subject: RE: [PATCH] [gdb.base] Enable macro test for clang compiler

[AMD Public Use]

Hi Tom,

>> This is ok with one minor tweak.  If you have write access (I didn't
>> look) you can just fix it up and check it in.
Thanks for reviewing this! I have made the suggested changes. I do not have write access(as of now), Could you please commit this on my behalf 😊

>> The body of the if/elseif/else blocks should be indented.
>> For Tcl, GDB uses a 4 space indent.
Thanks for the pointers, I'll keep this in mind for future reviews/patches.

ChangeLog:
gdb/testsuite/ChangeLog
2021-03-16  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.

Thanks,
Sourabh.

-----Original Message-----
From: Tom Tromey <tom@tromey.com>
Sent: Tuesday, March 16, 2021 1:11 AM
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>; E, Nagajyothi <Nagajyothi.E@amd.com>; Kumar N, Bhuvanendra <Bhuvanendra.KumarN@amd.com>
Subject: Re: [PATCH] [gdb.base] Enable macro test for clang compiler

[CAUTION: External Email]

>>>>> ">" == Tomar, Sourabh Singh via Gdb-patches <gdb-patches@sourceware.org> writes:

>> Apologies missed the attachment/patch.

No worries.

>> 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.

This is ok with one minor tweak.  If you have write access (I didn't
look) you can just fix it up and check it in.

>> +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
>> +}

The body of the if/elseif/else blocks should be indented.
For Tcl, GDB uses a 4 space indent.

thanks,
Tom

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

* Re: [PATCH] [gdb.base] Enable macro test for clang compiler
  2021-03-16  5:14             ` Tomar, Sourabh Singh
  2021-03-19  5:43               ` Tomar, Sourabh Singh
@ 2021-04-26 19:38               ` Simon Marchi
  1 sibling, 0 replies; 10+ messages in thread
From: Simon Marchi @ 2021-04-26 19:38 UTC (permalink / raw)
  To: Tomar, Sourabh Singh, Tom Tromey, Tomar, Sourabh Singh via Gdb-patches
  Cc: George, Jini Susan, Achra, Nitika, Sharma, Alok Kumar, Kumar N,
	Bhuvanendra, E, Nagajyothi

On 2021-03-16 1:14 a.m., Tomar, Sourabh Singh via Gdb-patches wrote:
> [AMD Public Use]
> 
> Hi Tom,
> 
>>> This is ok with one minor tweak.  If you have write access (I didn't
>>> look) you can just fix it up and check it in.
> Thanks for reviewing this! I have made the suggested changes. I do not have write access(as of now),
> Could you please commit this on my behalf 😊
> 
>>> The body of the if/elseif/else blocks should be indented.
>>> For Tcl, GDB uses a 4 space indent.
> Thanks for the pointers, I'll keep this in mind for future reviews/patches.
> 
> ChangeLog:
> gdb/testsuite/ChangeLog
> 2021-03-16  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.
> 
> Thanks,
> Sourabh.

Hi all,

This pattern will likely come up again in:

    https://sourceware.org/pipermail/gdb-patches/2021-April/178210.html

I was thinking that we could come up with a new options keyword to
gdb_compile denoting that we want to include macros in the debug info?
This way the individual tests wouldn't have to know each compiler.
Something like:

  gdb_compile ... {debug macros}

or
  gdb_compile ... {debug-macros}

Simon

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

end of thread, other threads:[~2021-04-26 19:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 15:45 [PATCH] [gdb.base] Enable macro test for clang compiler 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
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

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).