public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-jankratochvil-fedora-merge: cherry-pick: Corrected search sequence, and added test.
@ 2009-03-27  0:35 jkratoch
  0 siblings, 0 replies; only message in thread
From: jkratoch @ 2009-03-27  0:35 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-fedora-merge has been updated
       via  16328456d5740917ade0a49bcecc14c4564b9a99 (commit)
       via  2962ee436d84a03962ec484828245dfcba867185 (commit)
      from  230be085c1bb4507c3355ba3d73095e465498593 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 16328456d5740917ade0a49bcecc14c4564b9a99
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Mar 26 23:16:40 2009 +0100

    cherry-pick: Corrected search sequence, and added test.
    
    [archer-keiths-expr-cumulative] 3ebbd04cee427232781580ec88e5d1ea854d1012
    
    2009-03-26  Sami Wagiaalla  <swagiaal@redhat.com>
    
    	* symtab.c (lookup_symbol_aux): Moved check for member variables
    	from here...
    	(lookup_symbol_aux_local): ...to here.
    	Check check namespace scope at every block level.
    
    2009-03-26  Sami Wagiaalla  <swagiaal@redhat.com>
    
    	* gdb.cp/shadowing.cc: New test program.
    	* gdb.cp/shadowing.exp: New test.
    
    Conflicts:
    
    	gdb/ChangeLog

commit 2962ee436d84a03962ec484828245dfcba867185
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Wed Mar 25 22:17:57 2009 +0100

    Rebase from archer-jankratochvil-expr to archer-keiths-expr-cumulative.

-----------------------------------------------------------------------

Summary of changes:
 gdb/dbxread.c    |    4 +-
 gdb/dwarf2read.c |   26 +++++++++------
 gdb/stabsread.c  |   15 +--------
 gdb/symtab.c     |   92 +++++++++++++++++++++++++++++------------------------
 4 files changed, 68 insertions(+), 69 deletions(-)

First 500 lines of diff:
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 7f756af..23ea50c 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -1188,8 +1188,6 @@ read_dbx_symtab (struct objfile *objfile)
   struct internal_nlist nlist;
   CORE_ADDR text_addr;
   int text_size;
-  char *sym_name;
-  int sym_len;
 
   char *namestring;
   int nsl;
@@ -1200,6 +1198,8 @@ read_dbx_symtab (struct objfile *objfile)
   bfd *abfd;
   int textlow_not_set;
   int data_sect_index;
+  char *sym_name;
+  int sym_len;
 
   /* Current partial symtab */
   struct partial_symtab *pst;
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 71fed38..da309dd 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -967,10 +967,10 @@ static void read_common_block (struct die_info *, struct dwarf2_cu *);
 
 static void read_namespace (struct die_info *die, struct dwarf2_cu *);
 
-static void read_module (struct die_info *die, struct dwarf2_cu *cu);
-
 static void read_import_statement (struct die_info *die, struct dwarf2_cu *);
 
+static void read_module (struct die_info *die, struct dwarf2_cu *cu);
+
 static const char *namespace_name (struct die_info *die,
 				   int *is_anonymous, struct dwarf2_cu *);
 
@@ -1792,7 +1792,8 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline)
 
 	  first_die = load_partial_dies (abfd, info_ptr, 1, &cu);
 
-	  scan_partial_symbols (first_die, &lowpc, &highpc, ! has_pc_info, &cu);
+	  scan_partial_symbols (first_die, &lowpc, &highpc,
+				! has_pc_info, &cu);
 
 	  /* If we didn't find a lowpc, set it to highpc to avoid
 	     complaints from `maint check'.  */
@@ -1810,6 +1811,13 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline)
       pst->textlow = best_lowpc + baseaddr;
       pst->texthigh = best_highpc + baseaddr;
 
+      /* Store the contiguous range; `DW_AT_ranges' range is stored above.  The
+         range can be also empty for CUs with no code.  */
+      if (dwarf2_attr (comp_unit_die, DW_AT_ranges, &cu) == NULL
+	  && pst->textlow < pst->texthigh)
+	addrmap_set_empty (objfile->psymtabs_addrmap, pst->textlow,
+			   pst->texthigh - 1, pst);
+
       pst->n_global_syms = objfile->global_psymbols.next -
 	(objfile->global_psymbols.list + pst->globals_offset);
       pst->n_static_syms = objfile->static_psymbols.next -
