This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug symtab/11912] New: C++ name lookup failes
- From: "andre dot poenitz at nokia dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 13 Aug 2010 14:40:45 -0000
- Subject: [Bug symtab/11912] New: C++ name lookup failes
- Reply-to: sourceware-bugzilla at sourceware dot org
The following script (also attached to this report) produces a wrong
result for 'Type Test has no component named Object.' with gdb 7.1
------------------------------- snip ------------------------------------
#!/bin/bash
###################################################################
# Commenting out the Object() constructor and using the compiler
# generated one removes the problem.
echo 'struct Object {
Object();
virtual ~Object();
}; ' > object.h
echo '#include "object.h"
Object::Object() {}
Object::~Object() {}
' > object.cpp
###################################################################
# Removing the inheritance from Object removes the problem.
echo '#include "object.h"
struct Test : Object
{
void foo();
};
void Test::foo()
{
Object s;
int i = 1;
};
int main()
{
Test t;
t.foo();
}
' > main.cpp
###################################################################
g++ -g -c object.cpp -o object.o
# Removing the intermediate shared object also brings the problem to 6.8.
g++ -g -shared object.o -o libobject.so
g++ -g main.cpp -L. -lobject -o ff
export LD_LIBRARY_PATH=.
echo -e "\n6.8:"
~/bin/gdb-6.8 --nx --quiet -ex 'file ./ff' \
-ex 'set breakpoint pending on' -ex 'set confirm off' \
-ex 'b main.cpp:7' \
-ex r -ex 'ptype Object' -ex 'ptype ::Object' -ex q
echo -e "\n\n\n7.1:"
~/bin/gdb-7.1 --nx --quiet -ex 'file ./ff' \
-ex 'set breakpoint pending on' -ex 'set confirm off' \
-ex 'b main.cpp:7' \
-ex r -ex 'ptype Object' -ex 'ptype ::Object' -ex q
# The broken case is 'ptype Object' with 7.1
------------------------------- snip ------------------------------------
# Output:
# 6.8:
# Reading symbols from /tmp/ff/ff...done.
# Breakpoint 1 at 0x80487a4: file main.cpp, line 7.
#
# Breakpoint 1, Test::foo (this=0xbfd8fb8c) at main.cpp:8
# 8 {
# type = class Object {
# public:
# Object(void);
# ~Object(int);
# }
# type = class Object {
# public:
# Object(void);
# ~Object(int);
# }
#
#
# 7.1:
# Reading symbols from /tmp/ff/ff...done.
# Breakpoint 1 at 0x80487aa: file main.cpp, line 7.
#
# Breakpoint 1, Test::foo (this=0xbfffeecc) at main.cpp:9
# 9 Object s;
# Type Test has no component named Object.
# type = struct Object {
# public:
# Object(void);
# ~Object(int);
# }
--
Summary: C++ name lookup failes
Product: gdb
Version: 7.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: symtab
AssignedTo: unassigned at sourceware dot org
ReportedBy: andre dot poenitz at nokia dot com
CC: gdb-prs at sourceware dot org
GCC build triplet: i486-linux-gnu
GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu
http://sourceware.org/bugzilla/show_bug.cgi?id=11912
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.