[09/11] gdb/testsuite: fix gdb.cp/converts.exp to run with clang

Message ID 20221004170747.154307-11-blarsen@redhat.com
State Committed
Commit 1e7416363963e27c8d122bee2397d4b48a482ec3
Headers
Series Cleanup gdb.cp tests when running with clang |

Commit Message

Guinevere Larsen Oct. 4, 2022, 5:07 p.m. UTC
  Clang attempts to minimize the size of the debug-info by not adding
complete information about types that aren't constructed in a given
file.  In specific, this meant that there was minimal information about
class B in the test gdb.cp/converts.exp.  To fix this, we just need to
construct any object of type B in that file.
---
 gdb/testsuite/gdb.cp/converts.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Andrew Burgess Oct. 26, 2022, 3:54 p.m. UTC | #1
Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org> writes:

> Clang attempts to minimize the size of the debug-info by not adding
> complete information about types that aren't constructed in a given
> file.  In specific, this meant that there was minimal information about

s/In specific/Specifically/.

> class B in the test gdb.cp/converts.exp.  To fix this, we just need to
> construct any object of type B in that file.
> ---
>  gdb/testsuite/gdb.cp/converts.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gdb/testsuite/gdb.cp/converts.cc b/gdb/testsuite/gdb.cp/converts.cc
> index ecf806481fd..1224581a879 100644
> --- a/gdb/testsuite/gdb.cp/converts.cc
> +++ b/gdb/testsuite/gdb.cp/converts.cc
> @@ -55,7 +55,7 @@ int main()
>  
>    char av = 'a';
>    char *a = &av;       // pointer to..
> -  B *bp;
> +  B *bp = new B();

LGTM.

Thanks,
Andrew

>    foo1_1 (a);          // ..pointer
>    foo1_2 (a);          // ..array
>    foo1_3 ((int*)a);    // ..pointer of wrong type
> -- 
> 2.37.3
  
Guinevere Larsen Oct. 31, 2022, 12:46 p.m. UTC | #2
On 26/10/2022 17:54, Andrew Burgess wrote:
> Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org> writes:
>
>> Clang attempts to minimize the size of the debug-info by not adding
>> complete information about types that aren't constructed in a given
>> file.  In specific, this meant that there was minimal information about
> s/In specific/Specifically/.
>
>> class B in the test gdb.cp/converts.exp.  To fix this, we just need to
>> construct any object of type B in that file.
>> ---
>>   gdb/testsuite/gdb.cp/converts.cc | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/gdb/testsuite/gdb.cp/converts.cc b/gdb/testsuite/gdb.cp/converts.cc
>> index ecf806481fd..1224581a879 100644
>> --- a/gdb/testsuite/gdb.cp/converts.cc
>> +++ b/gdb/testsuite/gdb.cp/converts.cc
>> @@ -55,7 +55,7 @@ int main()
>>   
>>     char av = 'a';
>>     char *a = &av;       // pointer to..
>> -  B *bp;
>> +  B *bp = new B();
> LGTM.
Thanks! I pushed with the change to the commit message.

Cheers,
Bruno

>
> Thanks,
> Andrew
>
>>     foo1_1 (a);          // ..pointer
>>     foo1_2 (a);          // ..array
>>     foo1_3 ((int*)a);    // ..pointer of wrong type
>> -- 
>> 2.37.3
  

Patch

diff --git a/gdb/testsuite/gdb.cp/converts.cc b/gdb/testsuite/gdb.cp/converts.cc
index ecf806481fd..1224581a879 100644
--- a/gdb/testsuite/gdb.cp/converts.cc
+++ b/gdb/testsuite/gdb.cp/converts.cc
@@ -55,7 +55,7 @@  int main()
 
   char av = 'a';
   char *a = &av;       // pointer to..
-  B *bp;
+  B *bp = new B();
   foo1_1 (a);          // ..pointer
   foo1_2 (a);          // ..array
   foo1_3 ((int*)a);    // ..pointer of wrong type