Bug 8553 - GDB doesn't understand the global scope operator.
Summary: GDB doesn't understand the global scope operator.
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P3 enhancement
Target Milestone: 7.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 11703
  Show dependency treegraph
 
Reported: 2003-11-12 00:38 UTC by David Carlton
Modified: 2010-06-28 20:20 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Carlton 2003-11-12 00:38:00 UTC
[Converted from Gnats 1448]

GDB doesn't know about the global scope operator, i.e.
that, given,

foo() { std::cout << "global foo\n"; }

namespace N {

  foo() { std::cout << "N::foo\n"; ::foo(); }
}

then the expression '::foo()' within N::foo refers
to the global foo() function.

Release:
unknown

Environment:
mainline GDB, 2003-11-11
Comment 1 Tom Tromey 2010-01-22 21:13:15 UTC
I tried this with a recent (F11 system) gcc and CVS head gdb,
and it worked fine.

Complete test case:

int func () {
  return 23;
}

namespace N {
  int func () {
    return 2 + ::func();
  }
};

int main ()
{
  return N::func();
}

(gdb) start
Temporary breakpoint 1 at 0x804845e: file pr.cc, line 14.
Starting program: /home/tromey/gnu/PRS/gdb8553/pr 

Temporary breakpoint 1, main () at pr.cc:14
14	  return N::func();
(gdb) s
N::func () at pr.cc:8
8	    return 2 + ::func();
(gdb) p ::func()
$1 = 23
(gdb) p N::func()
$2 = 25
Comment 2 Jan Kratochvil 2010-06-26 08:22:54 UTC
There is some additional work being done at Bug 11703.
Comment 3 Jan Kratochvil 2010-06-28 20:20:59 UTC
Related fix:
http://sourceware.org/ml/gdb-cvs/2010-06/msg00197.html