public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [patch] create and use symbol_set_language
@ 2010-08-03 14:56 sami wagiaalla
  2010-08-04  7:27 ` Pierre Muller
       [not found] ` <6308127460174723176@unknownmsgid>
  0 siblings, 2 replies; 6+ messages in thread
From: sami wagiaalla @ 2010-08-03 14:56 UTC (permalink / raw)
  To: gdb-patches

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

This patch renames SYMBOL_INIT_LANGUAGE_SPECIFIC to SYMBOL_SET_LANGUAGE 
and symbol_init_language_specific to symbol_set_language, and uses them 
everywhere the language of a symbol is set. Usually through 
SYMBOL_LANGUAGE (sym) = language

This was tested by running the test suit on F13 with gcc 4.4.4 on x8664 
no regressions.

Let me know what you think.


Sami

[-- Attachment #2: symbol_set_language.patch --]
[-- Type: text/plain, Size: 8043 bytes --]

2010-07-29  Sami Wagiaalla  <swagiaal@redhat.com>

	* symtab.h: Renamed SYMBOL_INIT_LANGUAGE_SPECIFIC to
	SYMBOL_SET_LANGUAGE.
	(symbol_init_language_specific): Renamed to symbol_set_language.
	* symtab.c (symbol_init_language_specific): Renamed to symbol_set_language.
	* stabsread.c (define_symbol): Updated.
	(read_enum_type): Updated
	* psymtab.c (add_psymbol_to_bcache): Updated.
	* minsyms.c (install_minimal_symbols): Updated.
	* coffread.c (process_coff_symbol): SYMBOL_SET_LANGUAGE instead of
	SYMBOL_LANGUAGE to set the language.
	* minsyms.c (prim_record_minimal_symbol_full): Ditto.
	* mdebugread.c (new_symbol): Ditto.
	* cp-namespace.c (check_one_possible_namespace_symbol): Ditto.
	* dwarf2read.c (new_symbol_full): Ditto.
	* jv-lang.c (add_class_symbol): Ditto.

diff --git a/gdb/coffread.c b/gdb/coffread.c
index 52417b2..85e8140 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1512,7 +1512,7 @@ process_coff_symbol (struct coff_symbol *cs,
   memset (sym, 0, sizeof (struct symbol));
   name = cs->c_name;
   name = EXTERNAL_NAME (name, objfile->obfd);
-  SYMBOL_LANGUAGE (sym) = current_subfile->language;
+  SYMBOL_SET_LANGUAGE (sym, current_subfile->language);
   SYMBOL_SET_NAMES (sym, name, strlen (name), 1, objfile);
 
   /* default assumptions */
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 49ada64..16f58ca 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -938,7 +938,7 @@ check_one_possible_namespace_symbol (const char *name, int len,
 
       sym = obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol));
       memset (sym, 0, sizeof (struct symbol));
-      SYMBOL_LANGUAGE (sym) = language_cplus;
+      SYMBOL_SET_LANGUAGE (sym, language_cplus);
       /* Note that init_type copied the name to the objfile's
 	 obstack.  */
       SYMBOL_SET_NAMES (sym, TYPE_NAME (type), len, 0, objfile);
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 9eb7466..e00501e 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -10013,7 +10013,7 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
       OBJSTAT (objfile, n_syms++);
 
       /* Cache this symbol's name and the name's demangled form (if any).  */
-      SYMBOL_LANGUAGE (sym) = cu->language;
+      SYMBOL_SET_LANGUAGE (sym, cu->language);
       linkagename = dwarf2_physname (name, die, cu);
       SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile);
 
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index 53fd9a2..c5f98bd 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -162,7 +162,7 @@ add_class_symbol (struct type *type, CORE_ADDR addr)
   sym = (struct symbol *)
     obstack_alloc (&dynamics_objfile->objfile_obstack, sizeof (struct symbol));
   memset (sym, 0, sizeof (struct symbol));
