From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Cc: Sami Wagiaalla <swagiaal@redhat.com>
Subject: [patch] Fix C++ leading :: (PR c++/11703 and PR gdb/1448)
Date: Sat, 26 Jun 2010 08:22:00 -0000 [thread overview]
Message-ID: <20100626082205.GA30439@host0.dyn.jankratochvil.net> (raw)
Hi,
while I do not know much about the C++ parser it seems to me the conditional
there was intended to contain even FIRST_ITER. Currently it just drops the
whole namespace for ::namespace::object references.
If we remove this whole short-cutting block:
if (first_was_coloncolon)
{
yylval = cc.value;
return COLONCOLON;
}
it will crash later on
yylval.sval.ptr = obstack_copy0 (&expansion_obstack,
yylval.sval.ptr,
yylval.sval.length);
due to uninitialized yylval.sval.ptr and yylval.sval.length.
Maybe a more clear/straightforward conditional could be chosen than
`first_was_coloncolon && first_iter' to just really check yylval.sval.ptr has
been initialized. But from some higher level point of view the equivalent
conditional `first_was_coloncolon && first_iter' makes sense there.
This patch (its testcase) is dependent on:
Re: [patch 1/2] Search typedefs in namespaces also in other files
http://sourceware.org/ml/gdb-patches/2010-06/msg00609.html
No regressions on {x86_64,x86_64-m32}-fedora13-linux-gnu.
Thanks,
Jan
gdb/
2010-06-26 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix PR c++/11703 and PR gdb/1448.
* c-exp.y (yylex) <last_was_coloncolon && first_was_coloncolon>: Add
FIRST_ITER check.
gdb/testsuite/
2010-06-26 Jan Kratochvil <jan.kratochvil@redhat.com>
Test PR c++/11703 and PR gdb/1448.
* gdb.cp/namespace.exp (whatis ::C::cOtherFileVar)
(print ::C::cOtherFileVar)
(print ::C::OtherFileClass::cOtherFileClassVar): Remove KFAIL for
c++/11703.
(ptype ::C::NestedClass): Remove KFAIL for gdb/1448.
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -2553,7 +2553,7 @@ yylex (void)
{
token_and_value cc;
memset (&cc, 0, sizeof (token_and_value));
- if (first_was_coloncolon)
+ if (first_was_coloncolon && first_iter)
{
yylval = cc.value;
return COLONCOLON;
--- a/gdb/testsuite/gdb.cp/namespace.exp
+++ b/gdb/testsuite/gdb.cp/namespace.exp
@@ -170,10 +170,8 @@ gdb_test "break BBB::Class::xyzq" \
gdb_test "whatis C::cOtherFileType" "type = short"
gdb_test "whatis ::C::cOtherFileType" "type = short"
gdb_test "whatis C::cOtherFileVar" "type = const C::cOtherFileType"
-setup_kfail "c++/11703" "*-*-*"
gdb_test "whatis ::C::cOtherFileVar" "type = const C::cOtherFileType"
gdb_test "print C::cOtherFileVar" "\\$\[0-9\].* = 319"
-setup_kfail "c++/11703" "*-*-*"
gdb_test "print ::C::cOtherFileVar" "\\$\[0-9\].* = 319"
if {[test_compiler_info {gcc-[0-3]-*}]
@@ -212,10 +210,6 @@ gdb_test_multiple $test $test {
-re "\\$\[0-9\].* = 318\r\n$gdb_prompt $" {
pass $test2
}
- -re "No symbol \"cOtherFileClassVar\" in current context\\.\r\n$gdb_prompt $" {
- setup_kfail "c++/11703" "*-*-*"
- fail $test2
- }
-re "static field cOtherFileClassVar has been optimized out\r\n$gdb_prompt $" {
setup_kfail "c++/11702" "*-*-*"
fail $test2
@@ -262,7 +256,6 @@ gdb_test "ptype CClass::NestedClass" "type = (class C::CClass::NestedClass \{\r\
gdb_test "ptype NestedClass" "No symbol \"NestedClass\" in current context."
gdb_test "ptype ::C::CClass" "type = class C::CClass \{\r\n public:\r\n int x;\r\n\}"
gdb_test "ptype ::C::CClass::NestedClass" "type = class C::CClass::NestedClass \{\r\n public:\r\n int y;\r\n\}"
-setup_kfail "gdb/1448" "*-*-*"
gdb_test "ptype ::C::NestedClass" "No symbol \"NestedClass\" in namespace \"C\"."
gdb_test "ptype C::CClass" "No symbol \"CClass\" in namespace \"C::C\"."
gdb_test "ptype C::CClass::NestedClass" "No type \"CClass\" within class or namespace \"C::C\"."
next reply other threads:[~2010-06-26 8:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-26 8:22 Jan Kratochvil [this message]
2010-06-28 18:28 ` Tom Tromey
2010-06-28 20:19 ` Jan Kratochvil
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=20100626082205.GA30439@host0.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=swagiaal@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