From bd03643041ae4343013c4d70dc9430789a12b25a Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Sat, 12 Nov 2005 20:45:23 +0000 Subject: [PATCH] A better fix for anonymous name spaces, because they can be nested in other (named and unnamed) namespaces. --- kdbg/gdbdriver.cpp | 15 ++++++++------- kdbg/testprogs/testfile.cpp | 14 +++++++++++++- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/kdbg/gdbdriver.cpp b/kdbg/gdbdriver.cpp index 92cdf5b..823d6ba 100644 --- a/kdbg/gdbdriver.cpp +++ b/kdbg/gdbdriver.cpp @@ -1419,17 +1419,11 @@ static void parseFrameInfo(const char*& s, QString& func, s++; return; } +restartName: // search opening parenthesis while (*p != '\0' && *p != '(') p++; - // skip (anonymous namespace) - if (strncmp(p, "(anonymous namespace)", 21) == 0) { - p+=21; - while (*p != '\0' && *p != '(') - p++; - } - if (*p == '\0') { func = start; file = QString(); @@ -1444,8 +1438,15 @@ static void parseFrameInfo(const char*& s, QString& func, * additional pairs of parentheses. Furthermore, recent gdbs write the * demangled name followed by the arguments in a pair of parentheses, * where the demangled name can end in "const". + * In addition, if we encounter "(anonymous namespace)", the parameter list + * has not been reached, and we jump back out and restart parsing names. */ do { + if (strncmp(p, "(anonymous namespace)", 21) == 0) { + p += 21; + goto restartName; + } + skipNestedWithString(p, '(', ')'); while (isspace(*p)) p++; diff --git a/kdbg/testprogs/testfile.cpp b/kdbg/testprogs/testfile.cpp index e566d33..13bb53b 100644 --- a/kdbg/testprogs/testfile.cpp +++ b/kdbg/testprogs/testfile.cpp @@ -38,6 +38,10 @@ public: operator PtrFunc*(); }; +namespace A { +namespace { +namespace B { +namespace { namespace { void g() { @@ -48,6 +52,14 @@ void g() s2.s = &s1; } } // namespace +void Banong() { g(); } +} // namespace +void g() { Banong(); } +} // namespace B +void Aanong() { B::g(); } +} // namespace +void g() { Aanong(); } +} // namespace A void f(E e[3], char c) { @@ -59,7 +71,7 @@ void f(E e[3], char c) int x = 17; x; } - g(); + A::g(); char buffer[300]; memset(buffer, 1, 300); for (int i = 0; i < sizeof(buffer); i +=15) buffer[i] = '\02'; -- 2.11.4.GIT