public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Natarajan, Kavitha" <Kavitha.Natarajan@amd.com>
To: Bruno Larsen <blarsen@redhat.com>,
	"Natarajan, Kavitha via Gdb-patches" <gdb-patches@sourceware.org>
Cc: "George, Jini Susan" <JiniSusan.George@amd.com>,
	"Parasuraman, Hariharan" <Hariharan.Parasuraman@amd.com>
Subject: RE: [PATCH] Debug support for global alias variable
Date: Mon, 28 Mar 2022 15:14:00 +0000	[thread overview]
Message-ID: <DM4PR12MB579617C9712B0F68CE8C3C70F71D9@DM4PR12MB5796.namprd12.prod.outlook.com> (raw)
In-Reply-To: <db7e61ce-a226-31c9-91a1-a7f0282607fd@redhat.com>

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

[AMD Official Use Only]

Hello Bruno,

Thanks for reviewing the patch. It helps a lot. Along with my responses to your questions,
I have also attached the new patch with the changes. Please review.

> > --- a/gdb/dwarf2/read.c
> > +++ b/gdb/dwarf2/read.c

> Could you have these have tabs instead of 8 spaces? This goes for all
> indentations that have at least 8 spaces, by the way.

The entire patch is fixed by replacing 8 spaces with tabs.

> Since we are using imported declarations for more than just namespaces,
> this line is not necessarily true always. I think read_alias is going to have to do
> this, but a comment explaining why this case is different to the ones around
> it is welcome.

Added comment and set the flag to false if it is not namespace alias in read_alias function.

> Could you align the && with the second open parenthesis of the if line? This
> would make the whole expression easier to read.

Done.

> We require 2 spaces after the period, even at the end of comments.

Done for the entire patch.

> If you look at the original code, you see that if a new symbol was allocated,
> the return is always 1. I think having a possibility that the symbol can be
> allocated and we still return 0 could be a problem, but I am not sure.
> Regardless, by this point (and the if block above) we are pretty sure that the
> DIE is indeed a namespace variable or a variable alias, so returning 0 if we
> can't find the location seems wrong, but I am not a DWARF reader expert, so
> take my ramblings with a grain of salt.

I agree. The symbol is an imported declaration and a new symbol is created for the same.
I don't see any condition when it doesn't satisfy if or else condition and return false.
I have slightly modified the code so the location is either unresolved or fixed from
the import variable.

> <side note> why is this function returning 1 or 0 as boolean, instead of the
> function returning bool?</side note>

The function shall return bool instead of int. Fixed in the new patch.

> Is this "else" path being exercised anywhere? For this simple code:
>
> namespace n{
>      int i;
>      int j;
>      void f(){ }
> }
>
> using n::i;
> using n::f;
>
> int var;
> extern int newvar __attribute__((alias("var")));
>
> int main(){
>      i = 0;
>      return 0;
> }
>

Imported declaration is emitted for namespace alias. If you declare as below
in the above program:

namespace m = n;

Clang will generate,

<1><23>: Abbrev Number: 2 (DW_TAG_namespace)
       <24>   DW_AT_name        : (indexed string: 0x3): n

[...]

<1><59>: Abbrev Number: 7 (DW_TAG_imported_declaration)
       <5a>   DW_AT_decl_file   : 0
       <5b>   DW_AT_decl_line   : 7
       <5c>   DW_AT_import      : <0x23>   [Abbrev Number: 2 (DW_TAG_namespace)]
       <60>   DW_AT_name        : (indexed string: 0xa): m

This is handled in the "else" path.

> > --- a/gdb/testsuite/gdb.base/symbol-alias.exp
> > +++ b/gdb/testsuite/gdb.base/symbol-alias.exp

> Since this is a new feature of clang and some tests run on quite old systems,
> could you try and detect the clang version, so you can have xfails for all
> aliases if the clang version doesn't emit this information?

Fixed. As of now, the clang version is checked for 14-0-0 and above. Can modify based on the version
in which this fix goes in finally. It should give 5 XFAILs for clang versions without the fix and 1 XFAIL
with the fix.
I have also added one more test point when the location information is missing (g_def_var2_alias2).

---------------
When clang emits the dwarf information of global alias variable
as DW_TAG_imported_declaration, gdb does not handle it. GDB reads
this tag as C++/fortran imported declaration (type alias, namespace
alias and fortran module). Added support to handle this tag as
alias variable.

This change fixes the failure in gdb.base/symbol-alias.exp testcase.
This testcase is also updated to test nested (recursive) alias.

Reviewed by: Bruno Larsen <blarsen@redhat.com>
---
 gdb/dwarf2/read.c                       | 74 +++++++++++++++++--------
 gdb/testsuite/gdb.base/symbol-alias.exp | 57 ++++++++++++++++++-
 gdb/testsuite/gdb.base/symbol-alias2.c  | 16 ++++++
 3 files changed, 121 insertions(+), 26 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index f9c942d91d3..6510dd94ac3 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -1132,6 +1132,10 @@ static void add_partial_subprogram (struct partial_die_info *pdi,
                                    CORE_ADDR *lowpc, CORE_ADDR *highpc,
                                    int need_pc, struct dwarf2_cu *cu);

+static void var_decode_location (struct attribute *attr,
+                                struct symbol *sym,
+                                struct dwarf2_cu *cu);
+
 static unsigned int peek_abbrev_code (bfd *, const gdb_byte *);

 static struct partial_die_info *load_partial_dies
@@ -1332,7 +1336,7 @@ static struct using_direct **using_directives (struct dwarf2_cu *cu);

 static void read_import_statement (struct die_info *die, struct dwarf2_cu *);

-static int read_namespace_alias (struct die_info *die, struct dwarf2_cu *cu);
+static bool read_alias (struct die_info *die, struct dwarf2_cu *cu);

 static struct type *read_module_type (struct die_info *die,
                                      struct dwarf2_cu *cu);
@@ -9741,10 +9745,14 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
       read_module (die, cu);
       break;
     case DW_TAG_imported_declaration:
+      /* If the imported declaration is for global variable alias,
+         this flag is set to false in read_alias function.  */
       cu->processing_has_namespace_info = true;
-      if (read_namespace_alias (die, cu))
+      if (((cu->per_cu->lang == language_c)
+          || (cu->per_cu->lang == language_cplus))
+         && read_alias (die, cu))
        break;
-      /* The declaration is not a global namespace alias.  */
+      /* The declaration is not a global namespace or variable alias.  */
       /* Fall through.  */
     case DW_TAG_imported_module:
       cu->processing_has_namespace_info = true;
@@ -10212,18 +10220,20 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
   return retval;
 }

