[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

781.0. "ladebug can't coerce simple pointers" by ADA9X::BRETT () Mon Jan 20 1997 13:32

T.RTitleUserPersonal
Name
DateLines
781.1ADA9X::BRETTMon Jan 20 1997 13:335
781.2Another exampleCXXC::MJHANSMatthew Hanselman, DEC C/C++Mon Mar 31 1997 11:2943
    Another example with C++ 5.6 and ladebug 4.0-33.
    
    C lets me do it -- I can look at the results in the program.  But
    ladebug won't let me do it:
    
    struct A {
      int data;
    };
    
    struct B {
      int data;
      int more_data;
    } b;
    
    A* a = (A*) &b;
    
    main() {}
    
    ---------------------------------------------------------------------
    
    % ladebug a.out
    Welcome to the Ladebug Debugger Version 4.0-33
    ------------------ 
    object file name: a.out 
    Reading symbolic information ...done
    (ladebug) stop in main
    [#1: stop in int main(void) ]
    (ladebug) run
    [1] stopped at [int main(void):12 0x120001b34]
         12 main() {}
    (ladebug) p a
    0x1400002a0
    (ladebug) p *a
    struct A { 
      data = 0; 
    }
    (ladebug) p (A*) &b
    Cannot coerce pointers to incompatible classes
    Unable to cast B* to A*
    Error: no value for (A *)&b
    
    
    							- Matt