This is the mail archive of the gdb-prs@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]

c++/1272: scope problem with instance variables.


>Number:         1272
>Category:       c++
>Synopsis:       scope problem with instance variables.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 07 16:18:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Laurent Michel
>Release:        GNU gdb 5.3.90_2003-06-29-cvs-debian
>Organization:
>Environment:
GNU Linux/ Debian/sid
>Description:
On occasion, gdb reports that some symbols are undefined even though they do exist. Every single occurence of this problem is related to instantce variables within a class. Often, I can get around it by accessing the symbol via the this pointer. Check the following gdb session:
(gdb) where
#0  VolatileDependencyCreator::applyIntVar(ColIntIncI*) (this=0xbffff1b0, n=0x8235c50) at LocDynamic.C:190
#1  0x4039220b in ColIntIncI::visitLocData(LocExprVisit*) (this=0x8235c50, visitor=0xbffff1b0) at LocNVarI.H:78
#2  0x40382980 in ColExtendedDataI::visitData(ColDataVisitor*) (this=0x8235c50, visitor=0xbffff1b4) at LocPropagator.C:215
#3  0x403872d6 in DependencyCreator::applyColIntIncRef(ColIntIncRefI*) (this=0xbffff1b0, n=0x825d4d8) at LocVarI.C:150
#4  0x403cbf21 in ColIntIncRefI::visitLocNode(LocExprVisit*) (this=0x825d4d8, visitor=0xbffff1b0) at LocVisit.C:45
#5  0x403ced14 in ColExtendedIntNodeI::visitNode(ColNodeVisitor*) (this=0x825d4d8, visitor=0xbffff1b0) at LocExpI.C:41
#6  0x403fcf38 in VolatileDependencyCreator::applyColISubInc(ColISubIncI*) (this=0xbffff1b0, n=0x825d4f0) at LocDynamic.C:216
#7  0x403cbfed in ColISubIncI::visitLocNode(LocExprVisit*) (this=0x825d4f0, visitor=0xbffff1b0) at LocVisit.C:51
#8  0x403ced14 in ColExtendedIntNodeI::visitNode(ColNodeVisitor*) (this=0x825d4f0, visitor=0xbffff1b0) at LocExpI.C:41
#9  0x403c33ea in ColNSBranchIntIncI::scratchUpdateStatic(LocPropagatorI*, ColFrameI*) (this=0x825d720, src=0x825d5d8, frame=0x0) at LocFDNVarI.C:956
#10 0x403ee012 in LocRDDependency::updateStatic() (this=0x82823a0) at LocPropagate.C:395
#11 0x40384d94 in LocFixDynamic::apply(LocDependency*) (this=0xbffff2a0, dep=0x82823a0) at LocPropagator.C:356
#12 0x40383068 in LocPropagatorI::applyDeps(LocDepFunctionI&) (this=0x825d5d8, df=@0xbffff2a0) at LocPropagator.C:312
#13 0x403831f9 in LocPropagatorI::dispatchUpdateStatic() (this=0x825d5d8) at LocPropagator.C:365
#14 0x403f1bb5 in ColLSManagerI::scratchEvalLevel(int, int, int) (this=0x825ccc8, nbP=3, level=0, from=0) at LocPlanning.C:1237
#15 0x403f1ef8 in ColLSManagerI::prioritize() (this=0x825ccc8) at LocPlanning.C:1326
#16 0x08180efc in ColLocalSolverWrapperI::dispatch(LocRuntime*, int) (this=0x825cc88, rt=0xbffff4d0, mid=3) at builtin.C:4378
#17 0x400faebf in LocInstrDispatchI::execute(LocRuntime*) (this=0x8250c78, rt=0xbffff4d0) at LocInstrI.C:1353
#18 0x400f54d0 in LocRuntime::execute(LocInstrI**) (this=0xbffff4d0, start=0x82687d8) at LocRuntime.C:526
#19 0x40138de7 in LocComet::execute(LocProgram*, LocRuntime*) (this=0xbffff5f0, prog=0x823b038, rt=0xbffff4d0) at LocComet.C:199
#20 0x080ca444 in main (argc=2, argv=0xbffff6f4) at comet.C:177

(gdb) p *_theTarget
No symbol "_theTarget" in current context.
(gdb) p _theTarget
No symbol "_theTarget" in current context.
(gdb) p this
$7 = (VolatileDependencyCreator * const) 0xbffff1b0
(gdb) p *this
$8 = {<DependencyCreator> = {<LocExprVisit> = {<ColNodeVisitor> = {_vptr.ColNodeVisitor = 0x404c7be8}, <ColDataVisitor> = {
        _vptr.ColDataVisitor = 0x404c8224}, <No data fields>}, _theTarget = 0x825d7a8, _theFrame = 0x0, _shared = {_flag = 0x827f4c8}},
  _created = 0x82833c0, _incPlan = 0, _element = 1, _floating = 0x8280490, _theSubscript = 0x825d4f0}
(gdb) p *this->_theTarget
$9 = {<LocMgrDataI> = {<ColExtendedDataI> = {<ColExtensibleDataI> = {<ColDataI> = {<ColCellI> = {_vptr.ColCellI = 0x404abdc8,
            _allocator = 0x8235f20}, <No data fields>}, <No data fields>}, <No data fields>}, _mgr = 0x825ccc8}, <ColSmartLV> = {
    _vptr.ColSmartLV = 0x404abfc0}, <ColPersistent> = {_vptr.ColPersistent = 0x404abfe8, _vid = 7}, _deps = {_alloc = 0x8235ad8,
    _tab = 0x827d648, _mSz = 4, _sz = 1}, _ants = {_alloc = 0x8235ad8, _tab = 0x827d658, _mSz = 4, _sz = 1}, _tStamp = 0, _rank = {
    _value = 0x827c5d0}, _level = 2, _inDeg = 2, _depsPushed = 0, _inQueue = 0, _exclSol = 0}


As you can see, gdb is currently sitting on a method (applyIntVar) within a visitor object. If I attempt to print the field _theTarget that lives within this object, gdb reports no symbol. If I go through this as in 

p this->_theTarget

Everything works fine. 
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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