BUG: Debugger Cannot Watch Function Returning struct or union

Last reviewed: February 3, 1998
Article ID: Q177937
The information in this article applies to:
  • The integrated debugger included with:

        - Microsoft Visual C++, 32-bit Editions, versions 5.0, 5.0sp1, 5.0sp2
    

SYMPTOMS

Adding a function call in the Developer Studio debugger Watch window may result in the following message if the function returns a struct or union with a field width greater than 4 bytes:

   Error: cannot display value

RESOLUTION

There is no workaround for this problem.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The following procedure reproduces this problem:

  1. Create a new console application project and add the following file to the project:

          /* File: TEST.CPP */
    

           struct _XX
    
               {
               char   m1;
               char   m2;
               char   m3;
               char   m4;
               } XX;
    
           struct _XX fun()
           {
               return XX;
           }
    
           int main()
           {
               fun();
               return 0;
           }
    
    

  2. Build the project.

  3. Click Build|Start Debug|Step Into on the Developer Studio menu.

  4. Goto the Watch window by selecting View|Debug Windows|Watch.

  5. Add the following watch expression in the “Name” column:

          fun()
    

Results: You will see the message "Error: cannot display value" in the “Value” column.
Keywords          : vcbuglist500 WBDebug
Version           : WINNT:5.0,5.0sp1,5.0sp2
Platform          : winnt
Issue type        : kbbug


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 3, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.