This is the mail archive of the gdb-patches@sources.redhat.com 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]

Re: RFA: don't use minsym name when searching block


Daniel Jacobowitz <drow@mvista.com> writes:

> On Thu, Aug 22, 2002 at 12:26:51AM -0500, Jim Blandy wrote:
> > 
> > I'd appreciate it if the C++ folks could check this out.  I don't have
> > a test case yet, but I'll try to put one together tomorrow.
> 
> Could you describe the problem?  Also... "the minsym's name might be
> mangled" definitely seems like a problem; they should either be
> consistently mangled or demangled...

Minimal symbol names are consistently mangled, which makes sense:
they're linker symbols, after all.  You have to use
SYMBOL_DEMANGLED_NAME to get a minsym's demangled name.  But the names
of real symbols (struct symbol) are always demangled.  So when we pass
SYMBOL_NAME (msymbol) to lookup_block_symbol, we're passing a name
guaranteed to be mangled to a function that expects a demangled name.

I'm working on a test case for this.  The symptom is that, when you
try to set a breakpoint on a method, say foo::bar, you get an error
message, but if you then repeat the exact same command, it works the
second time.

What's going on is that, the first time we call lookup_symbol_aux,
which is passed both the mangled name and the demangled name, we hit
the case being patched: we find a minsym, and read the symtab whose
address range contains the minsym's value.  However, since we then
search the global and static blocks using the mangled name, we fail.

The second time we try to lookup foo::bar, the symtab has been read,
and the ALL_SYMTABS loop finds the symbol.


> > 2002-08-21  Jim Blandy  <jimb@redhat.com>
> > 
> > 	* symtab.c (lookup_symbol_aux): In the case where we find a
> > 	minimal symbol of an appropriate name and use its address to
> > 	select a symtab to read and search, use `name' (as passed to us)
> > 	as the demangled name when searching the symtab's global and
> > 	static blocks, not the minsym's name.  The minsym's name might be
> > 	mangled.
> 
> Style nit - a comment like this belongs in the code, not in the
> changelog.

Yes, you're right.

Once I saw the problem, the code seemed so obviously wrong to me that
I thought a comment would be redundant --- minsym names are mangled,
and lookup_block_symbol expects a demangled name.  But you're right:
before I had worked through the problem, it wasn't obviously wrong.


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