Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [RFA] minsyms.c: Fix switching to GNU v3 ABI
Date: Fri, 26 Mar 2004 13:57:00 -0000	[thread overview]
Message-ID: <20040326113928.GG17229@cygbert.vinschen.de> (raw)
In-Reply-To: <vt21xngu06b.fsf@zenia.home>

On Mar 25 15:44, Jim Blandy wrote:
> One comment: I notice that we actually remove the leading character
> earlier in prim_record_minimal_symbol_and_info, to check if the name
> is the same as that of the GCC compilation marker symbol.  It would be
> nicer if we could just remove the leading character once, at the top
> of the function, and then simplify the the "__gnu_compiled" test.
> Doing so shouldn't interfere with the GCC_COMPILED_FLAG_SYMBOL tests,
> since the code already presumes those both start with 'g'.

Well, it could interfere.  Assuming that leading char is the underscore.
The first test would now find "gcc_compiled.", but not "_gcc_compiled.".
When skipping the leading char before testing, the same test would now
also find "_gcc_compiled.".  If that's ok, I don't have a problem to
change it as you like.  Otherwise, I'd propose the below patch, which
avoids that problem.


Corinna

	* minsyms.c (install_minimal_symbols): Move dropping leading
	char from linkage name from here...
	(prim_record_minimal_symbol_and_info): ...to here.  Simplify
	test for "__gnu_compiled*" symbols.

