[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::decladebug

Title:Digital Ladebug debugger
Moderator:TLE::LUCIA
Created:Fri Feb 28 1992
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:969
Total number of notes:3959

937.0. "Cannot view data members intuitively while in member function" by CXXC::MJHANS (Matthew Hanselman, DEC C/C++) Mon Apr 28 1997 17:27

    Using dxladebug 4.0-35 and DEC C++ V5.5-004
    
    Here is an example where you cannot view a class' data members, as
    ladebug will give you an "not in current scope" messsage.  Note that
    you can view the data members if you reference off the "this" pointer. 
    Also note the problem goes away if you don't have the include file
    (i.e. have the class declaration in tmp.cxx).
    
    							- Matt
    // tmp.hxx
    class C {
      char *data;
    public:
      C();
    };
    -------------------------------
    // tmp.cxx
    #include "tmp.hxx"
    
    C::C()
    {
      data = "test";
      return;
    }
    
    main()
    {
      C c;
    }
    -------------------------------
    % ladebug a.out 
    Welcome to the Ladebug Debugger Version 4.0-35
    ------------------ 
    object file name: a.out 
    Reading symbolic information ...done
    (ladebug) stop in C::C
    [#1: stop in C::C(void) ]
    (ladebug) run
    [1] stopped at [C::C(void):6 0x12000214c]
          6   data = "test";
    (ladebug) p data
    Symbol data not visible in current scope.
    Error: no value for data
    (ladebug) p this->data
    0x0
    (ladebug) quit
    
T.RTitleUserPersonal
Name
DateLines
937.1TLE::LUCIAhttp://asaab.zko.dec.com/~lucia/biography.htmlMon Apr 28 1997 17:432
    This sounds remarkably like an untriggered class...
    
937.2CXXC::MJHANSMatthew Hanselman, DEC C/C++Mon Apr 28 1997 17:5231
    I reproduced the problem on V5.5, to make sure it wasn't a compiler
    regression.  Note the output below; ladebug seems to know about everything
    about the class.
    
    							- Matt
    
    Welcome to the Ladebug Debugger Version 4.0-35
    ------------------ 
    object file name: a.out 
    Reading symbolic information ...done
    (ladebug) stop in C::C
    [#1: stop in C::C(void) ]
    (ladebug) run
    [1] stopped at [C::C(void):6 0x12000214c]
          6   data = "test";
    (ladebug) p data
    Symbol data not visible in current scope.
    Error: no value for data
    (ladebug) whatis C
    class C  {
      char* data;
      C(void);
    }
    (ladebug) whatis this
    C* const this
    (ladebug) whereis C
    "tmp.hxx"`C
    "tmp.hxx"`C
    "tmp.hxx"`C.C
    "tmp.hxx"`C.C
    "tmp.cxx"`C
937.3Use of 'this' is tell-tale factorTLE::MERRITTSteve Merritt, Ladebug TeamTue Apr 29 1997 10:358
From .0, if you can say 'this->foo' then the class has to have
been triggered (as .2 shows).  I will take a look at this bug.

In regards to .1, Tim implies (and rightly so) that we are 
experiencing more untriggered classes than we should.  This needs 
to be researched.

-Steve
937.4Fixed in 4.0-36TLE::MERRITTSteve Merritt, Ladebug TeamTue Apr 29 1997 11:5425
I tried this out and its already been fixed.  We hit this problem shortly 
after 4.0-35 went out.  The fix for this is in 4.0-36.


Welcome to the Ladebug Debugger Version 4.0-36
------------------
object file name: tmp
Reading symbolic information ...done
(ladebug) stop in C::C
[#1: stop in C::C(void) ]
(ladebug) run
[1] stopped at [C::C(void):6 0x1200022dc]
      6   data = "test";
(ladebug) p data
0x1000
(ladebug) p this->data
0x1000
(ladebug) next
stopped at [C::C(void):7 0x1200022e4]
      7   return;
(ladebug) p data
0x120001cd0="test"
(ladebug) p this->data
0x120001cd0="test"
(ladebug) quit