Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] minsyms.c: Fix switching to GNU v3 ABI
@ 2004-03-19  0:09 Corinna Vinschen
  2004-03-10 10:57 ` Corinna Vinschen
                   ` (2 more replies)
  0 siblings, 3 replies; 45+ messages in thread
From: Corinna Vinschen @ 2004-03-19  0:09 UTC (permalink / raw)
  To: gdb-patches

Hi,

I was debugging a situation, in which an C++ object file has been build
using v3 ABI, but GDB did not recognize it and was assuming v2 ABI.  The
target system is sh-elf, the compiler gcc 3.4.

What I found is this:

- The C++ ABI is set to v2 by default (gnu-v2-abi.c, _initialize_gnu_v2_abi).

- While reading symbols from the object file, at one point elf_symfile_read()
  (elfread.c) is called.

- elf_symfile_read() calls elf_symtab_read() which calls
  record_minimal_symbol() which calls prim_record_minimal_symbol_and_info().

- In prim_record_minimal_symbol_and_info(), the symbol language is set to
  language_auto unconditionally.

- After returning from elf_symtab_read(), install_minimal_symbols() is
  called.  At the end of install_minimal_symbols() a loop over all msymbols
  tries to figure out if v3 ABI is used.  This is done by requesting the
  demangeled name calling SYMBOL_DEMANGLED_NAME.

The problem is that SYMBOL_LANGUAGE is still set to language_auto and
the demangled name hasn't been generated at this point.

symbol_demangled_name() only returns the demangled name if the language is
set to a specific mangeling language and only if the demangeled name has
already been created.  This isn't the case at this point.  Ergo, the
v3 ABI isn't recognized and GDB wrongly assumes v2 ABI.

What's especially weird is the comment above install_minimal_symbols().
It implies that the function will try to demangle all symbols to set
the language correctly, but the function is not doing that.  It would
only recognize symbols which has already been demangeled but that just
don't happen.

I not sure if the below solution is entirely correct, but it solves
the problem in my case.  The solution is the create the demangled name
in the aforementioned loop in install_minimal_symbols().  This change
drops the FAIL count in the gdb.cp testsuite part from 54 to 6!


Corinna

	* minsyms.c (install_minimal_symbols): Create demangled names
	for all msymbol entries.

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	10 Mar 2004 10:55:25 -0000
@@ -924,6 +924,8 @@ install_minimal_symbols (struct objfile 
 	       mixing ABIs then the user will need to "set cp-abi"
 	       manually.  */
 	    const char *name = SYMBOL_LINKAGE_NAME (&objfile->msymbols[i]);
+	    SYMBOL_SET_NAMES (&objfile->msymbols[i], name, strlen (name),
+			      objfile);
 	    if (name[0] == '_' && name[1] == 'Z'
 		&& SYMBOL_DEMANGLED_NAME (&objfile->msymbols[i]) != NULL)
 	      {

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.


^ permalink raw reply	[flat|nested] 45+ messages in thread
* Re: [RFA] minsyms.c: Fix switching to GNU v3 ABI
@ 2004-03-10 18:03 Michael Elizabeth Chastain
  2004-03-19  0:09 ` Michael Elizabeth Chastain
  0 siblings, 1 reply; 45+ messages in thread
From: Michael Elizabeth Chastain @ 2004-03-10 18:03 UTC (permalink / raw)
  To: gdb-patches, vinschen

>   FAIL: gdb.cp/annota3.exp: annotate-quit (pattern 1)

That's not a problem.  The results for this test are unstable --
the results can change from run to run, on an identical system.

This test script puts gdb into annotation mode and then does a bunch of
things, including sending a ^C and checking that gdb responds properly.
gdb is flaky in that area; I think it's some sort of signal-handling
race with respect to printing the prompt.  PR gdb/544 has more
information on this.

Michael C


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

end of thread, other threads:[~2004-03-29 11:26 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-19  0:09 [RFA] minsyms.c: Fix switching to GNU v3 ABI Corinna Vinschen
2004-03-10 10:57 ` Corinna Vinschen
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
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                 ` 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                 ` Corinna Vinschen
2004-03-19  0:09                 ` Daniel Jacobowitz
2004-03-10 18:20                   ` Daniel Jacobowitz
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
2004-03-19  0:09 ` Jim Blandy
2004-03-10 15:04   ` Jim Blandy
  -- 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox