This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/5] powerpc64-aix- xcoffread patch


powerpc-ibm-aix: Fix to skip reading symbols starting with @Fix.
	     	   Fix to read correct auxillary in case of multiple auxents.

Make fcn_start_addr large enough to hold 64 bit address.
i.e. file_ptr fcn_start_addr = 0;

Symbols starting with '@FIX' are used for TOC reference and need to be
skipped.

Make name of current file as pst->filename instead of _start_ as this does
not
handle the case when there are multiple auxillary entries,
eg: when compiled with 'xlc -qfuncsect' option.

We also need to read the correct auxillary entry.
i.e

bfd_coff_swap_aux_in (abfd,
                      raw_auxptr + ((coff_data (abfd)->local_symesz) *
(cs->c_naux - 1)),
                      cs->c_type, cs->c_sclass, cs->c_naux - 1, cs->c_naux,
&main_aux);

---
ChangeLog-
	* xcoffread.c (read_xcoff_symtab): Make fcn_start_addr
	large enough to hold 64-bit address.
	Make name of current file as pst->filename instead of _start_.
	Skip reading symbols starting with @FIX.
	Read correct auxilliary entry if the entries are more than
	1 in cases when binaries are compiled with xlc -qfunct.
---

Index: ./gdb/xcoffread.c
===================================================================
--- ./gdb.orig/xcoffread.c
+++ ./gdb/xcoffread.c
@@ -1012,7 +1012,7 @@ read_xcoff_symtab (struct objfile *objfi
   unsigned int max_symnum;
   int just_started = 1;
   int depth = 0;
-  int fcn_start_addr = 0;
+  file_ptr fcn_start_addr = 0;

   struct coff_symbol fcn_stab_saved = { 0 };

@@ -1020,7 +1020,7 @@ read_xcoff_symtab (struct objfile *objfi
   union internal_auxent fcn_aux_saved = main_aux;
   struct context_stack *new;

-  char *filestring = " _start_ ";	/* Name of the current file.  */
+  char *filestring = pst -> filename; /* Name of the current file.  */

   const char *last_csect_name;	/* Last seen csect's name.  */

@@ -1113,7 +1113,8 @@ read_xcoff_symtab (struct objfile *objfi
       }

       /* if symbol name starts with ".$" or "$", ignore it.  */
-      if (cs->c_name[0] == '$'
+      /* We also need to skip symbols starting with @FIX, which are used
for TOC reference */
+      if (cs->c_name[0] == '$' || !strncmp(cs->c_name, "@FIX", 4)
 	  || (cs->c_name[1] == '$' && cs->c_name[0] == '.'))
 	continue;

@@ -1133,8 +1134,7 @@ read_xcoff_symtab (struct objfile *objfi
 	  /* Done with all files, everything from here on is globals.  */
 	}

-      if ((cs->c_sclass == C_EXT || cs->c_sclass == C_HIDEXT)
-	  && cs->c_naux == 1)
+      if (cs->c_sclass == C_EXT || cs->c_sclass == C_HIDEXT)
 	{
 	  /* Dealing with a symbol with a csect entry.  */

@@ -1145,8 +1145,26 @@ read_xcoff_symtab (struct objfile *objfi
 #define	CSECT_SCLAS(PP) (CSECT(PP).x_smclas)

 	  /* Convert the auxent to something we can access.  */
-	  bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
-				0, cs->c_naux, &main_aux);
+             /* xcoff can have more than 1 auxent */
+             if (cs->c_naux > 1)
+               {
+                 if (ISFCN (cs->c_type) && cs->c_sclass != C_TPDEF)
+                  {
+                   bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type,
cs->c_sclass,
+                   0, cs->c_naux, &main_aux);
+                   goto function_entry_point;
+                  }
+            else
+                 bfd_coff_swap_aux_in (abfd,
+                                        raw_auxptr + ((coff_data (abfd)->
local_symesz) * (cs->c_naux - 1)),
+                                        cs->c_type, cs->c_sclass, cs->
c_naux - 1, cs->c_naux, &main_aux);
+               }
+             else if (cs->c_naux == 1)
+                 bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->
c_sclass,
+                                       0, cs->c_naux, &main_aux);
+             else
+                continue ;
+

 	  switch (CSECT_SMTYP (&main_aux))
 	    {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]