-  SYMBOL_LANGUAGE (sym) = language_java;
+  SYMBOL_SET_LANGUAGE (sym, language_java);
   SYMBOL_SET_LINKAGE_NAME (sym, TYPE_TAG_NAME (type));
   SYMBOL_CLASS (sym) = LOC_TYPEDEF;
   /*  SYMBOL_VALUE (sym) = valu; */
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 2e18fa4..0467816 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -4794,7 +4794,7 @@ new_symbol (char *name)
 				     sizeof (struct symbol)));
 
   memset (s, 0, sizeof (*s));
-  SYMBOL_LANGUAGE (s) = psymtab_language;
+  SYMBOL_SET_LANGUAGE (s, psymtab_language);
   SYMBOL_SET_NAMES (s, name, strlen (name), 1, current_objfile);
   return s;
 }
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index cb4545c..0a57e77 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -833,8 +833,7 @@ prim_record_minimal_symbol_full (const char *name, int name_len, int copy_name,
       msym_bunch = new;
     }
   msymbol = &msym_bunch->contents[msym_bunch_index];
-  SYMBOL_INIT_LANGUAGE_SPECIFIC (msymbol, language_unknown);
-  SYMBOL_LANGUAGE (msymbol) = language_auto;
+  SYMBOL_SET_LANGUAGE (msymbol, language_auto);
   SYMBOL_SET_NAMES (msymbol, name, name_len, copy_name, objfile);
 
   SYMBOL_VALUE_ADDRESS (msymbol) = address;
@@ -1145,7 +1144,7 @@ install_minimal_symbols (struct objfile *objfile)
       MSYMBOL_TARGET_FLAG_2 (&msymbols[mcount]) = 0;
       MSYMBOL_SIZE (&msymbols[mcount]) = 0;
       MSYMBOL_TYPE (&msymbols[mcount]) = mst_unknown;
-      SYMBOL_INIT_LANGUAGE_SPECIFIC (&msymbols[mcount], language_unknown);
+      SYMBOL_SET_LANGUAGE (&msymbols[mcount], language_unknown);
 
       /* Attach the minimal symbol table to the specified objfile.
          The strings themselves are also located in the objfile_obstack
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index c67c164..b522189 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -376,7 +376,7 @@ terminate_minimal_symbol_table (struct objfile *objfile)
     memset (m, 0, sizeof (*m));
     /* Don't rely on these enumeration values being 0's.  */
     MSYMBOL_TYPE (m) = mst_unknown;
-    SYMBOL_INIT_LANGUAGE_SPECIFIC (m, language_unknown);
+    SYMBOL_SET_LANGUAGE (m, language_unknown);
   }
 }
 
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index c120894..bc47681 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1304,7 +1304,7 @@ add_psymbol_to_bcache (char *name, int namelength, int copy_name,
       SYMBOL_VALUE_ADDRESS (&psymbol) = coreaddr;
     }
   SYMBOL_SECTION (&psymbol) = 0;