@@ -3110,7 +3118,7 @@ dwarf2_full_name (struct die_info *die, struct dwarf2_cu *cu)
 }
 
 /* read the given die's decl_line number. Return -1 if in case of an error */
-static int dwarf2_read_decl_line (struct die_info *die, struct dwarf2_cu *cu){
+static const int dwarf2_read_decl_line (struct die_info *die, struct dwarf2_cu *cu){
   struct attribute *line_attr;
 
   line_attr = dwarf2_attr (die, DW_AT_decl_line, cu);
@@ -3461,7 +3469,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
   char *name;
   CORE_ADDR baseaddr;
   struct block *block;
-  unsigned die_children = 0;
+  unsigned die_children;
 
   baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 
@@ -3473,6 +3481,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
     /* explore abstract origins if present. They might contain useful information
      such as import statements. */
     child_die = die->child;
+    die_children = 0;
     while (child_die && child_die->tag)
       {
 	child_die = sibling_die (child_die);
@@ -3481,7 +3490,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
     explore_abstract_origin(die, cu, &die_children);
     return;
   }
-  
+
   lowpc += baseaddr;
   highpc += baseaddr;
 
@@ -3591,8 +3600,6 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
       do_cleanups (cleanups);
     }
 
-  explore_abstract_origin(die, cu, &die_children);
-
   new = pop_context ();
   /* Make a block for the local symbols within.  */
   block = finish_block (new->name, &local_symbols, new->old_blocks,
@@ -8215,8 +8222,6 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
       /* Some methods are called without checking SYMBOL_OPS validity.  */
       SYMBOL_OPS (sym) = &dwarf2_missing_funcs;
 
-      SYMBOL_LANGUAGE (sym) = cu->language;
-
       /* Cache this symbol's name and the name's demangled form (if any).  */
 
       linkagename = dwarf2_linkage_name (die, cu);
@@ -10003,7 +10008,6 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
 	  break;
 	case DW_FORM_string:
 	case DW_FORM_strp:
-	case GDB_FORM_cached_string:
 	  fprintf_unfiltered (f, "string: \"%s\"",
 		   DW_STRING (&die->attrs[i])
 		   ? DW_STRING (&die->attrs[i]) : "");
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 7423b32..3b8eb29 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -701,20 +701,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
 	SYMBOL_SET_NAMES (sym, string, p - string, objfile);
 
       if (SYMBOL_LANGUAGE (sym) == language_cplus)
-	{
-	  char *name = alloca (p - string + 1);
-	  memcpy (name, string, p - string);
-	  name[p - string] = '\0';
-	  new_name = cp_canonicalize_string (name);
-	  cp_scan_for_anonymous_namespaces (sym);
-	}
-      if (new_name != NULL)
-	{
-	  SYMBOL_SET_NAMES (sym, new_name, strlen (new_name), objfile);
-	  xfree (new_name);
-	}
-      else
-	SYMBOL_SET_NAMES (sym, string, p - string, objfile);
+        cp_scan_for_anonymous_namespaces (sym);
     }
   p++;
 
diff --git a/gdb/symtab.c b/gdb/symtab.c
index b4da8c1..c1c4459 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -96,7 +96,9 @@ static
 struct symbol *lookup_symbol_aux_local (const char *name,
 					const char *linkage_name,
 					const struct block *block,
-					const domain_enum domain);
+					const domain_enum domain,
+					enum language lang,
+					int *is_a_field_of_this);
 
 static
 struct symbol *lookup_symbol_aux_symtabs (int block_index,
@@ -1324,8 +1326,8 @@ lookup_symbol_aux (const char *name, const char *linkage_name,
   /* Search specified block and its superiors.  Don't search
      STATIC_BLOCK or GLOBAL_BLOCK.  */
 
-  sym = lookup_symbol_aux_local (name, linkage_name, block, domain);
-  if (sym != NULL)
+  sym = lookup_symbol_aux_local (name, linkage_name, block, domain, language, is_a_field_of_this);
+  if (sym != NULL || (is_a_field_of_this && *is_a_field_of_this))
     return sym;
 
   /* If requested to do so by the caller and if appropriate for LANGUAGE,
@@ -1333,43 +1335,6 @@ lookup_symbol_aux (const char *name, const char *linkage_name,
 
   langdef = language_def (language);
 
-  if (langdef->la_name_of_this != NULL && is_a_field_of_this != NULL
-      && block != NULL)
-    {
-      struct symbol *sym = NULL;
-      const struct block *function_block = block;
-
-      /* 'this' is only defined in the function's block, so find the
-	 enclosing function block.  */
-      for (; function_block && !BLOCK_FUNCTION (function_block);
-      function_block = BLOCK_SUPERBLOCK (function_block));
-
-      if (function_block && !dict_empty (BLOCK_DICT (function_block)))
-	sym = lookup_block_symbol (function_block, langdef->la_name_of_this,
-				   NULL, VAR_DOMAIN);
-      if (sym)
-	{
-	  struct type *t = sym->type;
-
-	  /* I'm not really sure that type of this can ever
-	     be typedefed; just be safe.  */
-	  CHECK_TYPEDEF (t);
-	  if (TYPE_CODE (t) == TYPE_CODE_PTR
-	      || TYPE_CODE (t) == TYPE_CODE_REF)
-	    t = TYPE_TARGET_TYPE (t);
-
-	  if (TYPE_CODE (t) != TYPE_CODE_STRUCT
-	      && TYPE_CODE (t) != TYPE_CODE_UNION)
-	    error (_("Internal error: `%s' is not an aggregate"),
-		   langdef->la_name_of_this);
-
-	  if (check_field (t, name))
-	    {
-	      *is_a_field_of_this = 1;
-	      return NULL;
-	    }
-	}
-    }
 
   /* Now do whatever is appropriate for LANGUAGE to look
      up static and global variables.  */
@@ -1401,23 +1366,66 @@ lookup_symbol_aux (const char *name, const char *linkage_name,
 static struct symbol *
 lookup_symbol_aux_local (const char *name, const char *linkage_name,
 			 const struct block *block,
-			 const domain_enum domain)
+			 const domain_enum domain,
+			 enum language language,
+			 int *is_a_field_of_this)
 {
   struct symbol *sym;
   const struct block *global_block = block_global_block (block);
   const struct block *block_iterator = block;
+  const struct language_defn *langdef;
 
-  /* Check if either no block is specified or it's a global block.  */
+  langdef = language_def (language);
 
+  /* Check if either no block is specified or it's a global block.  */
   if (global_block == NULL)
     return NULL;
 
   while (block_iterator != global_block)
     {
+      /* First check the local lexical level */
       sym = lookup_symbol_aux_block (name, linkage_name, block_iterator, domain);
       if (sym != NULL)
 	return sym;
     
+      if (language == language_cplus)
+        {
+          /* Check class scope, if we have reach the function block */
+          if(BLOCK_FUNCTION (block_iterator)){
+
+          if (block_iterator && !dict_empty (BLOCK_DICT (block_iterator)))
+            sym = lookup_block_symbol (block_iterator, langdef->la_name_of_this,
+                                       NULL, VAR_DOMAIN);
+          if (sym)
+            {
+              struct type *t = sym->type;
+
+              /* I'm not really sure that type of this can ever
+                 be typedefed; just be safe.  */
+              CHECK_TYPEDEF (t);
+              if (TYPE_CODE (t) == TYPE_CODE_PTR
+                  || TYPE_CODE (t) == TYPE_CODE_REF)
+                t = TYPE_TARGET_TYPE (t);
+
+              if (TYPE_CODE (t) != TYPE_CODE_STRUCT
+                  && TYPE_CODE (t) != TYPE_CODE_UNION)
+                error (_("Internal error: `%s' is not an aggregate"),
+                       langdef->la_name_of_this);
+
+              if (check_field (t, name))
+                {
+                  *is_a_field_of_this = 1;
+                  return NULL;
+                }
+            }
+          }
+
+          /* Check the namespace scope */
+          sym = langdef->la_lookup_symbol_nonlocal (name, linkage_name, block, domain);
+          if (sym != NULL)
+            return sym;
+        }
+
       block_iterator = BLOCK_SUPERBLOCK (block_iterator);
     }
 


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-27  0:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-27  0:35 [SCM] archer-jankratochvil-fedora-merge: cherry-pick: Corrected search sequence, and added test jkratoch

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