[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

850.0. "<bad reference> when viewing a reference variable" by DECC::MJHANS (Matthew Hanselman, DEC C) Fri Feb 21 1997 15:15

    DEC C++ V5.5-004, ladebug 4.0-30:                         
    
    This program will produce a bad reference when attempting to view a
    variable.
    
    Step into b().  When in b(), try printing out one.  You'll get the
    message "<bad reference>"
    
    Note that if you remove the initialization of the variable "two", the
    problem goes away.
    
    							- Matt
    
    -------------------
    struct A_tag {
      int a_member;
    };
    
    static A_tag* get_tag(A_tag& var)
    {
      return 0;
    }
    
    static void b(A_tag& var)
    {
      A_tag& one = var;
      A_tag* two = get_tag(var);
    }
    
    main()
    {
      A_tag var;
    
      b(var);
      return 0;
    }
    --------------------
    
    Welcome to the Ladebug Debugger Version 4.0-30
    ------------------ 
    object file name: a.out 
    Reading symbolic information ...done
    (ladebug) stop in b
    [#1: stop in void b(A_tag&) ]
    (ladebug) run
    [1] stopped at [void b(A_tag&):12 0x120002124]
         12   A_tag& one = var;
    (ladebug) print one
    <bad reference>
    (ladebug) 
    
    
    							- Matt
T.RTitleUserPersonal
Name
DateLines
850.1TLE::MURRAYWanfang MurrayMon Feb 24 1997 07:265
    
    Stephen will take a look at this.
    
    Wanfang
    
850.2motivationCAIRN::HARRISKevin Harris, dtn 381-2039Thu Mar 06 1997 14:427
This one bit me today.  With reference parameters and reference variables.
We use reference arguments and variables heavily in the Middle End of the EDG
based C++ compilers, so we will continue to have this problem until it is
fixed in ladebug.  I discovered that I could get the necessary variable value
by examining non-reference variables higher up in the call stack, so we don't
need an additional workaround.
				-Kevin
850.3TLE::BRETTWed May 28 1997 15:281
fixed