-  SYMBOL_LANGUAGE (&psymbol) = language;
+  SYMBOL_SET_LANGUAGE (&psymbol, language);
   PSYMBOL_DOMAIN (&psymbol) = domain;
   PSYMBOL_CLASS (&psymbol) = class;
 
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index b62156c..ea9d1e0 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -704,7 +704,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
   else
     {
     normal:
-      SYMBOL_LANGUAGE (sym) = current_subfile->language;
+    SYMBOL_SET_LANGUAGE (sym, current_subfile->language);
       if (SYMBOL_LANGUAGE (sym) == language_cplus)
 	{
 	  char *name = alloca (p - string + 1);
@@ -3656,7 +3656,7 @@ read_enum_type (char **pp, struct type *type,
 	obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol));
       memset (sym, 0, sizeof (struct symbol));
       SYMBOL_SET_LINKAGE_NAME (sym, name);
-      SYMBOL_LANGUAGE (sym) = current_subfile->language;
+      SYMBOL_SET_LANGUAGE (sym, current_subfile->language);
       SYMBOL_CLASS (sym) = LOC_CONST;
       SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
       SYMBOL_VALUE (sym) = n;
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 4acd4a1..51c7be5 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -393,13 +393,11 @@ symbol_get_demangled_name (const struct general_symbol_info *gsymbol)
 /* Initialize the language dependent portion of a symbol
    depending upon the language for the symbol. */
 void
-symbol_init_language_specific (struct general_symbol_info *gsymbol,
-			       enum language language)
+symbol_set_language (struct general_symbol_info *gsymbol,
+                     enum language language)
 {
-
   gsymbol->language = language;
-  if (gsymbol->language == language_cplus
-      || gsymbol->language == language_d
+  if (gsymbol->language == language_d
       || gsymbol->language == language_java
       || gsymbol->language == language_objc
       || gsymbol->language == language_fortran)
diff --git a/gdb/symtab.h b/gdb/symtab.h
index de6f188..5c1b321 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -187,10 +187,10 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *);
 
 /* Initializes the language dependent portion of a symbol
    depending upon the language for the symbol. */
-#define SYMBOL_INIT_LANGUAGE_SPECIFIC(symbol,language) \
-  (symbol_init_language_specific (&(symbol)->ginfo, (language)))
-extern void symbol_init_language_specific (struct general_symbol_info *symbol,
-					   enum language language);
+#define SYMBOL_SET_LANGUAGE(symbol,language) \
+  (symbol_set_language (&(symbol)->ginfo, (language)))
+extern void symbol_set_language (struct general_symbol_info *symbol,
+                                 enum language language);
 
 /* Set just the linkage name of a symbol; do not try to demangle
    it.  Used for constructs which do not have a mangled name,

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

* RE: [patch] create and use symbol_set_language
  2010-08-03 14:56 [patch] create and use symbol_set_language sami wagiaalla
@ 2010-08-04  7:27 ` Pierre Muller
  2010-08-05 15:36   ` sami wagiaalla
       [not found] ` <6308127460174723176@unknownmsgid>
  1 sibling, 1 reply; 6+ messages in thread
From: Pierre Muller @ 2010-08-04  7:27 UTC (permalink / raw)
  To: 'sami wagiaalla', gdb-patches

Hi Sami,

  I just looked at your patch, which seems
quite straightforward.

  Nevertheless, it seems that 
it contains a change that is not commented:

@@ -393,13 +393,11 @@ symbol_get_demangled_name (const struct
general_symbol_info *gsymbol)
 /* Initialize the language dependent portion of a symbol
    depending upon the language for the symbol. */
 void
-symbol_init_language_specific (struct general_symbol_info *gsymbol,
-			       enum language language)
+symbol_set_language (struct general_symbol_info *gsymbol,
+                     enum language language)
 {
-
   gsymbol->language = language;
-  if (gsymbol->language == language_cplus
-      || gsymbol->language == language_d
+  if (gsymbol->language == language_d
       || gsymbol->language == language_java
       || gsymbol->language == language_objc
       || gsymbol->language == language_fortran)

  The removal of the 'gsymbol->language == language_cplus'
condition seems to be outside of the scope of the patch you
describe, which seems otherwise quite straightforward. 

  Could you please comment on the reason of that specific change?
Is it really part of that patch or shouldn't it be submitted
separately? I must confess that I didn't even try to
look at the source code after the 'if', but just reacted quickly
on something that seem 'off topic' as compared to
your patch description.

Pierre


> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de sami wagiaalla
> Envoyé : Tuesday, August 03, 2010 4:57 PM
> À : gdb-patches@sourceware.org
> Objet : [patch] create and use symbol_set_language
> 
> This patch renames SYMBOL_INIT_LANGUAGE_SPECIFIC to SYMBOL_SET_LANGUAGE
> and symbol_init_language_specific to symbol_set_language, and uses them
> everywhere the language of a symbol is set. Usually through
> SYMBOL_LANGUAGE (sym) = language
> 
> This was tested by running the test suit on F13 with gcc 4.4.4 on x8664
> no regressions.
> 
> Let me know what you think.
> 
> 
> Sami

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

* Re: [patch] create and use symbol_set_language
       [not found] ` <6308127460174723176@unknownmsgid>
@ 2010-08-04 21:56   ` Doug Evans
  2010-08-04 22:01     ` Doug Evans
  2010-08-05 19:05     ` sami wagiaalla
  0 siblings, 2 replies; 6+ messages in thread
From: Doug Evans @ 2010-08-04 21:56 UTC (permalink / raw)
  To: Pierre Muller; +Cc: sami wagiaalla, gdb-patches

On Wed, Aug 4, 2010 at 12:27 AM, Pierre Muller
<pierre.muller@ics-cnrs.unistra.fr> wrote:
> Hi Sami,
>
>  I just looked at your patch, which seems
> quite straightforward.
>
>  Nevertheless, it seems that
> it contains a change that is not commented:
>
> @@ -393,13 +393,11 @@ symbol_get_demangled_name (const struct
> general_symbol_info *gsymbol)
>  /* Initialize the language dependent portion of a symbol
>    depending upon the language for the symbol. */
>  void
> -symbol_init_language_specific (struct general_symbol_info *gsymbol,
> -                              enum language language)
> +symbol_set_language (struct general_symbol_info *gsymbol,
> +                     enum language language)
>  {
> -
>   gsymbol->language = language;
> -  if (gsymbol->language == language_cplus
> -      || gsymbol->language == language_d
> +  if (gsymbol->language == language_d
>       || gsymbol->language == language_java
>       || gsymbol->language == language_objc
>       || gsymbol->language == language_fortran)
>
>  The removal of the 'gsymbol->language == language_cplus'
> condition seems to be outside of the scope of the patch you
> describe, which seems otherwise quite straightforward.
>
>  Could you please comment on the reason of that specific change?
> Is it really part of that patch or shouldn't it be submitted
> separately? I must confess that I didn't even try to
> look at the source code after the 'if', but just reacted quickly
> on something that seem 'off topic' as compared to
> your patch description.

Yeah.  This part of the patch is correct, it just needs a ChangeLog entry.
[One could submit it separately, but I don't mind it being included here.]
What's happening here is that language_cplus is being checked for twice.
Here's the current definition of the function.

void
symbol_init_language_specific (struct general_symbol_info *gsymbol,
                               enum language language)
{

  gsymbol->language = language;
  if (gsymbol->language == language_cplus
      || gsymbol->language == language_d
      || gsymbol->language == language_java
      || gsymbol->language == language_objc
      || gsymbol->language == language_fortran)
    {
      symbol_set_demangled_name (gsymbol, NULL, NULL);
    }
  else if (gsymbol->language == language_cplus)
    gsymbol->language_specific.cplus_specific = NULL;
  else
    {
      memset (&gsymbol->language_specific, 0,
              sizeof (gsymbol->language_specific));
    }
}

The patch is generally ok, but a bit more is required:

- the additional ChangeLog entry to mention fixing test of language_cplus

- after applying the patch, grepping for SYMBOL_INIT still has a few
hits that need to be addressed:

gdb$ grep SYMBOL_INIT *.[ch]
buildsym.c:#include "demangle.h"                /* Needed by
SYMBOL_INIT_DEMANGLED_NAME.  */
symtab.h:   the SYMBOL_INIT_LANGUAGE_SPECIFIC, SYMBOL_DEMANGLED_NAME, etc.

- one potential formatting nit:

diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index b62156c..ea9d1e0 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -704,7 +704,7 @@ define_symbol (CORE_ADDR valu, char *string, int
desc, int type,
   else
     {
     normal:
-      SYMBOL_LANGUAGE (sym) = current_subfile->language;
+    SYMBOL_SET_LANGUAGE (sym, current_subfile->language);
       if (SYMBOL_LANGUAGE (sym) == language_cplus)
 	{
 	  char *name = alloca (p - string + 1);

I'm happy with the patch with those changes.

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

* Re: [patch] create and use symbol_set_language
  2010-08-04 21:56   ` Doug Evans
@ 2010-08-04 22:01     ` Doug Evans
  2010-08-05 19:05     ` sami wagiaalla
  1 sibling, 0 replies; 6+ messages in thread
From: Doug Evans @ 2010-08-04 22:01 UTC (permalink / raw)
  To: sami wagiaalla; +Cc: gdb-patches, Pierre Muller

On Wed, Aug 4, 2010 at 2:56 PM, Doug Evans <dje@google.com> wrote:
> - after applying the patch, grepping for SYMBOL_INIT still has a few
> hits that need to be addressed:
>
> gdb$ grep SYMBOL_INIT *.[ch]
> buildsym.c:#include "demangle.h"                /* Needed by
> SYMBOL_INIT_DEMANGLED_NAME.  */
> symtab.h:   the SYMBOL_INIT_LANGUAGE_SPECIFIC, SYMBOL_DEMANGLED_NAME, etc.

Blech.  Removing SYMBOL_INIT_DEMANGLED_NAME reference is orthogonal to
this patch.

I was able to compile buildsym.o by removing the entire line.

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

* Re: [patch] create and use symbol_set_language
  2010-08-04  7:27 ` Pierre Muller
@ 2010-08-05 15:36   ` sami wagiaalla
  0 siblings, 0 replies; 6+ messages in thread
From: sami wagiaalla @ 2010-08-05 15:36 UTC (permalink / raw)
  To: gdb-patches

Hi Pierre,

Thanks for the review :)

>    The removal of the 'gsymbol->language == language_cplus'
> condition seems to be outside of the scope of the patch you
> describe, which seems otherwise quite straightforward.
>
>    Could you please comment on the reason of that specific change?
> Is it really part of that patch or shouldn't it be submitted
> separately? I must confess that I didn't even try to
> look at the source code after the 'if', but just reacted quickly
> on something that seem 'off topic' as compared to
> your patch description.
>

I guess Doug has already answered this question. The check for 
language_cplus was redundant. This should have had a better Changelog 
entry of course, or been on separate patch :)... I'll fix it

Sami

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

* Re: [patch] create and use symbol_set_language
  2010-08-04 21:56   ` Doug Evans
  2010-08-04 22:01     ` Doug Evans
@ 2010-08-05 19:05     ` sami wagiaalla
  1 sibling, 0 replies; 6+ messages in thread
From: sami wagiaalla @ 2010-08-05 19:05 UTC (permalink / raw)
  To: gdb-patches

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


> I'm happy with the patch with those changes.

Thanks for the review. I have made the requested changes and will be 
committing the attached patch.

Sami

[-- Attachment #2: symbol_set_language.patch --]
[-- Type: text/plain, Size: 8722 bytes --]

create and use symbol_set_language.

2010-08-05  Sami Wagiaalla  <swagiaal@redhat.com>

	* symtab.h: Renamed SYMBOL_INIT_LANGUAGE_SPECIFIC to
	SYMBOL_SET_LANGUAGE.
	(symbol_init_language_specific): Renamed to symbol_set_language.
	* symtab.c (symbol_init_language_specific): Removed redundant check
	for language_cplus.
	Renamed to symbol_set_language.
	* stabsread.c (define_symbol): Updated.
	(read_enum_type): Updated
	* psymtab.c (add_psymbol_to_bcache): Updated.
	* minsyms.c (install_minimal_symbols): Updated.
	* coffread.c (process_coff_symbol): SYMBOL_SET_LANGUAGE instead of
	SYMBOL_LANGUAGE to set the language.
	* minsyms.c (prim_record_minimal_symbol_full): Ditto.
	* mdebugread.c (new_symbol): Ditto.
	* cp-namespace.c (check_one_possible_namespace_symbol): Ditto.
	* dwarf2read.c (new_symbol_full): Ditto.
	* jv-lang.c (add_class_symbol): Ditto.

diff --git a/gdb/coffread.c b/gdb/coffread.c
index 52417b2..85e8140 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1512,7 +1512,7 @@ process_coff_symbol (struct coff_symbol *cs,
   memset (sym, 0, sizeof (struct symbol));
   name = cs->c_name;
   name = EXTERNAL_NAME (name, objfile->obfd);
-  SYMBOL_LANGUAGE (sym) = current_subfile->language;
+  SYMBOL_SET_LANGUAGE (sym, current_subfile->language);
   SYMBOL_SET_NAMES (sym, name, strlen (name), 1, objfile);
 
   /* default assumptions */
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 49ada64..16f58ca 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -938,7 +938,7 @@ check_one_possible_namespace_symbol (const char *name, int len,
 
       sym = obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol));
       memset (sym, 0, sizeof (struct symbol));
-      SYMBOL_LANGUAGE (sym) = language_cplus;
+      SYMBOL_SET_LANGUAGE (sym, language_cplus);
       /* Note that init_type copied the name to the objfile's
 	 obstack.  */
       SYMBOL_SET_NAMES (sym, TYPE_NAME (type), len, 0, objfile);
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 9eb7466..e00501e 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -10013,7 +10013,7 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
       OBJSTAT (objfile, n_syms++);
 
       /* Cache this symbol's name and the name's demangled form (if any).  */
-      SYMBOL_LANGUAGE (sym) = cu->language;
+      SYMBOL_SET_LANGUAGE (sym, cu->language);
       linkagename = dwarf2_physname (name, die, cu);
       SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile);
 
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index 53fd9a2..c5f98bd 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -162,7 +162,7 @@ add_class_symbol (struct type *type, CORE_ADDR addr)
   sym = (struct symbol *)
     obstack_alloc (&dynamics_objfile->objfile_obstack, sizeof (struct symbol));
   memset (sym, 0, sizeof (struct symbol));
-  SYMBOL_LANGUAGE (sym) = language_java;
+  SYMBOL_SET_LANGUAGE (sym, language_java);
   SYMBOL_SET_LINKAGE_NAME (sym, TYPE_TAG_NAME (type));
   SYMBOL_CLASS (sym) = LOC_TYPEDEF;
   /*  SYMBOL_VALUE (sym) = valu; */
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 2e18fa4..0467816 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -4794,7 +4794,7 @@ new_symbol (char *name)
 				     sizeof (struct symbol)));
 
   memset (s, 0, sizeof (*s));
-  SYMBOL_LANGUAGE (s) = psymtab_language;
+  SYMBOL_SET_LANGUAGE (s, psymtab_language);
   SYMBOL_SET_NAMES (s, name, strlen (name), 1, current_objfile);
   return s;
 }
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index cb4545c..0a57e77 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -833,8 +833,7 @@ prim_record_minimal_symbol_full (const char *name, int name_len, int copy_name,
       msym_bunch = new;
     }
   msymbol = &msym_bunch->contents[msym_bunch_index];
-  SYMBOL_INIT_LANGUAGE_SPECIFIC (msymbol, language_unknown);
-  SYMBOL_LANGUAGE (msymbol) = language_auto;
+  SYMBOL_SET_LANGUAGE (msymbol, language_auto);
   SYMBOL_SET_NAMES (msymbol, name, name_len, copy_name, objfile);
 
   SYMBOL_VALUE_ADDRESS (msymbol) = address;
@@ -1145,7 +1144,7 @@ install_minimal_symbols (struct objfile *objfile)
       MSYMBOL_TARGET_FLAG_2 (&msymbols[mcount]) = 0;
       MSYMBOL_SIZE (&msymbols[mcount]) = 0;
       MSYMBOL_TYPE (&msymbols[mcount]) = mst_unknown;
-      SYMBOL_INIT_LANGUAGE_SPECIFIC (&msymbols[mcount], language_unknown);
+      SYMBOL_SET_LANGUAGE (&msymbols[mcount], language_unknown);
 
       /* Attach the minimal symbol table to the specified objfile.
          The strings themselves are also located in the objfile_obstack
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index c67c164..b522189 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -376,7 +376,7 @@ terminate_minimal_symbol_table (struct objfile *objfile)
     memset (m, 0, sizeof (*m));
     /* Don't rely on these enumeration values being 0's.  */
     MSYMBOL_TYPE (m) = mst_unknown;
-    SYMBOL_INIT_LANGUAGE_SPECIFIC (m, language_unknown);
+    SYMBOL_SET_LANGUAGE (m, language_unknown);
   }
 }
 
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index c120894..bc47681 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1304,7 +1304,7 @@ add_psymbol_to_bcache (char *name, int namelength, int copy_name,
       SYMBOL_VALUE_ADDRESS (&psymbol) = coreaddr;
     }
   SYMBOL_SECTION (&psymbol) = 0;
-  SYMBOL_LANGUAGE (&psymbol) = language;
+  SYMBOL_SET_LANGUAGE (&psymbol, language);
   PSYMBOL_DOMAIN (&psymbol) = domain;
   PSYMBOL_CLASS (&psymbol) = class;
 
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index b62156c..5f6b004 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -704,7 +704,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
   else
     {
     normal:
-      SYMBOL_LANGUAGE (sym) = current_subfile->language;
+      SYMBOL_SET_LANGUAGE (sym, current_subfile->language);
       if (SYMBOL_LANGUAGE (sym) == language_cplus)
 	{
 	  char *name = alloca (p - string + 1);
@@ -3656,7 +3656,7 @@ read_enum_type (char **pp, struct type *type,
 	obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol));
       memset (sym, 0, sizeof (struct symbol));
       SYMBOL_SET_LINKAGE_NAME (sym, name);
-      SYMBOL_LANGUAGE (sym) = current_subfile->language;
+      SYMBOL_SET_LANGUAGE (sym, current_subfile->language);
       SYMBOL_CLASS (sym) = LOC_CONST;
       SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
       SYMBOL_VALUE (sym) = n;
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 4acd4a1..51c7be5 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -393,13 +393,11 @@ symbol_get_demangled_name (const struct general_symbol_info *gsymbol)
 /* Initialize the language dependent portion of a symbol
    depending upon the language for the symbol. */
 void
-symbol_init_language_specific (struct general_symbol_info *gsymbol,
-			       enum language language)
+symbol_set_language (struct general_symbol_info *gsymbol,
+                     enum language language)
 {
-
   gsymbol->language = language;
-  if (gsymbol->language == language_cplus
-      || gsymbol->language == language_d
+  if (gsymbol->language == language_d
       || gsymbol->language == language_java
       || gsymbol->language == language_objc
       || gsymbol->language == language_fortran)
diff --git a/gdb/symtab.h b/gdb/symtab.h
index de6f188..04cb443 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -171,7 +171,7 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *);
 /* Note that all the following SYMBOL_* macros are used with the
    SYMBOL argument being either a partial symbol, a minimal symbol or
    a full symbol.  All three types have a ginfo field.  In particular
-   the SYMBOL_INIT_LANGUAGE_SPECIFIC, SYMBOL_DEMANGLED_NAME, etc.
+   the SYMBOL_SET_LANGUAGE, SYMBOL_DEMANGLED_NAME, etc.
    macros cannot be entirely substituted by
    functions, unless the callers are changed to pass in the ginfo
    field only, instead of the SYMBOL parameter.  */
@@ -187,10 +187,10 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *);
 
 /* Initializes the language dependent portion of a symbol
    depending upon the language for the symbol. */
-#define SYMBOL_INIT_LANGUAGE_SPECIFIC(symbol,language) \
-  (symbol_init_language_specific (&(symbol)->ginfo, (language)))
-extern void symbol_init_language_specific (struct general_symbol_info *symbol,
-					   enum language language);
+#define SYMBOL_SET_LANGUAGE(symbol,language) \
+  (symbol_set_language (&(symbol)->ginfo, (language)))
+extern void symbol_set_language (struct general_symbol_info *symbol,
+                                 enum language language);
 
 /* Set just the linkage name of a symbol; do not try to demangle
    it.  Used for constructs which do not have a mangled name,

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

end of thread, other threads:[~2010-08-05 19:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-03 14:56 [patch] create and use symbol_set_language sami wagiaalla
2010-08-04  7:27 ` Pierre Muller
2010-08-05 15:36   ` sami wagiaalla
     [not found] ` <6308127460174723176@unknownmsgid>
2010-08-04 21:56   ` Doug Evans
2010-08-04 22:01     ` Doug Evans
2010-08-05 19:05     ` sami wagiaalla

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