Index: minsyms.c
===================================================================
RCS file: /cvs/src/src/gdb/minsyms.c,v
retrieving revision 1.41
diff -u -p -r1.41 minsyms.c
--- minsyms.c	9 Feb 2004 19:13:46 -0000	1.41
+++ minsyms.c	26 Mar 2004 11:28:46 -0000
@@ -580,26 +580,23 @@ prim_record_minimal_symbol_and_info (con
   struct msym_bunch *new;
   struct minimal_symbol *msymbol;
 
-  if (ms_type == mst_file_text)
-    {
-      /* Don't put gcc_compiled, __gnu_compiled_cplus, and friends into
-         the minimal symbols, because if there is also another symbol
-         at the same address (e.g. the first function of the file),
-         lookup_minimal_symbol_by_pc would have no way of getting the
-         right one.  */
-      if (name[0] == 'g'
-	  && (strcmp (name, GCC_COMPILED_FLAG_SYMBOL) == 0
-	      || strcmp (name, GCC2_COMPILED_FLAG_SYMBOL) == 0))
-	return (NULL);
-
-      {
-	const char *tempstring = name;
-	if (tempstring[0] == get_symbol_leading_char (objfile->obfd))
-	  ++tempstring;
-	if (strncmp (tempstring, "__gnu_compiled", 14) == 0)
-	  return (NULL);
-      }
-    }
+  /* Don't put gcc_compiled, __gnu_compiled_cplus, and friends into
+     the minimal symbols, because if there is also another symbol
+     at the same address (e.g. the first function of the file),
+     lookup_minimal_symbol_by_pc would have no way of getting the
+     right one.  */
+  if (ms_type == mst_file_text && name[0] == 'g'
+      && (strcmp (name, GCC_COMPILED_FLAG_SYMBOL) == 0
+	  || strcmp (name, GCC2_COMPILED_FLAG_SYMBOL) == 0))
+    return (NULL);
+
+  /* It's save to strip the leading char here once, since the name
+     is also stored stripped in the minimal symbol table. */
+  if (name[0] == get_symbol_leading_char (objfile->obfd))
+    ++name;
+
+  if (ms_type == mst_file_text && strncmp (name, "__gnu_compiled", 14) == 0)
+    return (NULL);
 
   if (msym_bunch_index == BUNCH_SIZE)
     {
@@ -831,7 +828,6 @@ install_minimal_symbols (struct objfile 
   struct msym_bunch *bunch;
   struct minimal_symbol *msymbols;
   int alloc_count;
-  char leading_char;
 
   if (msym_count > 0)
     {
@@ -859,18 +855,11 @@ install_minimal_symbols (struct objfile 
          each bunch is full. */
 
       mcount = objfile->minimal_symbol_count;
-      leading_char = get_symbol_leading_char (objfile->obfd);
 
       for (bunch = msym_bunch; bunch != NULL; bunch = bunch->next)
 	{
 	  for (bindex = 0; bindex < msym_bunch_index; bindex++, mcount++)
-	    {
-	      msymbols[mcount] = bunch->contents[bindex];
-	      if (SYMBOL_LINKAGE_NAME (&msymbols[mcount])[0] == leading_char)
-		{
-		  SYMBOL_LINKAGE_NAME (&msymbols[mcount])++;
-		}
-	    }
+	    msymbols[mcount] = bunch->contents[bindex];
 	  msym_bunch_index = BUNCH_SIZE;
 	}
 


-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.


  reply	other threads:[~2004-03-26 13:57 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-19  0:09 Corinna Vinschen
2004-03-10 10:57 ` Corinna Vinschen
2004-03-19  0:09 ` Jim Blandy
2004-03-10 15:04   ` Jim Blandy
2004-03-19  0:09 ` Daniel Jacobowitz
2004-03-10 15:08   ` Daniel Jacobowitz
2004-03-10 15:55   ` Corinna Vinschen
2004-03-10 16:04     ` Daniel Jacobowitz
2004-03-10 16:16       ` Corinna Vinschen
2004-03-19  0:09         ` Daniel Jacobowitz
2004-03-10 16:20           ` Daniel Jacobowitz
2004-03-19  0:09           ` Corinna Vinschen
2004-03-10 16:34             ` Corinna Vinschen
2004-03-10 16:37             ` Daniel Jacobowitz
2004-03-10 17:54               ` Corinna Vinschen
2004-03-10 18:02                 ` David Carlton
2004-03-19  0:09                   ` David Carlton
2004-03-10 18:23                 ` Corinna Vinschen
2004-03-19  0:09                   ` Corinna Vinschen
2004-03-22 17:34                   ` Corinna Vinschen
2004-03-22 17:38                     ` Corinna Vinschen
2004-03-25 20:44                   ` Jim Blandy
2004-03-26 13:57                     ` Corinna Vinschen [this message]
2004-03-26 17:54                       ` Eli Zaretskii
2004-03-28 18:28                       ` Jim Blandy
2004-03-29 11:26                         ` Corinna Vinschen
2004-03-19  0:09                 ` Daniel Jacobowitz
2004-03-10 18:20                   ` Daniel Jacobowitz
2004-03-19  0:09                 ` Corinna Vinschen
2004-03-19  0:09                 ` Ian Lance Taylor
2004-03-10 18:30                   ` Ian Lance Taylor
2004-03-19  0:09                   ` Corinna Vinschen
2004-03-10 18:46                     ` Corinna Vinschen
2004-03-10 19:02                     ` Ian Lance Taylor
2004-03-19  0:09                       ` Ian Lance Taylor
2004-03-19  0:09               ` Daniel Jacobowitz
2004-03-10 16:43             ` Corinna Vinschen
2004-03-10 16:46               ` Daniel Jacobowitz
2004-03-19  0:09                 ` Daniel Jacobowitz
2004-03-19  0:09               ` Corinna Vinschen
2004-03-19  0:09         ` Corinna Vinschen
2004-03-19  0:09       ` Daniel Jacobowitz
2004-03-19  0:09     ` Corinna Vinschen
  -- strict thread matches above, loose matches on Subject: below --
2004-03-10 18:03 Michael Elizabeth Chastain
2004-03-19  0:09 ` Michael Elizabeth Chastain

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=20040326113928.GG17229@cygbert.vinschen.de \
    --to=vinschen@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /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