| 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 | 
    Sorry -- I've found more problems with the new single-class approach:
    
    Using shared objects with ladebug 4.0-33 and C++ V5.6-121, you cannot
    type "print b.mf2()" while in main() -- ladebug gives the error "No
    class object...".  Note that the problem goes away when you compile
    non-shared.
    
    The commands to use are:
    
    cxx -g -O0 -shared -rpath . -o x_0041a.so x_0041a.cxx
    cxx -g -O0 x_0041a.so x_0041b.cxx
    ladebug a.out
        stop in main ; run ; p b.mf2()
    
    The sources are:
    -------------------------
    // x_0041.h
    #include "stdio.h"
    
    extern int counter;
    
    typedef class BASE { public:
        int bi; 
        /*ctr*/ BASE() : bi(counter++) {}
        void mf1();
        void mf2();
    } *BASE_ptr;
    ------------------------
    // x_0041a.cxx
    #include "x_0041.h"
    
    static int i = (counter=101);   // reset counter
    
    void BASE::mf1() {
        printf("BASE::mf1\n");
        mf2();
    }
    ------------------------
    #include "x_0041.h"
    int counter;
    static int i = (counter=1);     // reset counter
    
    BASE b;
    
    void BASE::mf2() {
        printf("BASE::mf2\n");
    }
    
    int main()
    {
        b.mf1();
        return 0;
    }
    ------------------------
    
    The output from ladebug:
    
    
    Welcome to the Ladebug Debugger Version 4.0-33
    ------------------ 
    object file name: a.out 
    Reading symbolic information ...done
    (ladebug) stop in main ; run ; p b.mf2()
    [#1: stop in int main(void) ]
    [1] stopped at [int main(void):14 0x120001cd8]
         14     b.mf1();
    No class object for member function call which requires one
    Error: no value for b.mf2() 
    
    
    							- Matt
| T.R | Title | User | Personal Name | Date | Lines | 
|---|---|---|---|---|---|
| 892.1 | Being looked at.... | TLE::MERRITT | Steve Merritt, Ladebug Team | Mon Mar 24 1997 09:55 | 5 | 
| This is being looked at now. -Steve | |||||
| 892.2 | Fixed | TLE::MERRITT | Steve Merritt, Ladebug Team | Fri Apr 18 1997 13:31 | 22 | 
| This is fixed in 4.0-36
alime.zko.dec.com> cxx -g -O0 -shared -rpath . -o x_0041a.so x_0041a.cxx
ld:
Warning: Unresolved:
counter
BASE::mf2(void)
alime.zko.dec.com> cxx -g -O0 x_0041a.so x_0041b.cxx -o 0041
alime.zko.dec.com> $V40P/ladebug 0041
Welcome to the Ladebug Debugger Version 4.0-36
------------------
object file name: 0041
Reading symbolic information ...done
(ladebug) stop in main
[#1: stop in int main(void) ]
(ladebug) run
[1] stopped at [int main(void):13 0x120002508]
     13     b.mf1();
(ladebug) print b.mf2()
BASE::mf2
void
 | |||||