-/* Inspect DIE in CU for a namespace alias.  If one exists, record
-   a new symbol for it.
+#define MAX_NESTED_IMPORTED_DECLARATIONS 100

-   Returns 1 if a namespace alias was recorded, 0 otherwise.  */
+/* Inspect DIE in CU for a namespace alias or a variable
+   with alias attribute. If one exists, record a new symbol
+   for it.

-static int
-read_namespace_alias (struct die_info *die, struct dwarf2_cu *cu)
+   Returns 1 if an alias was recorded, 0 otherwise.  */
+
+static bool
+read_alias (struct die_info *die, struct dwarf2_cu *cu)
 {
   struct attribute *attr;

-  /* If the die does not have a name, this is not a namespace
-     alias.  */
+  /* The die must have a name for namespace or variable alias.  */
   attr = dwarf2_attr (die, DW_AT_name, cu);
   if (attr != NULL)
     {
@@ -10232,13 +10242,12 @@ read_namespace_alias (struct die_info *die, struct dwarf2_cu *cu)
       struct dwarf2_cu *imported_cu = cu;

       /* If the compiler has nested DW_AT_imported_declaration DIEs,
-        keep inspecting DIEs until we hit the underlying import.  */
-#define MAX_NESTED_IMPORTED_DECLARATIONS 100
+         keep inspecting DIEs until we hit the underlying import.  */
       for (num = 0; num  < MAX_NESTED_IMPORTED_DECLARATIONS; ++num)
        {
          attr = dwarf2_attr (d, DW_AT_import, cu);
          if (attr == NULL)
-           break;
+           return false;

          d = follow_die_ref (d, attr, &imported_cu);
          if (d->tag != DW_TAG_imported_declaration)
@@ -10249,26 +10258,43 @@ read_namespace_alias (struct die_info *die, struct dwarf2_cu *cu)
        {
          complaint (_("DIE at %s has too many recursively imported "
                       "declarations"), sect_offset_str (d->sect_off));
-         return 0;
+         return false;
        }

       if (attr != NULL)
        {
          struct type *type;
-         sect_offset sect_off = attr->get_ref_die_offset ();
-
-         type = get_die_type_at_offset (sect_off, cu->per_cu, cu->per_objfile);
-         if (type != NULL && type->code () == TYPE_CODE_NAMESPACE)
+         if (d->tag == DW_TAG_variable)
            {
-             /* This declaration is a global namespace alias.  Add
-                a symbol for it whose type is the aliased namespace.  */
-             new_symbol (die, type, cu);
-             return 1;
+             /* This declaration is a global variable alias. Add
+                a symbol for it whose type is same as aliased variable.  */
+             type = die_type (d, imported_cu);
+             struct symbol *sym = new_symbol(die, type, cu);
+             attr = dwarf2_attr (d, DW_AT_location, imported_cu);
+             sym->set_aclass_index (LOC_UNRESOLVED);
+             if (attr != nullptr)
+               {
+                 var_decode_location (attr, sym, cu);
+               }
+             /* Reset the flag as it is not a namespace alias.  */
+             cu->processing_has_namespace_info = false;
+             return true;
+           }
+         else
+           {
+             sect_offset sect_off = attr->get_ref_die_offset ();
+             type = get_die_type_at_offset (sect_off, cu->per_cu, cu->per_objfile);
+             if (type != NULL && type->code () == TYPE_CODE_NAMESPACE)
+               {
+                 /* This declaration is a global namespace alias. Add
+                    a symbol for it whose type is the aliased namespace.  */
+                 new_symbol (die, type, cu);
+                 return true;
+               }
            }
        }
     }
-
-  return 0;
+  return false;
 }

 /* Return the using directives repository (global or local?) to use in the
diff --git a/gdb/testsuite/gdb.base/symbol-alias.exp b/gdb/testsuite/gdb.base/symbol-alias.exp
index 2b53cc31053..253a60d5403 100644
--- a/gdb/testsuite/gdb.base/symbol-alias.exp
+++ b/gdb/testsuite/gdb.base/symbol-alias.exp
@@ -15,6 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.

 standard_testfile symbol-alias.c symbol-alias2.c
+set using_clang [test_compiler_info {clang-1[4-9]-*-*}]

 if { [prepare_for_testing "failed to prepare" ${testfile} [list $srcfile $srcfile2]] } {
     return -1
@@ -31,6 +32,58 @@ foreach f {"func" "func_alias"} {
 }

 # Variables.
-foreach v {"g_var_s" "g_var_s_alias"} {
-    gdb_test "p $v" "= {field1 = 1, field2 = 2}"
+gdb_test "p g_var_s" "= {field1 = 1, field2 = 2}"
+foreach v {"g_var_s_alias" "g_var_s_alias2"} {
+    gdb_test_multiple "p $v" "p $v" {
+       -re  " = {field1 = 1, field2 = 2}.*$gdb_prompt $" {
+           pass "print alias of variable $v"
+       }
+       -re  ".*has unknown type; cast it to its declared type.*$gdb_prompt $" {
+           if { ! $using_clang } {
+               xfail "print alias variable $v"
+           } else {
+               fail "print alias variable $v"
+           }
+       }
+    }
+}
+
+# Static Variable.
+gdb_test "p g_var" " = 1"
+gdb_test_multiple "p g_var_alias" "p g_var_alias" {
+    -re  " = 1.*$gdb_prompt $" {
+       pass "print alias of static variable"
+    }
+    -re  ".*has unknown type; cast it to its declared type.*$gdb_prompt $" {
+       if { ! $using_clang } {
+         xfail "print alias of static variable"
+       } else {
+         fail "print alias of static variable"
+       }
+    }
+}
+
+# Deferred Variable.
+gdb_test "p g_def_var" " = 2"
+gdb_test_multiple "p g_def_var_alias" "p g_def_var_alias" {
+    -re  " = 2.*$gdb_prompt $" {
+       pass "print alias of deferred variable"
+    }
+    -re  ".*has unknown type; cast it to its declared type.*$gdb_prompt $" {
+       xfail "print alias of deferred variable"
+    }
+}
+
+# Alias of deferred Variable alias.
+gdb_test_multiple "p g_def_var2_alias2" "p g_def_var2_alias2" {
+    -re  " = 3.*$gdb_prompt $" {
+       pass "print alias of alias of deferred variable"
+    }
+    -re  ".*has unknown type; cast it to its declared type.*$gdb_prompt $" {
+       if { ! $using_clang } {
+         xfail "print alias of alias of deferred variable"
+       } else {
+         fail "print alias of alias of deferred variable"
+       }
+    }
 }
diff --git a/gdb/testsuite/gdb.base/symbol-alias2.c b/gdb/testsuite/gdb.base/symbol-alias2.c
index 34f4e121e25..41d4b6a53e5 100644
--- a/gdb/testsuite/gdb.base/symbol-alias2.c
+++ b/gdb/testsuite/gdb.base/symbol-alias2.c
@@ -23,6 +23,8 @@ struct S

 struct S g_var_s = { 1, 2 };

+static int g_var = 1;
+
 #ifdef __cplusplus
 /* So that the alias attribute below work without having to figure out
    this function's mangled name.  */
@@ -38,3 +40,17 @@ func (void)
 struct S *func_alias (void) __attribute__ ((alias ("func")));

 extern struct S g_var_s_alias __attribute__ ((alias ("g_var_s")));
+
+extern struct S g_var_s_alias2 __attribute__ ((alias ("g_var_s_alias")));
+
+extern int g_var_alias __attribute__ ((alias ("g_var")));
+
+extern int g_def_var_alias __attribute__ ((alias ("g_def_var")));
+
+int g_def_var = 2;
+
+extern int g_def_var2_alias __attribute__ ((alias ("g_def_var2")));
+
+int g_def_var2 = 3;
+
+extern int g_def_var2_alias2 __attribute__ ((alias ("g_def_var2_alias")));
--

Regards,
Kavitha

[-- Attachment #2: 0002-Debug-support-for-C-global-alias-variable-bruno.patch --]
[-- Type: application/octet-stream, Size: 9385 bytes --]

From d2d2f82d93f38575cb3f6fbd34acb3244cd63502 Mon Sep 17 00:00:00 2001
From: Kavitha Natarajan <kavitha.natarajan@amd.com>
Date: Mon, 28 Mar 2022 09:51:00 +0530
Subject: [PATCH] Debug support for global alias variable

When clang emits the dwarf information of global alias variable
as DW_TAG_imported_declaration, gdb does not handle it. GDB reads
this tag as C++/fortran imported declaration (type alias, namespace
alias and fortran module). Added support to handle this tag as
alias variable.

This change fixes the failure in gdb.base/symbol-alias.exp testcase.
This testcase is also updated to test nested (recursive) alias.

Reviewed by: Bruno Larsen <blarsen@redhat.com>
---
 gdb/dwarf2/read.c                       | 74 +++++++++++++++++--------
 gdb/testsuite/gdb.base/symbol-alias.exp | 57 ++++++++++++++++++-
 gdb/testsuite/gdb.base/symbol-alias2.c  | 16 ++++++
 3 files changed, 121 insertions(+), 26 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index f9c942d91d3..6510dd94ac3 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -1132,6 +1132,10 @@ static void add_partial_subprogram (struct partial_die_info *pdi,
 				    CORE_ADDR *lowpc, CORE_ADDR *highpc,
 				    int need_pc, struct dwarf2_cu *cu);
 
+static void var_decode_location (struct attribute *attr,
+				 struct symbol *sym,
+				 struct dwarf2_cu *cu);
+
 static unsigned int peek_abbrev_code (bfd *, const gdb_byte *);
 
 static struct partial_die_info *load_partial_dies
@@ -1332,7 +1336,7 @@ static struct using_direct **using_directives (struct dwarf2_cu *cu);
 
 static void read_import_statement (struct die_info *die, struct dwarf2_cu *);
 
-static int read_namespace_alias (struct die_info *die, struct dwarf2_cu *cu);
+static bool read_alias (struct die_info *die, struct dwarf2_cu *cu);
 
 static struct type *read_module_type (struct die_info *die,
 				      struct dwarf2_cu *cu);
@@ -9741,10 +9745,14 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
       read_module (die, cu);
       break;
     case DW_TAG_imported_declaration:
+      /* If the imported declaration is for global variable alias,
+         this flag is set to false in read_alias function.  */
       cu->processing_has_namespace_info = true;
-      if (read_namespace_alias (die, cu))
+      if (((cu->per_cu->lang == language_c)
+	   || (cu->per_cu->lang == language_cplus))
+	  && read_alias (die, cu))
 	break;
-      /* The declaration is not a global namespace alias.  */
+      /* The declaration is not a global namespace or variable alias.  */
       /* Fall through.  */
     case DW_TAG_imported_module:
       cu->processing_has_namespace_info = true;
@@ -10212,18 +10220,20 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
   return retval;
 }
 
-/* Inspect DIE in CU for a namespace alias.  If one exists, record
-   a new symbol for it.
+#define MAX_NESTED_IMPORTED_DECLARATIONS 100
 
-   Returns 1 if a namespace alias was recorded, 0 otherwise.  */
+/* Inspect DIE in CU for a namespace alias or a variable
+   with alias attribute. If one exists, record a new symbol
+   for it.
 
-static int
-read_namespace_alias (struct die_info *die, struct dwarf2_cu *cu)
+   Returns 1 if an alias was recorded, 0 otherwise.  */
+
+static bool
+read_alias (struct die_info *die, struct dwarf2_cu *cu)
 {
   struct attribute *attr;
 
-  /* If the die does not have a name, this is not a namespace
-     alias.  */
+  /* The die must have a name for namespace or variable alias.  */
   attr = dwarf2_attr (die, DW_AT_name, cu);
   if (attr != NULL)
     {
@@ -10232,13 +10242,12 @@ read_namespace_alias (struct die_info *die, struct dwarf2_cu *cu)
       struct dwarf2_cu *imported_cu = cu;
 
       /* If the compiler has nested DW_AT_imported_declaration DIEs,
-	 keep inspecting DIEs until we hit the underlying import.  */
-#define MAX_NESTED_IMPORTED_DECLARATIONS 100
+         keep inspecting DIEs until we hit the underlying import.  */
       for (num = 0; num  < MAX_NESTED_IMPORTED_DECLARATIONS; ++num)
 	{
 	  attr = dwarf2_attr (d, DW_AT_import, cu);
 	  if (attr == NULL)
-	    break;
+	    return false;
 
 	  d = follow_die_ref (d, attr, &imported_cu);
 	  if (d->tag != DW_TAG_imported_declaration)
@@ -10249,26 +10258,43 @@ read_namespace_alias (struct die_info *die, struct dwarf2_cu *cu)
 	{
 	  complaint (_("DIE at %s has too many recursively imported "
 		       "declarations"), sect_offset_str (d->sect_off));
-	  return 0;
+	  return false;
 	}
 
       if (attr != NULL)
 	{
 	  struct type *type;
-	  sect_offset sect_off = attr->get_ref_die_offset ();
-
-	  type = get_die_type_at_offset (sect_off, cu->per_cu, cu->per_objfile);
-	  if (type != NULL && type->code () == TYPE_CODE_NAMESPACE)
+	  if (d->tag == DW_TAG_variable)
 	    {
-	      /* This declaration is a global namespace alias.  Add
-		 a symbol for it whose type is the aliased namespace.  */
-	      new_symbol (die, type, cu);
-	      return 1;
+	      /* This declaration is a global variable alias. Add
+		 a symbol for it whose type is same as aliased variable.  */
+	      type = die_type (d, imported_cu);
+	      struct symbol *sym = new_symbol(die, type, cu);
+	      attr = dwarf2_attr (d, DW_AT_location, imported_cu);
+	      sym->set_aclass_index (LOC_UNRESOLVED);
+	      if (attr != nullptr)
+		{
+		  var_decode_location (attr, sym, cu);
+		}
+	      /* Reset the flag as it is not a namespace alias.  */
+	      cu->processing_has_namespace_info = false;
+	      return true;
+	    }
+	  else
+	    {
+	      sect_offset sect_off = attr->get_ref_die_offset ();
+	      type = get_die_type_at_offset (sect_off, cu->per_cu, cu->per_objfile);
+	      if (type != NULL && type->code () == TYPE_CODE_NAMESPACE)
+		{
+		  /* This declaration is a global namespace alias. Add
+		     a symbol for it whose type is the aliased namespace.  */
+		  new_symbol (die, type, cu);
+		  return true;
+		}
 	    }
 	}
     }
-
-  return 0;
+  return false;
 }
 
 /* Return the using directives repository (global or local?) to use in the
diff --git a/gdb/testsuite/gdb.base/symbol-alias.exp b/gdb/testsuite/gdb.base/symbol-alias.exp
index 2b53cc31053..253a60d5403 100644
--- a/gdb/testsuite/gdb.base/symbol-alias.exp
+++ b/gdb/testsuite/gdb.base/symbol-alias.exp
@@ -15,6 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 standard_testfile symbol-alias.c symbol-alias2.c
+set using_clang [test_compiler_info {clang-1[4-9]-*-*}]
 
 if { [prepare_for_testing "failed to prepare" ${testfile} [list $srcfile $srcfile2]] } {
     return -1
@@ -31,6 +32,58 @@ foreach f {"func" "func_alias"} {
 }
 
 # Variables.
-foreach v {"g_var_s" "g_var_s_alias"} {
-    gdb_test "p $v" "= {field1 = 1, field2 = 2}"
+gdb_test "p g_var_s" "= {field1 = 1, field2 = 2}"
+foreach v {"g_var_s_alias" "g_var_s_alias2"} {
+    gdb_test_multiple "p $v" "p $v" {
+	-re  " = {field1 = 1, field2 = 2}.*$gdb_prompt $" {
+	    pass "print alias of variable $v"
+	}
+	-re  ".*has unknown type; cast it to its declared type.*$gdb_prompt $" {
+	    if { ! $using_clang } {
+		xfail "print alias variable $v"
+	    } else {
+		fail "print alias variable $v"
+	    }
+	}
+    }
+}
+
+# Static Variable.
+gdb_test "p g_var" " = 1"
+gdb_test_multiple "p g_var_alias" "p g_var_alias" {
+    -re  " = 1.*$gdb_prompt $" {
+	pass "print alias of static variable"
+    }
+    -re  ".*has unknown type; cast it to its declared type.*$gdb_prompt $" {
+	if { ! $using_clang } {
+	  xfail "print alias of static variable"
+	} else {
+	  fail "print alias of static variable"
+	}
+    }
+}
+
+# Deferred Variable.
+gdb_test "p g_def_var" " = 2"
+gdb_test_multiple "p g_def_var_alias" "p g_def_var_alias" {
+    -re  " = 2.*$gdb_prompt $" {
+	pass "print alias of deferred variable"
+    }
+    -re  ".*has unknown type; cast it to its declared type.*$gdb_prompt $" {
+	xfail "print alias of deferred variable"
+    }
+}
+
+# Alias of deferred Variable alias.
+gdb_test_multiple "p g_def_var2_alias2" "p g_def_var2_alias2" {
+    -re  " = 3.*$gdb_prompt $" {
+	pass "print alias of alias of deferred variable"
+    }
+    -re  ".*has unknown type; cast it to its declared type.*$gdb_prompt $" {
+	if { ! $using_clang } {
+	  xfail "print alias of alias of deferred variable"
+	} else {
+	  fail "print alias of alias of deferred variable"
+	}
+    }
 }
diff --git a/gdb/testsuite/gdb.base/symbol-alias2.c b/gdb/testsuite/gdb.base/symbol-alias2.c
index 34f4e121e25..41d4b6a53e5 100644
--- a/gdb/testsuite/gdb.base/symbol-alias2.c
+++ b/gdb/testsuite/gdb.base/symbol-alias2.c
@@ -23,6 +23,8 @@ struct S
 
 struct S g_var_s = { 1, 2 };
 
+static int g_var = 1;
+
 #ifdef __cplusplus
 /* So that the alias attribute below work without having to figure out
    this function's mangled name.  */
@@ -38,3 +40,17 @@ func (void)
 struct S *func_alias (void) __attribute__ ((alias ("func")));
 
 extern struct S g_var_s_alias __attribute__ ((alias ("g_var_s")));
+
+extern struct S g_var_s_alias2 __attribute__ ((alias ("g_var_s_alias")));
+
+extern int g_var_alias __attribute__ ((alias ("g_var")));
+
+extern int g_def_var_alias __attribute__ ((alias ("g_def_var")));
+
+int g_def_var = 2;
+
+extern int g_def_var2_alias __attribute__ ((alias ("g_def_var2")));
+
+int g_def_var2 = 3;
+
+extern int g_def_var2_alias2 __attribute__ ((alias ("g_def_var2_alias")));
-- 
2.25.1


  reply	other threads:[~2022-03-28 15:14 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04 13:44 Natarajan, Kavitha
2022-03-14 11:15 ` Natarajan, Kavitha
2022-03-24  6:36   ` Natarajan, Kavitha
2022-03-24 13:53 ` Bruno Larsen
2022-03-28 15:14   ` Natarajan, Kavitha [this message]
2022-03-29 14:02     ` Bruno Larsen
2022-03-30 11:30       ` Natarajan, Kavitha
2022-03-30 12:25         ` Natarajan, Kavitha
2022-04-05  6:26           ` Natarajan, Kavitha
2022-04-05 13:33           ` Bruno Larsen
2022-04-05 14:02             ` Natarajan, Kavitha
2022-04-12  8:38             ` Natarajan, Kavitha
2022-04-15 16:06           ` Tom Tromey
2022-04-18 11:04             ` Natarajan, Kavitha
2022-04-18 15:03               ` Tom Tromey
2022-04-19 12:45                 ` Natarajan, Kavitha
2022-04-19 22:59                   ` Tom Tromey
2022-04-20  6:00                     ` Natarajan, Kavitha
2022-04-20 10:33                       ` Pedro Alves
2022-04-20 12:17                         ` Natarajan, Kavitha
2022-04-25 13:10                           ` Natarajan, Kavitha
2022-05-05  9:53                           ` Natarajan, Kavitha
2022-06-07  9:08                           ` Natarajan, Kavitha
2022-06-08 16:29                             ` Pedro Alves
2022-06-09 11:36                               ` Pedro Alves
2022-06-13 11:11                                 ` Natarajan, Kavitha
2022-06-13 13:54                                   ` Pedro Alves
2022-06-13 17:28                                     ` Natarajan, Kavitha

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=DM4PR12MB579617C9712B0F68CE8C3C70F71D9@DM4PR12MB5796.namprd12.prod.outlook.com \
    --to=kavitha.natarajan@amd.com \
    --cc=Hariharan.Parasuraman@amd.com \
    --cc=JiniSusan.George@amd.com \
    --cc=blarsen@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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).